[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/6] x86/vtd: Rename struct iommu to vtd_iommu



VT-d's local struct iommu is an overly-generic name, for a structure which in
practice maps 1-to-1 with the real IOMMUs in the system.

Additionally, address style issues on impacted lines.  This is mostly
positioning of * for pointers and unnecessay casts with void pointers.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Paul Durrant <paul.durrant@xxxxxxxxxx>
CC: Jun Nakajima <jun.nakajima@xxxxxxxxx>
CC: Kevin Tian <kevin.tian@xxxxxxxxx>
---
 xen/drivers/passthrough/vtd/dmar.c     |  6 +--
 xen/drivers/passthrough/vtd/dmar.h     |  4 +-
 xen/drivers/passthrough/vtd/extern.h   | 36 ++++++++---------
 xen/drivers/passthrough/vtd/intremap.c | 26 ++++++------
 xen/drivers/passthrough/vtd/iommu.c    | 74 +++++++++++++++++-----------------
 xen/drivers/passthrough/vtd/iommu.h    |  8 ++--
 xen/drivers/passthrough/vtd/qinval.c   | 34 ++++++++--------
 xen/drivers/passthrough/vtd/quirks.c   | 10 ++---
 xen/drivers/passthrough/vtd/utils.c    |  8 ++--
 xen/drivers/passthrough/vtd/x86/ats.c  |  6 +--
 10 files changed, 106 insertions(+), 106 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c 
b/xen/drivers/passthrough/vtd/dmar.c
index 81afa54..ce1b8ce 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -137,7 +137,7 @@ struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id)
     return NULL;
 }
 
-struct acpi_drhd_unit * iommu_to_drhd(struct iommu *iommu)
+struct acpi_drhd_unit *iommu_to_drhd(struct vtd_iommu *iommu)
 {
     struct acpi_drhd_unit *drhd;
 
@@ -151,7 +151,7 @@ struct acpi_drhd_unit * iommu_to_drhd(struct iommu *iommu)
     return NULL;
 }
 
-struct iommu * ioapic_to_iommu(unsigned int apic_id)
+struct vtd_iommu *ioapic_to_iommu(unsigned int apic_id)
 {
     struct acpi_drhd_unit *drhd;
 
@@ -182,7 +182,7 @@ struct acpi_drhd_unit *hpet_to_drhd(unsigned int hpet_id)
     return NULL;
 }
 
-struct iommu *hpet_to_iommu(unsigned int hpet_id)
+struct vtd_iommu *hpet_to_iommu(unsigned int hpet_id)
 {
     struct acpi_drhd_unit *drhd = hpet_to_drhd(hpet_id);
 
diff --git a/xen/drivers/passthrough/vtd/dmar.h 
b/xen/drivers/passthrough/vtd/dmar.h
index 95bb132..1a9c965 100644
--- a/xen/drivers/passthrough/vtd/dmar.h
+++ b/xen/drivers/passthrough/vtd/dmar.h
@@ -63,7 +63,7 @@ struct acpi_drhd_unit {
     u64    address;                     /* register base address of the unit */
     u16    segment;
     u8     include_all:1;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     struct list_head ioapic_list;
     struct list_head hpet_list;
 };
@@ -128,7 +128,7 @@ do {                                                \
 } while (0)
 
 int vtd_hw_check(void);
-void disable_pmr(struct iommu *iommu);
+void disable_pmr(struct vtd_iommu *iommu);
 int is_igd_drhd(struct acpi_drhd_unit *drhd);
 
 #endif /* _DMAR_H_ */
diff --git a/xen/drivers/passthrough/vtd/extern.h 
b/xen/drivers/passthrough/vtd/extern.h
index 16eada9..cfef9a3 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -30,38 +30,38 @@ extern bool_t rwbf_quirk;
 extern const struct iommu_ops intel_iommu_ops;
 
 void print_iommu_regs(struct acpi_drhd_unit *drhd);
-void print_vtd_entries(struct iommu *iommu, int bus, int devfn, u64 gmfn);
+void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn);
 keyhandler_fn_t vtd_dump_iommu_info;
 
-int enable_qinval(struct iommu *iommu);
-void disable_qinval(struct iommu *iommu);
-int enable_intremap(struct iommu *iommu, int eim);
-void disable_intremap(struct iommu *iommu);
+int enable_qinval(struct vtd_iommu *iommu);
+void disable_qinval(struct vtd_iommu *iommu);
+int enable_intremap(struct vtd_iommu *iommu, bool eim);
+void disable_intremap(struct vtd_iommu *iommu);
 
 void iommu_flush_cache_entry(void *addr, unsigned int size);
 void iommu_flush_cache_page(void *addr, unsigned long npages);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
-int iommu_flush_iec_global(struct iommu *iommu);
-int iommu_flush_iec_index(struct iommu *iommu, u8 im, u16 iidx);
-void clear_fault_bits(struct iommu *iommu);
+int iommu_flush_iec_global(struct vtd_iommu *iommu);
+int iommu_flush_iec_index(struct vtd_iommu *iommu, u8 im, u16 iidx);
+void clear_fault_bits(struct vtd_iommu *iommu);
 
-struct iommu * ioapic_to_iommu(unsigned int apic_id);
-struct iommu * hpet_to_iommu(unsigned int hpet_id);
+struct vtd_iommu *ioapic_to_iommu(unsigned int apic_id);
+struct vtd_iommu *hpet_to_iommu(unsigned int hpet_id);
 struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id);
 struct acpi_drhd_unit * hpet_to_drhd(unsigned int hpet_id);
-struct acpi_drhd_unit * iommu_to_drhd(struct iommu *iommu);
+struct acpi_drhd_unit *iommu_to_drhd(struct vtd_iommu *iommu);
 struct acpi_rhsa_unit * drhd_to_rhsa(struct acpi_drhd_unit *drhd);
 
-struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu);
+struct acpi_drhd_unit *find_ats_dev_drhd(struct vtd_iommu *iommu);
 
 int ats_device(const struct pci_dev *, const struct acpi_drhd_unit *);
 
-int dev_invalidate_iotlb(struct iommu *iommu, u16 did,
+int dev_invalidate_iotlb(struct vtd_iommu *iommu, u16 did,
                          u64 addr, unsigned int size_order, u64 type);
 
-int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
+int __must_check qinval_device_iotlb_sync(struct vtd_iommu *iommu,
                                           struct pci_dev *pdev,
                                           u16 did, u16 size, u64 addr);
 
@@ -73,9 +73,9 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned 
long npages);
 void free_pgtable_maddr(u64 maddr);
 void *map_vtd_domain_page(u64 maddr);
 void unmap_vtd_domain_page(void *va);
-int domain_context_mapping_one(struct domain *domain, struct iommu *iommu,
+int domain_context_mapping_one(struct domain *domain, struct vtd_iommu *iommu,
                                u8 bus, u8 devfn, const struct pci_dev *);
-int domain_context_unmap_one(struct domain *domain, struct iommu *iommu,
+int domain_context_unmap_one(struct domain *domain, struct vtd_iommu *iommu,
                              u8 bus, u8 devfn);
 int intel_iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt);
 
@@ -92,8 +92,8 @@ int intel_setup_hpet_msi(struct msi_desc *);
 
 int is_igd_vt_enabled_quirk(void);
 void platform_quirks_init(void);
-void vtd_ops_preamble_quirk(struct iommu* iommu);
-void vtd_ops_postamble_quirk(struct iommu* iommu);
+void vtd_ops_preamble_quirk(struct vtd_iommu *iommu);
+void vtd_ops_postamble_quirk(struct vtd_iommu *iommu);
 int __must_check me_wifi_quirk(struct domain *domain,
                                u8 bus, u8 devfn, int map);
 void pci_vtd_quirk(const struct pci_dev *);
diff --git a/xen/drivers/passthrough/vtd/intremap.c 
b/xen/drivers/passthrough/vtd/intremap.c
index 1d19856..30b8f90 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -176,7 +176,7 @@ bool_t __init iommu_supports_eim(void)
  * present an atomic update to VT-d hardware even when cmpxchg16b
  * instruction is not supported.
  */
-static void update_irte(struct iommu *iommu, struct iremap_entry *entry,
+static void update_irte(struct vtd_iommu *iommu, struct iremap_entry *entry,
                         const struct iremap_entry *new_ire, bool atomic)
 {
     ASSERT(spin_is_locked(&iommu_ir_ctrl(iommu)->iremap_lock));
@@ -217,7 +217,7 @@ static void update_irte(struct iommu *iommu, struct 
iremap_entry *entry,
 }
 
 /* Mark specified intr remap entry as free */
-static void free_remap_entry(struct iommu *iommu, int index)
+static void free_remap_entry(struct vtd_iommu *iommu, int index)
 {
     struct iremap_entry *iremap_entry = NULL, *iremap_entries, new_ire = { };
     struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
@@ -242,7 +242,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
  * Look for a free intr remap entry (or a contiguous set thereof).
  * Need hold iremap_lock, and setup returned entry before releasing lock.
  */
-static unsigned int alloc_remap_entry(struct iommu *iommu, unsigned int nr)
+static unsigned int alloc_remap_entry(struct vtd_iommu *iommu, unsigned int nr)
 {
     struct iremap_entry *iremap_entries = NULL;
     struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
@@ -280,7 +280,7 @@ static unsigned int alloc_remap_entry(struct iommu *iommu, 
unsigned int nr)
 }
 
 static int remap_entry_to_ioapic_rte(
-    struct iommu *iommu, int index, struct IO_xAPIC_route_entry *old_rte)
+    struct vtd_iommu *iommu, int index, struct IO_xAPIC_route_entry *old_rte)
 {
     struct iremap_entry *iremap_entry = NULL, *iremap_entries;
     unsigned long flags;
@@ -322,7 +322,7 @@ static int remap_entry_to_ioapic_rte(
     return 0;
 }
 
-static int ioapic_rte_to_remap_entry(struct iommu *iommu,
+static int ioapic_rte_to_remap_entry(struct vtd_iommu *iommu,
     int apic, unsigned int ioapic_pin, struct IO_xAPIC_route_entry *old_rte,
     unsigned int rte_upper, unsigned int value)
 {
@@ -418,7 +418,7 @@ unsigned int io_apic_read_remap_rte(
     int index;
     struct IO_xAPIC_route_entry old_rte = { 0 };
     int rte_upper = (reg & 1) ? 1 : 0;
-    struct iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic));
+    struct vtd_iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic));
     struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
 
     if ( !ir_ctrl->iremap_num ||
@@ -443,7 +443,7 @@ void io_apic_write_remap_rte(
     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(IO_APIC_ID(apic));
+    struct vtd_iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic));
     int saved_mask;
 
     old_rte = __ioapic_read_entry(apic, ioapic_pin, 1);
@@ -534,7 +534,7 @@ static void set_msi_source_id(struct pci_dev *pdev, struct 
iremap_entry *ire)
 }
 
 static int remap_entry_to_msi_msg(
-    struct iommu *iommu, struct msi_msg *msg, unsigned int index)
+    struct vtd_iommu *iommu, struct msi_msg *msg, unsigned int index)
 {
     struct iremap_entry *iremap_entry = NULL, *iremap_entries;
     struct msi_msg_remap_entry *remap_rte;
@@ -597,7 +597,7 @@ static int remap_entry_to_msi_msg(
 }
 
 static int msi_msg_to_remap_entry(
-    struct iommu *iommu, struct pci_dev *pdev,
+    struct vtd_iommu *iommu, struct pci_dev *pdev,
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
     struct iremap_entry *iremap_entry = NULL, *iremap_entries, new_ire = { };
@@ -730,7 +730,7 @@ int msi_msg_write_remap_rte(
 
 int __init intel_setup_hpet_msi(struct msi_desc *msi_desc)
 {
-    struct iommu *iommu = hpet_to_iommu(msi_desc->hpet_id);
+    struct vtd_iommu *iommu = hpet_to_iommu(msi_desc->hpet_id);
     struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
     unsigned long flags;
     int rc = 0;
@@ -753,7 +753,7 @@ int __init intel_setup_hpet_msi(struct msi_desc *msi_desc)
     return rc;
 }
 
-int enable_intremap(struct iommu *iommu, int eim)
+int enable_intremap(struct vtd_iommu *iommu, bool eim)
 {
     struct acpi_drhd_unit *drhd;
     struct ir_ctrl *ir_ctrl;
@@ -836,7 +836,7 @@ int enable_intremap(struct iommu *iommu, int eim)
     return init_apic_pin_2_ir_idx();
 }
 
-void disable_intremap(struct iommu *iommu)
+void disable_intremap(struct vtd_iommu *iommu)
 {
     u32 sts;
     u64 irta;
@@ -885,7 +885,7 @@ void disable_intremap(struct iommu *iommu)
 int iommu_enable_x2apic_IR(void)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
 
     if ( system_state < SYS_STATE_active )
     {
diff --git a/xen/drivers/passthrough/vtd/iommu.c 
b/xen/drivers/passthrough/vtd/iommu.c
index 50a0e25..e5b33d2 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -58,7 +58,7 @@ static int setup_hwdom_device(u8 devfn, struct pci_dev *);
 static void setup_hwdom_rmrr(struct domain *d);
 
 static int domain_iommu_domid(struct domain *d,
-                              struct iommu *iommu)
+                              struct vtd_iommu *iommu)
 {
     unsigned long nr_dom, i;
 
@@ -82,7 +82,7 @@ static int domain_iommu_domid(struct domain *d,
 #define DID_HIGH_OFFSET 8
 static int context_set_domain_id(struct context_entry *context,
                                  struct domain *d,
-                                 struct iommu *iommu)
+                                 struct vtd_iommu *iommu)
 {
     unsigned long nr_dom, i;
     int found = 0;
@@ -118,7 +118,7 @@ static int context_set_domain_id(struct context_entry 
*context,
 }
 
 static int context_get_domain_id(struct context_entry *context,
-                                 struct iommu *iommu)
+                                 struct vtd_iommu *iommu)
 {
     unsigned long dom_index, nr_dom;
     int domid = -1;
@@ -222,7 +222,7 @@ void free_pgtable_maddr(u64 maddr)
 }
 
 /* context entry handling */
-static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
+static u64 bus_to_context_maddr(struct vtd_iommu *iommu, u8 bus)
 {
     struct acpi_drhd_unit *drhd;
     struct root_entry *root, *root_entries;
@@ -316,7 +316,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, 
u64 addr, int alloc)
     return pte_maddr;
 }
 
-static void iommu_flush_write_buffer(struct iommu *iommu)
+static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 {
     u32 val;
     unsigned long flags;
@@ -340,7 +340,7 @@ static int __must_check flush_context_reg(void *_iommu, u16 
did, u16 source_id,
                                           u8 function_mask, u64 type,
                                           bool_t flush_non_present_entry)
 {
-    struct iommu *iommu = (struct iommu *) _iommu;
+    struct vtd_iommu *iommu = _iommu;
     u64 val = 0;
     unsigned long flags;
 
@@ -388,7 +388,7 @@ static int __must_check flush_context_reg(void *_iommu, u16 
did, u16 source_id,
     return 0;
 }
 
-static int __must_check iommu_flush_context_global(struct iommu *iommu,
+static int __must_check iommu_flush_context_global(struct vtd_iommu *iommu,
                                                    bool_t 
flush_non_present_entry)
 {
     struct iommu_flush *flush = iommu_get_flush(iommu);
@@ -396,7 +396,7 @@ static int __must_check iommu_flush_context_global(struct 
iommu *iommu,
                                  flush_non_present_entry);
 }
 
-static int __must_check iommu_flush_context_device(struct iommu *iommu,
+static int __must_check iommu_flush_context_device(struct vtd_iommu *iommu,
                                                    u16 did, u16 source_id,
                                                    u8 function_mask,
                                                    bool_t 
flush_non_present_entry)
@@ -413,7 +413,7 @@ static int __must_check flush_iotlb_reg(void *_iommu, u16 
did, u64 addr,
                                         bool_t flush_non_present_entry,
                                         bool_t flush_dev_iotlb)
 {
-    struct iommu *iommu = (struct iommu *) _iommu;
+    struct vtd_iommu *iommu = _iommu;
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
     u64 val = 0;
     unsigned long flags;
@@ -475,7 +475,7 @@ static int __must_check flush_iotlb_reg(void *_iommu, u16 
did, u64 addr,
     return 0;
 }
 
-static int __must_check iommu_flush_iotlb_global(struct iommu *iommu,
+static int __must_check iommu_flush_iotlb_global(struct vtd_iommu *iommu,
                                                  bool_t 
flush_non_present_entry,
                                                  bool_t flush_dev_iotlb)
 {
@@ -494,7 +494,7 @@ static int __must_check iommu_flush_iotlb_global(struct 
iommu *iommu,
     return status;
 }
 
-static int __must_check iommu_flush_iotlb_dsi(struct iommu *iommu, u16 did,
+static int __must_check iommu_flush_iotlb_dsi(struct vtd_iommu *iommu, u16 did,
                                               bool_t flush_non_present_entry,
                                               bool_t flush_dev_iotlb)
 {
@@ -513,7 +513,7 @@ static int __must_check iommu_flush_iotlb_dsi(struct iommu 
*iommu, u16 did,
     return status;
 }
 
-static int __must_check iommu_flush_iotlb_psi(struct iommu *iommu, u16 did,
+static int __must_check iommu_flush_iotlb_psi(struct vtd_iommu *iommu, u16 did,
                                               u64 addr, unsigned int order,
                                               bool_t flush_non_present_entry,
                                               bool_t flush_dev_iotlb)
@@ -549,7 +549,7 @@ static int __must_check iommu_flush_iotlb_psi(struct iommu 
*iommu, u16 did,
 static int __must_check iommu_flush_all(void)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     bool_t flush_dev_iotlb;
     int rc = 0;
 
@@ -590,7 +590,7 @@ static int __must_check iommu_flush_iotlb(struct domain *d, 
dfn_t dfn,
 {
     struct domain_iommu *hd = dom_iommu(d);
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     bool_t flush_dev_iotlb;
     int iommu_domid;
     int rc = 0;
@@ -726,7 +726,7 @@ static void iommu_free_page_table(struct page_info *pg)
     free_pgtable_maddr(pt_maddr);
 }
 
-static int iommu_set_root_entry(struct iommu *iommu)
+static int iommu_set_root_entry(struct vtd_iommu *iommu)
 {
     u32 sts;
     unsigned long flags;
@@ -749,7 +749,7 @@ static void iommu_enable_translation(struct acpi_drhd_unit 
*drhd)
 {
     u32 sts;
     unsigned long flags;
-    struct iommu *iommu = drhd->iommu;
+    struct vtd_iommu *iommu = drhd->iommu;
 
     if ( is_igd_drhd(drhd) )
     {
@@ -793,7 +793,7 @@ static void iommu_enable_translation(struct acpi_drhd_unit 
*drhd)
     disable_pmr(iommu);
 }
 
-static void iommu_disable_translation(struct iommu *iommu)
+static void iommu_disable_translation(struct vtd_iommu *iommu)
 {
     u32 sts;
     unsigned long flags;
@@ -870,7 +870,7 @@ static const char *iommu_get_fault_reason(u8 fault_reason,
     }
 }
 
-static int iommu_page_fault_do_one(struct iommu *iommu, int type,
+static int iommu_page_fault_do_one(struct vtd_iommu *iommu, int type,
                                    u8 fault_reason, u16 source_id, u64 addr)
 {
     const char *reason, *kind;
@@ -936,7 +936,7 @@ static void iommu_fault_status(u32 fault_status)
 }
 
 #define PRIMARY_FAULT_REG_LEN (16)
-static void __do_iommu_page_fault(struct iommu *iommu)
+static void __do_iommu_page_fault(struct vtd_iommu *iommu)
 {
     int reg, fault_index;
     u32 fault_status;
@@ -1039,7 +1039,7 @@ static void iommu_page_fault(int irq, void *dev_id,
 
 static void dma_msi_unmask(struct irq_desc *desc)
 {
-    struct iommu *iommu = desc->action->dev_id;
+    struct vtd_iommu *iommu = desc->action->dev_id;
     unsigned long flags;
     u32 sts;
 
@@ -1055,7 +1055,7 @@ static void dma_msi_unmask(struct irq_desc *desc)
 static void dma_msi_mask(struct irq_desc *desc)
 {
     unsigned long flags;
-    struct iommu *iommu = desc->action->dev_id;
+    struct vtd_iommu *iommu = desc->action->dev_id;
     u32 sts;
 
     /* mask it */
@@ -1091,7 +1091,7 @@ static void dma_msi_set_affinity(struct irq_desc *desc, 
const cpumask_t *mask)
     struct msi_msg msg;
     unsigned int dest;
     unsigned long flags;
-    struct iommu *iommu = desc->action->dev_id;
+    struct vtd_iommu *iommu = desc->action->dev_id;
 
     dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID){
@@ -1134,7 +1134,7 @@ static int __init iommu_set_interrupt(struct 
acpi_drhd_unit *drhd)
 {
     int irq, ret;
     struct acpi_rhsa_unit *rhsa = drhd_to_rhsa(drhd);
-    struct iommu *iommu = drhd->iommu;
+    struct vtd_iommu *iommu = drhd->iommu;
     struct irq_desc *desc;
 
     irq = create_irq(rhsa ? pxm_to_node(rhsa->proximity_domain)
@@ -1167,7 +1167,7 @@ static int __init iommu_set_interrupt(struct 
acpi_drhd_unit *drhd)
 
 int __init iommu_alloc(struct acpi_drhd_unit *drhd)
 {
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     unsigned long sagaw, nr_dom;
     int agaw;
 
@@ -1178,7 +1178,7 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
         return -ENOMEM;
     }
 
-    iommu = xzalloc(struct iommu);
+    iommu = xzalloc(struct vtd_iommu);
     if ( iommu == NULL )
         return -ENOMEM;
 
@@ -1265,7 +1265,7 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
 
 void __init iommu_free(struct acpi_drhd_unit *drhd)
 {
-    struct iommu *iommu = drhd->iommu;
+    struct vtd_iommu *iommu = drhd->iommu;
 
     if ( iommu == NULL )
         return;
@@ -1328,7 +1328,7 @@ static void __hwdom_init intel_iommu_hwdom_init(struct 
domain *d)
 
 int domain_context_mapping_one(
     struct domain *domain,
-    struct iommu *iommu,
+    struct vtd_iommu *iommu,
     u8 bus, u8 devfn, const struct pci_dev *pdev)
 {
     struct domain_iommu *hd = dom_iommu(domain);
@@ -1565,7 +1565,7 @@ static int domain_context_mapping(struct domain *domain, 
u8 devfn,
 
 int domain_context_unmap_one(
     struct domain *domain,
-    struct iommu *iommu,
+    struct vtd_iommu *iommu,
     u8 bus, u8 devfn)
 {
     struct context_entry *context, *context_entries;
@@ -1633,7 +1633,7 @@ static int domain_context_unmap(struct domain *domain, u8 
devfn,
                                 struct pci_dev *pdev)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     int ret = 0;
     u8 seg = pdev->seg, bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
     int found = 0;
@@ -1893,7 +1893,7 @@ int iommu_pte_flush(struct domain *d, uint64_t dfn, 
uint64_t *pte,
                     int order, int present)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
+    struct vtd_iommu *iommu = NULL;
     struct domain_iommu *hd = dom_iommu(d);
     bool_t flush_dev_iotlb;
     int iommu_domid;
@@ -1936,7 +1936,7 @@ int iommu_pte_flush(struct domain *d, uint64_t dfn, 
uint64_t *pte,
     return rc;
 }
 
-static int __init vtd_ept_page_compatible(struct iommu *iommu)
+static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
 
@@ -2116,7 +2116,7 @@ static int __hwdom_init setup_hwdom_device(u8 devfn, 
struct pci_dev *pdev)
     return domain_context_mapping(pdev->domain, devfn, pdev);
 }
 
-void clear_fault_bits(struct iommu *iommu)
+void clear_fault_bits(struct vtd_iommu *iommu)
 {
     u64 val;
     unsigned long flags;
@@ -2158,7 +2158,7 @@ __initcall(adjust_vtd_irq_affinities);
 static int __must_check init_vtd_hw(void)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     struct iommu_flush *flush = NULL;
     int ret;
     unsigned long flags;
@@ -2283,7 +2283,7 @@ static void __hwdom_init setup_hwdom_rmrr(struct domain 
*d)
 int __init intel_vtd_setup(void)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     int ret;
 
     if ( list_empty(&acpi_drhd_units) )
@@ -2551,7 +2551,7 @@ static u32 iommu_state[MAX_IOMMUS][MAX_IOMMU_REGS];
 static int __must_check vtd_suspend(void)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     u32    i;
     int rc;
 
@@ -2601,7 +2601,7 @@ static int __must_check vtd_suspend(void)
 static void vtd_crash_shutdown(void)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
 
     if ( !iommu_enabled )
         return;
@@ -2622,7 +2622,7 @@ static void vtd_crash_shutdown(void)
 static void vtd_resume(void)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     u32 i;
     unsigned long flags;
 
diff --git a/xen/drivers/passthrough/vtd/iommu.h 
b/xen/drivers/passthrough/vtd/iommu.h
index 1a992f7..556b3d6 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -533,7 +533,7 @@ struct intel_iommu {
     struct acpi_drhd_unit *drhd;
 };
 
-struct iommu {
+struct vtd_iommu {
     struct list_head list;
     void __iomem *reg; /* Pointer to hardware regs, virtual addr */
     u32        index;         /* Sequence number of iommu */
@@ -550,17 +550,17 @@ struct iommu {
     u16 *domid_map;               /* domain id mapping array */
 };
 
-static inline struct qi_ctrl *iommu_qi_ctrl(struct iommu *iommu)
+static inline struct qi_ctrl *iommu_qi_ctrl(struct vtd_iommu *iommu)
 {
     return iommu ? &iommu->intel->qi_ctrl : NULL;
 }
 
-static inline struct ir_ctrl *iommu_ir_ctrl(struct iommu *iommu)
+static inline struct ir_ctrl *iommu_ir_ctrl(struct vtd_iommu *iommu)
 {
     return iommu ? &iommu->intel->ir_ctrl : NULL;
 }
 
-static inline struct iommu_flush *iommu_get_flush(struct iommu *iommu)
+static inline struct iommu_flush *iommu_get_flush(struct vtd_iommu *iommu)
 {
     return iommu ? &iommu->intel->flush : NULL;
 }
diff --git a/xen/drivers/passthrough/vtd/qinval.c 
b/xen/drivers/passthrough/vtd/qinval.c
index 01447cf..3ddb9b6 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -31,9 +31,9 @@
 
 #define VTD_QI_TIMEOUT 1
 
-static int __must_check invalidate_sync(struct iommu *iommu);
+static int __must_check invalidate_sync(struct vtd_iommu *iommu);
 
-static void print_qi_regs(struct iommu *iommu)
+static void print_qi_regs(struct vtd_iommu *iommu)
 {
     u64 val;
 
@@ -47,7 +47,7 @@ static void print_qi_regs(struct iommu *iommu)
     printk("DMAR_IQT_REG = %"PRIx64"\n", val);
 }
 
-static unsigned int qinval_next_index(struct iommu *iommu)
+static unsigned int qinval_next_index(struct vtd_iommu *iommu)
 {
     u64 tail;
 
@@ -62,7 +62,7 @@ static unsigned int qinval_next_index(struct iommu *iommu)
     return tail;
 }
 
-static void qinval_update_qtail(struct iommu *iommu, unsigned int index)
+static void qinval_update_qtail(struct vtd_iommu *iommu, unsigned int index)
 {
     u64 val;
 
@@ -72,7 +72,7 @@ static void qinval_update_qtail(struct iommu *iommu, unsigned 
int index)
     dmar_writeq(iommu->reg, DMAR_IQT_REG, (val << QINVAL_INDEX_SHIFT));
 }
 
-static int __must_check queue_invalidate_context_sync(struct iommu *iommu,
+static int __must_check queue_invalidate_context_sync(struct vtd_iommu *iommu,
                                                       u16 did, u16 source_id,
                                                       u8 function_mask,
                                                       u8 granu)
@@ -106,7 +106,7 @@ static int __must_check 
queue_invalidate_context_sync(struct iommu *iommu,
     return invalidate_sync(iommu);
 }
 
-static int __must_check queue_invalidate_iotlb_sync(struct iommu *iommu,
+static int __must_check queue_invalidate_iotlb_sync(struct vtd_iommu *iommu,
                                                     u8 granu, u8 dr, u8 dw,
                                                     u16 did, u8 am, u8 ih,
                                                     u64 addr)
@@ -143,7 +143,7 @@ static int __must_check queue_invalidate_iotlb_sync(struct 
iommu *iommu,
     return invalidate_sync(iommu);
 }
 
-static int __must_check queue_invalidate_wait(struct iommu *iommu,
+static int __must_check queue_invalidate_wait(struct vtd_iommu *iommu,
                                               u8 iflag, u8 sw, u8 fn,
                                               bool_t flush_dev_iotlb)
 {
@@ -199,7 +199,7 @@ static int __must_check queue_invalidate_wait(struct iommu 
*iommu,
     return -EOPNOTSUPP;
 }
 
-static int __must_check invalidate_sync(struct iommu *iommu)
+static int __must_check invalidate_sync(struct vtd_iommu *iommu)
 {
     struct qi_ctrl *qi_ctrl = iommu_qi_ctrl(iommu);
 
@@ -208,7 +208,7 @@ static int __must_check invalidate_sync(struct iommu *iommu)
     return queue_invalidate_wait(iommu, 0, 1, 1, 0);
 }
 
-static int __must_check dev_invalidate_sync(struct iommu *iommu,
+static int __must_check dev_invalidate_sync(struct vtd_iommu *iommu,
                                             struct pci_dev *pdev, u16 did)
 {
     struct qi_ctrl *qi_ctrl = iommu_qi_ctrl(iommu);
@@ -237,7 +237,7 @@ static int __must_check dev_invalidate_sync(struct iommu 
*iommu,
     return rc;
 }
 
-int qinval_device_iotlb_sync(struct iommu *iommu, struct pci_dev *pdev,
+int qinval_device_iotlb_sync(struct vtd_iommu *iommu, struct pci_dev *pdev,
                              u16 did, u16 size, u64 addr)
 {
     unsigned long flags;
@@ -271,7 +271,7 @@ int qinval_device_iotlb_sync(struct iommu *iommu, struct 
pci_dev *pdev,
     return dev_invalidate_sync(iommu, pdev, did);
 }
 
-static int __must_check queue_invalidate_iec_sync(struct iommu *iommu,
+static int __must_check queue_invalidate_iec_sync(struct vtd_iommu *iommu,
                                                   u8 granu, u8 im, u16 iidx)
 {
     unsigned long flags;
@@ -310,12 +310,12 @@ static int __must_check queue_invalidate_iec_sync(struct 
iommu *iommu,
     return ret;
 }
 
-int iommu_flush_iec_global(struct iommu *iommu)
+int iommu_flush_iec_global(struct vtd_iommu *iommu)
 {
     return queue_invalidate_iec_sync(iommu, IEC_GLOBAL_INVL, 0, 0);
 }
 
-int iommu_flush_iec_index(struct iommu *iommu, u8 im, u16 iidx)
+int iommu_flush_iec_index(struct vtd_iommu *iommu, u8 im, u16 iidx)
 {
     return queue_invalidate_iec_sync(iommu, IEC_INDEX_INVL, im, iidx);
 }
@@ -324,7 +324,7 @@ static int __must_check flush_context_qi(void *_iommu, u16 
did,
                                          u16 sid, u8 fm, u64 type,
                                          bool_t flush_non_present_entry)
 {
-    struct iommu *iommu = (struct iommu *)_iommu;
+    struct vtd_iommu *iommu = _iommu;
     struct qi_ctrl *qi_ctrl = iommu_qi_ctrl(iommu);
 
     ASSERT(qi_ctrl->qinval_maddr);
@@ -354,7 +354,7 @@ static int __must_check flush_iotlb_qi(void *_iommu, u16 
did, u64 addr,
 {
     u8 dr = 0, dw = 0;
     int ret = 0, rc;
-    struct iommu *iommu = (struct iommu *)_iommu;
+    struct vtd_iommu *iommu = _iommu;
     struct qi_ctrl *qi_ctrl = iommu_qi_ctrl(iommu);
 
     ASSERT(qi_ctrl->qinval_maddr);
@@ -394,7 +394,7 @@ static int __must_check flush_iotlb_qi(void *_iommu, u16 
did, u64 addr,
     return ret;
 }
 
-int enable_qinval(struct iommu *iommu)
+int enable_qinval(struct vtd_iommu *iommu)
 {
     struct acpi_drhd_unit *drhd;
     struct qi_ctrl *qi_ctrl;
@@ -454,7 +454,7 @@ int enable_qinval(struct iommu *iommu)
     return 0;
 }
 
-void disable_qinval(struct iommu *iommu)
+void disable_qinval(struct vtd_iommu *iommu)
 {
     u32 sts;
     unsigned long flags;
diff --git a/xen/drivers/passthrough/vtd/quirks.c 
b/xen/drivers/passthrough/vtd/quirks.c
index d6db862..79209f3 100644
--- a/xen/drivers/passthrough/vtd/quirks.c
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -137,7 +137,7 @@ static void __init map_igd_reg(void)
 /*
  * force IGD to exit low power mode by accessing a IGD 3D regsiter.
  */
-static int cantiga_vtd_ops_preamble(struct iommu* iommu)
+static int cantiga_vtd_ops_preamble(struct vtd_iommu *iommu)
 {
     struct intel_iommu *intel = iommu->intel;
     struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL;
@@ -172,7 +172,7 @@ static int cantiga_vtd_ops_preamble(struct iommu* iommu)
  * parameter to a numerical value enables the quirk and
  * sets the timeout to that numerical number of msecs.
  */
-static void snb_vtd_ops_preamble(struct iommu* iommu)
+static void snb_vtd_ops_preamble(struct vtd_iommu *iommu)
 {
     struct intel_iommu *intel = iommu->intel;
     struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL;
@@ -202,7 +202,7 @@ static void snb_vtd_ops_preamble(struct iommu* iommu)
     *(volatile u32 *)(igd_reg_va + 0x2050) = 0x10001;
 }
 
-static void snb_vtd_ops_postamble(struct iommu* iommu)
+static void snb_vtd_ops_postamble(struct vtd_iommu *iommu)
 {
     struct intel_iommu *intel = iommu->intel;
     struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL;
@@ -221,7 +221,7 @@ static void snb_vtd_ops_postamble(struct iommu* iommu)
  * call before VT-d translation enable and IOTLB flush operations.
  */
 
-void vtd_ops_preamble_quirk(struct iommu* iommu)
+void vtd_ops_preamble_quirk(struct vtd_iommu *iommu)
 {
     cantiga_vtd_ops_preamble(iommu);
     if ( snb_igd_timeout != 0 )
@@ -236,7 +236,7 @@ void vtd_ops_preamble_quirk(struct iommu* iommu)
 /*
  * call after VT-d translation enable and IOTLB flush operations.
  */
-void vtd_ops_postamble_quirk(struct iommu* iommu)
+void vtd_ops_postamble_quirk(struct vtd_iommu *iommu)
 {
     if ( snb_igd_timeout != 0 )
     {
diff --git a/xen/drivers/passthrough/vtd/utils.c 
b/xen/drivers/passthrough/vtd/utils.c
index 94a6e4e..705e51b 100644
--- a/xen/drivers/passthrough/vtd/utils.c
+++ b/xen/drivers/passthrough/vtd/utils.c
@@ -29,7 +29,7 @@
 #include <asm/io_apic.h>
 
 /* Disable vt-d protected memory registers. */
-void disable_pmr(struct iommu *iommu)
+void disable_pmr(struct vtd_iommu *iommu)
 {
     u32 val;
     unsigned long flags;
@@ -51,7 +51,7 @@ void disable_pmr(struct iommu *iommu)
 
 void print_iommu_regs(struct acpi_drhd_unit *drhd)
 {
-    struct iommu *iommu = drhd->iommu;
+    struct vtd_iommu *iommu = drhd->iommu;
     u64 cap;
 
     printk("---- print_iommu_regs ----\n");
@@ -87,7 +87,7 @@ static u32 get_level_index(unsigned long gmfn, int level)
     return gmfn & LEVEL_MASK;
 }
 
-void print_vtd_entries(struct iommu *iommu, int bus, int devfn, u64 gmfn)
+void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn)
 {
     struct context_entry *ctxt_entry;
     struct root_entry *root_entry;
@@ -175,7 +175,7 @@ void print_vtd_entries(struct iommu *iommu, int bus, int 
devfn, u64 gmfn)
 void vtd_dump_iommu_info(unsigned char key)
 {
     struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
+    struct vtd_iommu *iommu;
     int i;
 
     for_each_drhd_unit ( drhd )
diff --git a/xen/drivers/passthrough/vtd/x86/ats.c 
b/xen/drivers/passthrough/vtd/x86/ats.c
index 1a3adb4..1a07607 100644
--- a/xen/drivers/passthrough/vtd/x86/ats.c
+++ b/xen/drivers/passthrough/vtd/x86/ats.c
@@ -30,7 +30,7 @@
 
 static LIST_HEAD(ats_dev_drhd_units);
 
-struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu)
+struct acpi_drhd_unit *find_ats_dev_drhd(struct vtd_iommu *iommu)
 {
     struct acpi_drhd_unit *drhd;
     list_for_each_entry ( drhd, &ats_dev_drhd_units, list )
@@ -71,7 +71,7 @@ int ats_device(const struct pci_dev *pdev, const struct 
acpi_drhd_unit *drhd)
     return pos;
 }
 
-static int device_in_domain(const struct iommu *iommu,
+static int device_in_domain(const struct vtd_iommu *iommu,
                             const struct pci_dev *pdev, u16 did)
 {
     struct root_entry *root_entry = NULL;
@@ -106,7 +106,7 @@ static int device_in_domain(const struct iommu *iommu,
     return found;
 }
 
-int dev_invalidate_iotlb(struct iommu *iommu, u16 did,
+int dev_invalidate_iotlb(struct vtd_iommu *iommu, u16 did,
     u64 addr, unsigned int size_order, u64 type)
 {
     struct pci_dev *pdev, *temp;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.