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

[Xen-changelog] [xen master] AMD IOMMU: use ioremap()



commit d7f913b8de206464f2a18e4c6d20886d32483de3
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Jul 15 14:21:45 2013 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Jul 15 14:21:45 2013 +0200

    AMD IOMMU: use ioremap()
    
    There's no point in using the fixmap here, and it gets
    map_iommu_mmio_region() in line with unmap_iommu_mmio_region(), which
    was already using iounmap() (thus crashing if actually used).
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
    Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
---
 xen/drivers/passthrough/amd/iommu_init.c     |   15 +++------------
 xen/include/asm-x86/fixmap.h                 |    2 --
 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h |    3 ---
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c 
b/xen/drivers/passthrough/amd/iommu_init.c
index ba86e1b..c19b51d 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -48,19 +48,10 @@ static int iommu_has_ht_flag(struct amd_iommu *iommu, u8 
mask)
 
 static int __init map_iommu_mmio_region(struct amd_iommu *iommu)
 {
-    unsigned long mfn;
-
-    if ( nr_amd_iommus > MAX_AMD_IOMMUS )
-    {
-        AMD_IOMMU_DEBUG("nr_amd_iommus %d > MAX_IOMMUS\n", nr_amd_iommus);
+    iommu->mmio_base = ioremap(iommu->mmio_base_phys,
+                               IOMMU_MMIO_REGION_LENGTH);
+    if ( !iommu->mmio_base )
         return -ENOMEM;
-    }
-
-    iommu->mmio_base = (void *)fix_to_virt(
-        FIX_IOMMU_MMIO_BASE_0 + nr_amd_iommus * MMIO_PAGES_PER_IOMMU);
-    mfn = (unsigned long)(iommu->mmio_base_phys >> PAGE_SHIFT);
-    map_pages_to_xen((unsigned long)iommu->mmio_base, mfn,
-                     MMIO_PAGES_PER_IOMMU, PAGE_HYPERVISOR_NOCACHE);
 
     memset(iommu->mmio_base, 0, IOMMU_MMIO_REGION_LENGTH);
 
diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
index 9ef3f98..029dc3e 100644
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
@@ -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_MMIO_BASE_0,
-    FIX_IOMMU_MMIO_END = FIX_IOMMU_MMIO_BASE_0 + IOMMU_PAGES -1,
     FIX_TBOOT_SHARED_BASE,
     FIX_MSIX_IO_RESERV_BASE,
     FIX_MSIX_IO_RESERV_END = FIX_MSIX_IO_RESERV_BASE + FIX_MSIX_MAX_PAGES -1,
diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h 
b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
index a88d982..ab842ef 100644
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
@@ -464,10 +464,7 @@
 #define IOMMU_CONTROL_DISABLED 0
 #define IOMMU_CONTROL_ENABLED  1
 
-#define MMIO_PAGES_PER_IOMMU        (IOMMU_MMIO_REGION_LENGTH / PAGE_SIZE_4K)
-#define IOMMU_PAGES                 (MMIO_PAGES_PER_IOMMU * MAX_AMD_IOMMUS)
 #define DEFAULT_DOMAIN_ADDRESS_WIDTH    48
-#define MAX_AMD_IOMMUS                  32
 
 /* interrupt remapping table */
 #define INT_REMAP_INDEX_DM_MASK         0x1C00
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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