Skip to content

AMD PCI_SBDF_T cleanup

Following on from 250d87dc, struct amd_iommu has it's seg and bdf fields backwards WRT pci_sbdf_t.

Swap them around, and simplify the expressions regenerating an sbdf_t from seg+bdf.

diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index 00e81b4b2ab3..a30c8c97ea1f 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -77,8 +77,14 @@ struct amd_iommu {
     struct list_head list;
     spinlock_t lock; /* protect iommu */
 
-    u16 seg;
-    u16 bdf;
+    union {
+        struct {
+            uint16_t bdf;
+            uint16_t seg;
+        };
+        pci_sbdf_t sbdf;
+    };
+
     struct msi_desc msi;
 
     u16 cap_offset;
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information