ia64/xen-unstable

changeset 18600:b8f329d2c074

vt-d: Define a struct IO_xAPIC_route_entry to accommodate both ioapic
and iosapic.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Oct 09 11:08:13 2008 +0100 (2008-10-09)
parents 10dec51bfa81
children a11ad61bdb5b
files xen/drivers/passthrough/vtd/intremap.c xen/drivers/passthrough/vtd/vtd.h
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/intremap.c	Thu Oct 09 10:16:49 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/vtd/intremap.c	Thu Oct 09 11:08:13 2008 +0100
     1.3 @@ -44,7 +44,7 @@ u16 apicid_to_bdf(int apic_id)
     1.4  }
     1.5  
     1.6  static int remap_entry_to_ioapic_rte(
     1.7 -    struct iommu *iommu, struct IO_APIC_route_entry *old_rte)
     1.8 +    struct iommu *iommu, struct IO_xAPIC_route_entry *old_rte)
     1.9  {
    1.10      struct iremap_entry *iremap_entry = NULL, *iremap_entries;
    1.11      struct IO_APIC_route_remap_entry *remap_rte;
    1.12 @@ -90,13 +90,13 @@ static int remap_entry_to_ioapic_rte(
    1.13  }
    1.14  
    1.15  static int ioapic_rte_to_remap_entry(struct iommu *iommu,
    1.16 -    int apic_id, struct IO_APIC_route_entry *old_rte,
    1.17 +    int apic_id, struct IO_xAPIC_route_entry *old_rte,
    1.18      unsigned int rte_upper, unsigned int value)
    1.19  {
    1.20      struct iremap_entry *iremap_entry = NULL, *iremap_entries;
    1.21      struct iremap_entry new_ire;
    1.22      struct IO_APIC_route_remap_entry *remap_rte;
    1.23 -    struct IO_APIC_route_entry new_rte;
    1.24 +    struct IO_xAPIC_route_entry new_rte;
    1.25      int index;
    1.26      unsigned long flags;
    1.27      struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
    1.28 @@ -177,7 +177,7 @@ static int ioapic_rte_to_remap_entry(str
    1.29  unsigned int io_apic_read_remap_rte(
    1.30      unsigned int apic, unsigned int reg)
    1.31  {
    1.32 -    struct IO_APIC_route_entry old_rte = { 0 };
    1.33 +    struct IO_xAPIC_route_entry old_rte = { 0 };
    1.34      struct IO_APIC_route_remap_entry *remap_rte;
    1.35      int rte_upper = (reg & 1) ? 1 : 0;
    1.36      struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid);
    1.37 @@ -222,7 +222,7 @@ unsigned int io_apic_read_remap_rte(
    1.38  void io_apic_write_remap_rte(
    1.39      unsigned int apic, unsigned int reg, unsigned int value)
    1.40  {
    1.41 -    struct IO_APIC_route_entry old_rte = { 0 };
    1.42 +    struct IO_xAPIC_route_entry old_rte = { 0 };
    1.43      struct IO_APIC_route_remap_entry *remap_rte;
    1.44      unsigned int rte_upper = (reg & 1) ? 1 : 0;
    1.45      struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid);
     2.1 --- a/xen/drivers/passthrough/vtd/vtd.h	Thu Oct 09 10:16:49 2008 +0100
     2.2 +++ b/xen/drivers/passthrough/vtd/vtd.h	Thu Oct 09 11:08:13 2008 +0100
     2.3 @@ -23,6 +23,43 @@
     2.4  
     2.5  #include <xen/iommu.h>
     2.6  
     2.7 +/* Accomodate both IOAPIC and IOSAPIC. */
     2.8 +struct IO_xAPIC_route_entry {
     2.9 +    __u32   vector      :  8,
    2.10 +        delivery_mode   :  3,   /* 000: FIXED
    2.11 +                                 * 001: lowest prio
    2.12 +                                 * 111: ExtINT
    2.13 +                                 */
    2.14 +        dest_mode       :  1,   /* 0: physical, 1: logical */
    2.15 +        delivery_status :  1,
    2.16 +        polarity        :  1,
    2.17 +        irr             :  1,
    2.18 +        trigger         :  1,   /* 0: edge, 1: level */
    2.19 +        mask            :  1,   /* 0: enabled, 1: disabled */
    2.20 +        __reserved_2    : 15;
    2.21 +   
    2.22 +    union {
    2.23 +        struct { __u32
    2.24 +            __reserved_1    : 24,
    2.25 +            physical_dest   :  4,
    2.26 +            __reserved_2    :  4;
    2.27 +        } physical;
    2.28 +
    2.29 +        struct { __u32
    2.30 +            __reserved_1    : 24,
    2.31 +            logical_dest    :  8;
    2.32 +        } logical;
    2.33 +
    2.34 +#ifdef __ia64__
    2.35 +        struct { __u32
    2.36 +            __reserved_1    : 16,
    2.37 +            dest_id         : 16;
    2.38 +        };
    2.39 +#endif
    2.40 +    } dest;
    2.41 +
    2.42 +} __attribute__ ((packed));
    2.43 +
    2.44  struct IO_APIC_route_remap_entry {
    2.45      union {
    2.46          u64 val;