aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2015-10-09 18:16:46 -0400
committerJoerg Roedel <jroedel@suse.de>2015-10-14 09:22:06 -0400
commitdfddb969edf021f21a45fc6fd019db4f99d12308 (patch)
tree046c3ec32119e8cd2beda7271508a5c1b2495fcf /drivers/iommu
parentb1ce5b79aec8d8cd8bcd076d8cce8bc3cd690051 (diff)
iommu/vt-d: Switch from ioremap_cache to memremap
In preparation for deprecating ioremap_cache() convert its usage in intel-iommu to memremap. This also eliminates the mishandling of the __iomem annotation in the implementation. Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/intel-iommu.c20
-rw-r--r--drivers/iommu/intel_irq_remapping.c8
2 files changed, 15 insertions, 13 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 6ac6e741c46e..c5426e847255 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -34,6 +34,7 @@
34#include <linux/mempool.h> 34#include <linux/mempool.h>
35#include <linux/memory.h> 35#include <linux/memory.h>
36#include <linux/timer.h> 36#include <linux/timer.h>
37#include <linux/io.h>
37#include <linux/iova.h> 38#include <linux/iova.h>
38#include <linux/iommu.h> 39#include <linux/iommu.h>
39#include <linux/intel-iommu.h> 40#include <linux/intel-iommu.h>
@@ -2809,18 +2810,18 @@ static void intel_iommu_init_qi(struct intel_iommu *iommu)
2809} 2810}
2810 2811
2811static int copy_context_table(struct intel_iommu *iommu, 2812static int copy_context_table(struct intel_iommu *iommu,
2812 struct root_entry __iomem *old_re, 2813 struct root_entry *old_re,
2813 struct context_entry **tbl, 2814 struct context_entry **tbl,
2814 int bus, bool ext) 2815 int bus, bool ext)
2815{ 2816{
2816 int tbl_idx, pos = 0, idx, devfn, ret = 0, did; 2817 int tbl_idx, pos = 0, idx, devfn, ret = 0, did;
2817 struct context_entry __iomem *old_ce = NULL;
2818 struct context_entry *new_ce = NULL, ce; 2818 struct context_entry *new_ce = NULL, ce;
2819 struct context_entry *old_ce = NULL;
2819 struct root_entry re; 2820 struct root_entry re;
2820 phys_addr_t old_ce_phys; 2821 phys_addr_t old_ce_phys;
2821 2822
2822 tbl_idx = ext ? bus * 2 : bus; 2823 tbl_idx = ext ? bus * 2 : bus;
2823 memcpy_fromio(&re, old_re, sizeof(re)); 2824 memcpy(&re, old_re, sizeof(re));
2824 2825
2825 for (devfn = 0; devfn < 256; devfn++) { 2826 for (devfn = 0; devfn < 256; devfn++) {
2826 /* First calculate the correct index */ 2827 /* First calculate the correct index */
@@ -2855,7 +2856,8 @@ static int copy_context_table(struct intel_iommu *iommu,
2855 } 2856 }
2856 2857
2857 ret = -ENOMEM; 2858 ret = -ENOMEM;
2858 old_ce = ioremap_cache(old_ce_phys, PAGE_SIZE); 2859 old_ce = memremap(old_ce_phys, PAGE_SIZE,
2860 MEMREMAP_WB);
2859 if (!old_ce) 2861 if (!old_ce)
2860 goto out; 2862 goto out;
2861 2863
@@ -2867,7 +2869,7 @@ static int copy_context_table(struct intel_iommu *iommu,
2867 } 2869 }
2868 2870
2869 /* Now copy the context entry */ 2871 /* Now copy the context entry */
2870 memcpy_fromio(&ce, old_ce + idx, sizeof(ce)); 2872 memcpy(&ce, old_ce + idx, sizeof(ce));
2871 2873
2872 if (!__context_present(&ce)) 2874 if (!__context_present(&ce))
2873 continue; 2875 continue;
@@ -2903,7 +2905,7 @@ static int copy_context_table(struct intel_iommu *iommu,
2903 __iommu_flush_cache(iommu, new_ce, VTD_PAGE_SIZE); 2905 __iommu_flush_cache(iommu, new_ce, VTD_PAGE_SIZE);
2904 2906
2905out_unmap: 2907out_unmap:
2906 iounmap(old_ce); 2908 memunmap(old_ce);
2907 2909
2908out: 2910out:
2909 return ret; 2911 return ret;
@@ -2911,8 +2913,8 @@ out:
2911 2913
2912static int copy_translation_tables(struct intel_iommu *iommu) 2914static int copy_translation_tables(struct intel_iommu *iommu)
2913{ 2915{
2914 struct root_entry __iomem *old_rt;
2915 struct context_entry **ctxt_tbls; 2916 struct context_entry **ctxt_tbls;
2917 struct root_entry *old_rt;
2916 phys_addr_t old_rt_phys; 2918 phys_addr_t old_rt_phys;
2917 int ctxt_table_entries; 2919 int ctxt_table_entries;
2918 unsigned long flags; 2920 unsigned long flags;
@@ -2937,7 +2939,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
2937 if (!old_rt_phys) 2939 if (!old_rt_phys)
2938 return -EINVAL; 2940 return -EINVAL;
2939 2941
2940 old_rt = ioremap_cache(old_rt_phys, PAGE_SIZE); 2942 old_rt = memremap(old_rt_phys, PAGE_SIZE, MEMREMAP_WB);
2941 if (!old_rt) 2943 if (!old_rt)
2942 return -ENOMEM; 2944 return -ENOMEM;
2943 2945
@@ -2986,7 +2988,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
2986 ret = 0; 2988 ret = 0;
2987 2989
2988out_unmap: 2990out_unmap:
2989 iounmap(old_rt); 2991 memunmap(old_rt);
2990 2992
2991 return ret; 2993 return ret;
2992} 2994}
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 9ec4e0d94ffd..bdc52cc6ed23 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -384,7 +384,7 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev)
384 384
385static int iommu_load_old_irte(struct intel_iommu *iommu) 385static int iommu_load_old_irte(struct intel_iommu *iommu)
386{ 386{
387 struct irte __iomem *old_ir_table; 387 struct irte *old_ir_table;
388 phys_addr_t irt_phys; 388 phys_addr_t irt_phys;
389 unsigned int i; 389 unsigned int i;
390 size_t size; 390 size_t size;
@@ -408,12 +408,12 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
408 size = INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte); 408 size = INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte);
409 409
410 /* Map the old IR table */ 410 /* Map the old IR table */
411 old_ir_table = ioremap_cache(irt_phys, size); 411 old_ir_table = memremap(irt_phys, size, MEMREMAP_WB);
412 if (!old_ir_table) 412 if (!old_ir_table)
413 return -ENOMEM; 413 return -ENOMEM;
414 414
415 /* Copy data over */ 415 /* Copy data over */
416 memcpy_fromio(iommu->ir_table->base, old_ir_table, size); 416 memcpy(iommu->ir_table->base, old_ir_table, size);
417 417
418 __iommu_flush_cache(iommu, iommu->ir_table->base, size); 418 __iommu_flush_cache(iommu, iommu->ir_table->base, size);
419 419
@@ -426,7 +426,7 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
426 bitmap_set(iommu->ir_table->bitmap, i, 1); 426 bitmap_set(iommu->ir_table->bitmap, i, 1);
427 } 427 }
428 428
429 iounmap(old_ir_table); 429 memunmap(old_ir_table);
430 430
431 return 0; 431 return 0;
432} 432}