Skip to content

Commit a38180b

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Move and introduce new IRTE-related unions and structures
Move existing unions and structs for accessing/managing IRTE to a proper header file. This is mainly to simplify variable declarations in subsequent patches. Besides, this patch also introduces new struct irte_ga for the new 128-bit IRTE format. Signed-off-by: Suravee Suthikulpanit <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 3928aa3 commit a38180b

File tree

2 files changed

+76
-28
lines changed

2 files changed

+76
-28
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3511,34 +3511,6 @@ EXPORT_SYMBOL(amd_iommu_device_info);
35113511
*
35123512
*****************************************************************************/
35133513

3514-
union irte {
3515-
u32 val;
3516-
struct {
3517-
u32 valid : 1,
3518-
no_fault : 1,
3519-
int_type : 3,
3520-
rq_eoi : 1,
3521-
dm : 1,
3522-
rsvd_1 : 1,
3523-
destination : 8,
3524-
vector : 8,
3525-
rsvd_2 : 8;
3526-
} fields;
3527-
};
3528-
3529-
struct irq_2_irte {
3530-
u16 devid; /* Device ID for IRTE table */
3531-
u16 index; /* Index into IRTE table*/
3532-
};
3533-
3534-
struct amd_ir_data {
3535-
struct irq_2_irte irq_2_irte;
3536-
union irte irte_entry;
3537-
union {
3538-
struct msi_msg msi_entry;
3539-
};
3540-
};
3541-
35423514
static struct irq_chip amd_ir_chip;
35433515

35443516
#define DTE_IRQ_PHYS_ADDR_MASK (((1ULL << 45)-1) << 6)

drivers/iommu/amd_iommu_types.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <linux/types.h>
2424
#include <linux/mutex.h>
25+
#include <linux/msi.h>
2526
#include <linux/list.h>
2627
#include <linux/spinlock.h>
2728
#include <linux/pci.h>
@@ -705,4 +706,79 @@ enum amd_iommu_intr_mode_type {
705706
x == AMD_IOMMU_GUEST_IR_LEGACY_GA)
706707

707708
#define AMD_IOMMU_GUEST_IR_VAPIC(x) (x == AMD_IOMMU_GUEST_IR_VAPIC)
709+
710+
union irte {
711+
u32 val;
712+
struct {
713+
u32 valid : 1,
714+
no_fault : 1,
715+
int_type : 3,
716+
rq_eoi : 1,
717+
dm : 1,
718+
rsvd_1 : 1,
719+
destination : 8,
720+
vector : 8,
721+
rsvd_2 : 8;
722+
} fields;
723+
};
724+
725+
union irte_ga_lo {
726+
u64 val;
727+
728+
/* For int remapping */
729+
struct {
730+
u64 valid : 1,
731+
no_fault : 1,
732+
/* ------ */
733+
int_type : 3,
734+
rq_eoi : 1,
735+
dm : 1,
736+
/* ------ */
737+
guest_mode : 1,
738+
destination : 8,
739+
rsvd : 48;
740+
} fields_remap;
741+
742+
/* For guest vAPIC */
743+
struct {
744+
u64 valid : 1,
745+
no_fault : 1,
746+
/* ------ */
747+
ga_log_intr : 1,
748+
rsvd1 : 3,
749+
is_run : 1,
750+
/* ------ */
751+
guest_mode : 1,
752+
destination : 8,
753+
rsvd2 : 16,
754+
ga_tag : 32;
755+
} fields_vapic;
756+
};
757+
758+
union irte_ga_hi {
759+
u64 val;
760+
struct {
761+
u64 vector : 8,
762+
rsvd_1 : 4,
763+
ga_root_ptr : 40,
764+
rsvd_2 : 12;
765+
} fields;
766+
};
767+
768+
struct irte_ga {
769+
union irte_ga_lo lo;
770+
union irte_ga_hi hi;
771+
};
772+
773+
struct irq_2_irte {
774+
u16 devid; /* Device ID for IRTE table */
775+
u16 index; /* Index into IRTE table*/
776+
};
777+
778+
struct amd_ir_data {
779+
struct irq_2_irte irq_2_irte;
780+
union irte irte_entry;
781+
struct msi_msg msi_entry;
782+
};
783+
708784
#endif /* _ASM_X86_AMD_IOMMU_TYPES_H */

0 commit comments

Comments
 (0)