vt-d: Define a struct IO_xAPIC_route_entry to accommodate both ioapic
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 9 Oct 2008 10:08:13 +0000 (11:08 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 9 Oct 2008 10:08:13 +0000 (11:08 +0100)
and iosapic.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
xen/drivers/passthrough/vtd/intremap.c
xen/drivers/passthrough/vtd/vtd.h

index 2a2ba08d165b74c4a1b10831bb46bfd338a9d6c2..356e887ef8a9970c24dced667321cf4da4831d37 100644 (file)
@@ -44,7 +44,7 @@ u16 apicid_to_bdf(int apic_id)
 }
 
 static int remap_entry_to_ioapic_rte(
-    struct iommu *iommu, struct IO_APIC_route_entry *old_rte)
+    struct iommu *iommu, struct IO_xAPIC_route_entry *old_rte)
 {
     struct iremap_entry *iremap_entry = NULL, *iremap_entries;
     struct IO_APIC_route_remap_entry *remap_rte;
@@ -90,13 +90,13 @@ static int remap_entry_to_ioapic_rte(
 }
 
 static int ioapic_rte_to_remap_entry(struct iommu *iommu,
-    int apic_id, struct IO_APIC_route_entry *old_rte,
+    int apic_id, struct IO_xAPIC_route_entry *old_rte,
     unsigned int rte_upper, unsigned int value)
 {
     struct iremap_entry *iremap_entry = NULL, *iremap_entries;
     struct iremap_entry new_ire;
     struct IO_APIC_route_remap_entry *remap_rte;
-    struct IO_APIC_route_entry new_rte;
+    struct IO_xAPIC_route_entry new_rte;
     int index;
     unsigned long flags;
     struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
@@ -177,7 +177,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
 unsigned int io_apic_read_remap_rte(
     unsigned int apic, unsigned int reg)
 {
-    struct IO_APIC_route_entry old_rte = { 0 };
+    struct IO_xAPIC_route_entry old_rte = { 0 };
     struct IO_APIC_route_remap_entry *remap_rte;
     int rte_upper = (reg & 1) ? 1 : 0;
     struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid);
@@ -222,7 +222,7 @@ unsigned int io_apic_read_remap_rte(
 void io_apic_write_remap_rte(
     unsigned int apic, unsigned int reg, unsigned int value)
 {
-    struct IO_APIC_route_entry old_rte = { 0 };
+    struct IO_xAPIC_route_entry old_rte = { 0 };
     struct IO_APIC_route_remap_entry *remap_rte;
     unsigned int rte_upper = (reg & 1) ? 1 : 0;
     struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid);
index d240ab73144114481228241af8286452489f64c3..6aa8cf59ccebd789c40ab52c670ac955211ee1cc 100644 (file)
 
 #include <xen/iommu.h>
 
+/* Accomodate both IOAPIC and IOSAPIC. */
+struct IO_xAPIC_route_entry {
+    __u32   vector      :  8,
+        delivery_mode   :  3,   /* 000: FIXED
+                                 * 001: lowest prio
+                                 * 111: ExtINT
+                                 */
+        dest_mode       :  1,   /* 0: physical, 1: logical */
+        delivery_status :  1,
+        polarity        :  1,
+        irr             :  1,
+        trigger         :  1,   /* 0: edge, 1: level */
+        mask            :  1,   /* 0: enabled, 1: disabled */
+        __reserved_2    : 15;
+   
+    union {
+        struct { __u32
+            __reserved_1    : 24,
+            physical_dest   :  4,
+            __reserved_2    :  4;
+        } physical;
+
+        struct { __u32
+            __reserved_1    : 24,
+            logical_dest    :  8;
+        } logical;
+
+#ifdef __ia64__
+        struct { __u32
+            __reserved_1    : 16,
+            dest_id         : 16;
+        };
+#endif
+    } dest;
+
+} __attribute__ ((packed));
+
 struct IO_APIC_route_remap_entry {
     union {
         u64 val;