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

[Xen-devel] Ping: [PATCH] IOMMU: remove vendor specific bits from generic code



- names of functions used independent of vendor should not have vendor
  specific names
- vendor specific declarations should not live inn generic headers
- other vendor specific items should not be used in generic code

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--
Note that this will only apply cleanly on top of "VT-d: drop bogus
checks", sent out a few minutes ago.

--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -776,7 +776,7 @@ long arch_do_domctl(
         if ( iommu_enabled )
         {
             spin_lock(&pcidevs_lock);
-            ret = pt_irq_create_bind_vtd(d, bind);
+            ret = pt_irq_create_bind(d, bind);
             spin_unlock(&pcidevs_lock);
         }
         if ( ret < 0 )
@@ -806,7 +806,7 @@ long arch_do_domctl(
         if ( iommu_enabled )
         {
             spin_lock(&pcidevs_lock);
-            ret = pt_irq_destroy_bind_vtd(d, bind);
+            ret = pt_irq_destroy_bind(d, bind);
             spin_unlock(&pcidevs_lock);
         }
         if ( ret < 0 )
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -95,7 +95,7 @@ void free_hvm_irq_dpci(struct hvm_irq_dp
     xfree(dpci);
 }
 
-int pt_irq_create_bind_vtd(
+int pt_irq_create_bind(
     struct domain *d, xen_domctl_bind_pt_irq_t *pt_irq_bind)
 {
     struct hvm_irq_dpci *hvm_irq_dpci = NULL;
@@ -277,14 +277,14 @@ int pt_irq_create_bind_vtd(
         spin_unlock(&d->event_lock);
 
         if ( iommu_verbose )
-            dprintk(VTDPREFIX,
+            dprintk(XENLOG_G_INFO,
                     "d%d: bind: m_gsi=%u g_gsi=%u device=%u intx=%u\n",
                     d->domain_id, pirq, guest_gsi, device, intx);
     }
     return 0;
 }
 
-int pt_irq_destroy_bind_vtd(
+int pt_irq_destroy_bind(
     struct domain *d, xen_domctl_bind_pt_irq_t *pt_irq_bind)
 {
     struct hvm_irq_dpci *hvm_irq_dpci = NULL;
@@ -302,7 +302,7 @@ int pt_irq_destroy_bind_vtd(
     link = hvm_pci_intx_link(device, intx);
 
     if ( iommu_verbose )
-        dprintk(VTDPREFIX,
+        dprintk(XENLOG_G_INFO,
                 "d%d: unbind: m_gsi=%u g_gsi=%u device=%u intx=%u\n",
                 d->domain_id, machine_gsi, guest_gsi, device, intx);
 
@@ -360,7 +360,7 @@ int pt_irq_destroy_bind_vtd(
     spin_unlock(&d->event_lock);
 
     if ( iommu_verbose )
-        dprintk(VTDPREFIX,
+        dprintk(XENLOG_G_INFO,
                 "d%d unmap: m_irq=%u device=%u intx=%u\n",
                 d->domain_id, machine_gsi, device, intx);
 
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -364,7 +364,7 @@ int deassign_device(struct domain *d, u1
 
     if ( pdev->domain != d )
     {
-        dprintk(XENLOG_ERR VTDPREFIX,
+        dprintk(XENLOG_G_ERR,
                 "d%d: deassign a device not owned\n", d->domain_id);
         return -EINVAL;
     }
@@ -372,8 +372,8 @@ int deassign_device(struct domain *d, u1
     ret = hd->platform_ops->reassign_device(d, dom0, seg, bus, devfn);
     if ( ret )
     {
-        dprintk(XENLOG_ERR VTDPREFIX,
-                "d%d: Deassign device (%04x:%02x:%02x.%u) failed!\n",
+        dprintk(XENLOG_G_ERR,
+                "d%d: deassign device (%04x:%02x:%02x.%u) failed\n",
                 d->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         return ret;
     }
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -24,6 +24,8 @@
 #include "dmar.h"
 #include <xen/keyhandler.h>
 
+#define VTDPREFIX "[VT-D]"
+
 extern bool_t rwbf_quirk;
 
 void print_iommu_regs(struct acpi_drhd_unit *drhd);
@@ -79,6 +81,15 @@ int domain_context_mapping_one(struct do
 int domain_context_unmap_one(struct domain *domain, struct iommu *iommu,
                              u8 bus, u8 devfn);
 
+unsigned int io_apic_read_remap_rte(unsigned int apic, unsigned int reg);
+void io_apic_write_remap_rte(unsigned int apic,
+                             unsigned int reg, unsigned int value);
+
+struct msi_desc;
+struct msi_msg;
+void msi_msg_read_remap_rte(struct msi_desc *, struct msi_msg *);
+void msi_msg_write_remap_rte(struct msi_desc *, struct msi_msg *);
+
 int is_igd_vt_enabled_quirk(void);
 void platform_quirks_init(void);
 void vtd_ops_preamble_quirk(struct iommu* iommu);
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -510,6 +510,22 @@ struct intel_iommu {
     struct acpi_drhd_unit *drhd;
 };
 
+struct iommu {
+    struct list_head list;
+    void __iomem *reg; /* Pointer to hardware regs, virtual addr */
+    u32        index;         /* Sequence number of iommu */
+    u32 nr_pt_levels;
+    u64        cap;
+    u64        ecap;
+    spinlock_t lock; /* protect context, domain ids */
+    spinlock_t register_lock; /* protect iommu register handling */
+    u64 root_maddr; /* root entry machine address */
+    int irq;
+    struct intel_iommu *intel;
+    unsigned long *domid_bitmap;  /* domain id bitmap */
+    u16 *domid_map;               /* domain id mapping array */
+};
+
 static inline struct qi_ctrl *iommu_qi_ctrl(struct iommu *iommu)
 {
     return iommu ? &iommu->intel->qi_ctrl : NULL;
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -48,22 +48,6 @@ extern struct rangeset *mmio_ro_ranges;
 #define PAGE_MASK_4K        (((u64)-1) << PAGE_SHIFT_4K)
 #define PAGE_ALIGN_4K(addr) (((addr) + PAGE_SIZE_4K - 1) & PAGE_MASK_4K)
 
-struct iommu {
-    struct list_head list;
-    void __iomem *reg; /* Pointer to hardware regs, virtual addr */
-    u32        index;         /* Sequence number of iommu */
-    u32 nr_pt_levels;
-    u64        cap;
-    u64        ecap;
-    spinlock_t lock; /* protect context, domain ids */
-    spinlock_t register_lock; /* protect iommu register handling */
-    u64 root_maddr; /* root entry machine address */
-    int irq;
-    struct intel_iommu *intel;
-    unsigned long *domid_bitmap;  /* domain id bitmap */
-    u16 *domid_map;               /* domain id mapping array */
-};
-
 int iommu_setup(void);
 int iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
@@ -94,25 +78,18 @@ void pt_pci_init(void);
 struct pirq;
 int hvm_do_IRQ_dpci(struct domain *, struct pirq *);
 int dpci_ioport_intercept(ioreq_t *p);
-int pt_irq_create_bind_vtd(struct domain *d,
-                           xen_domctl_bind_pt_irq_t *pt_irq_bind);
-int pt_irq_destroy_bind_vtd(struct domain *d,
-                            xen_domctl_bind_pt_irq_t *pt_irq_bind);
-unsigned int io_apic_read_remap_rte(unsigned int apic, unsigned int reg);
-void io_apic_write_remap_rte(unsigned int apic,
-                             unsigned int reg, unsigned int value);
+int pt_irq_create_bind(struct domain *, xen_domctl_bind_pt_irq_t *);
+int pt_irq_destroy_bind(struct domain *, xen_domctl_bind_pt_irq_t *);
 
-struct msi_desc;
-struct msi_msg;
-void msi_msg_read_remap_rte(struct msi_desc *msi_desc, struct msi_msg *msg);
-void msi_msg_write_remap_rte(struct msi_desc *msi_desc, struct msi_msg *msg);
 void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq);
 struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *);
 void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci);
 bool_t pt_irq_need_timer(uint32_t flags);
 
 #define PT_IRQ_TIME_OUT MILLISECS(8)
-#define VTDPREFIX "[VT-D]"
+
+struct msi_desc;
+struct msi_msg;
 
 struct iommu_ops {
     int (*init)(struct domain *d);


Attachment: IOMMU-generalize.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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