]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
VT-d: use ioremap()
authorJan Beulich <jbeulich@suse.com>
Mon, 15 Jul 2013 12:21:03 +0000 (14:21 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 15 Jul 2013 12:21:03 +0000 (14:21 +0200)
There's no point in using the fixmap here, and it gets iommu_alloc()
in line with iommu_free(), which was already using iounmap() (thus
crashing if actually used).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/drivers/passthrough/vtd/dmar.h
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/x86/vtd.c
xen/include/asm-x86/fixmap.h

index 6044681e9a67c4ddd50c7c50ef5ee37bccf646c1..a2b97d6851a8ef04b62e7fdfed1ad8b352a3271a 100644 (file)
@@ -127,8 +127,6 @@ do {                                                \
     }                                                           \
 } while (0)
 
-void *map_to_nocache_virt(int nr_iommus, u64 maddr);
-
 int vtd_hw_check(void);
 void disable_pmr(struct iommu *iommu);
 int is_usb_device(u16 seg, u8 bus, u8 devfn);
index 0fc10de15b30042d50a94cdf8981563f9ac607b5..76f7b8e98c2de11fafeb94fcaa34a1b351123a5e 100644 (file)
@@ -1142,15 +1142,16 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
         return -ENOMEM;
     }
     iommu->intel->drhd = drhd;
+    drhd->iommu = iommu;
 
-    iommu->reg = map_to_nocache_virt(nr_iommus, drhd->address);
+    iommu->reg = ioremap(drhd->address, PAGE_SIZE);
+    if ( !iommu->reg )
+        return -ENOMEM;
     iommu->index = nr_iommus++;
 
     iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG);
     iommu->ecap = dmar_readq(iommu->reg, DMAR_ECAP_REG);
 
-    drhd->iommu = iommu;
-
     if ( iommu_verbose )
     {
         dprintk(VTDPREFIX,
index 875b0338353e2a23e34b284a99435aa2e8ae5b9f..ca17cb12ca4c03c8beaf7eb4d70ccdcebce60f34 100644 (file)
@@ -64,12 +64,6 @@ void flush_all_cache()
     wbinvd();
 }
 
-void *__init map_to_nocache_virt(int nr_iommus, u64 maddr)
-{
-    set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, maddr);
-    return (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus);
-}
-
 static int _hvm_dpci_isairq_eoi(struct domain *d,
                                 struct hvm_pirq_dpci *pirq_dpci, void *arg)
 {
index d026d78c194174df326cdc2be6ab66a31890e74b..9ef3f980ddb4d2660ca484ae2212e61a056ac0e4 100644 (file)
@@ -60,8 +60,6 @@ enum fixed_addresses {
     FIX_KEXEC_BASE_0,
     FIX_KEXEC_BASE_END = FIX_KEXEC_BASE_0 \
       + ((KEXEC_XEN_NO_PAGES >> 1) * KEXEC_IMAGE_NR) - 1,
-    FIX_IOMMU_REGS_BASE_0,
-    FIX_IOMMU_REGS_END = FIX_IOMMU_REGS_BASE_0 + MAX_IOMMUS-1,
     FIX_IOMMU_MMIO_BASE_0,
     FIX_IOMMU_MMIO_END = FIX_IOMMU_MMIO_BASE_0 + IOMMU_PAGES -1,
     FIX_TBOOT_SHARED_BASE,