Commit dfddb969 authored by Dan Williams's avatar Dan Williams Committed by Joerg Roedel

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: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent b1ce5b79
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/mempool.h> #include <linux/mempool.h>
#include <linux/memory.h> #include <linux/memory.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/io.h>
#include <linux/iova.h> #include <linux/iova.h>
#include <linux/iommu.h> #include <linux/iommu.h>
#include <linux/intel-iommu.h> #include <linux/intel-iommu.h>
...@@ -2809,18 +2810,18 @@ static void intel_iommu_init_qi(struct intel_iommu *iommu) ...@@ -2809,18 +2810,18 @@ static void intel_iommu_init_qi(struct intel_iommu *iommu)
} }
static int copy_context_table(struct intel_iommu *iommu, static int copy_context_table(struct intel_iommu *iommu,
struct root_entry __iomem *old_re, struct root_entry *old_re,
struct context_entry **tbl, struct context_entry **tbl,
int bus, bool ext) int bus, bool ext)
{ {
int tbl_idx, pos = 0, idx, devfn, ret = 0, did; int tbl_idx, pos = 0, idx, devfn, ret = 0, did;
struct context_entry __iomem *old_ce = NULL;
struct context_entry *new_ce = NULL, ce; struct context_entry *new_ce = NULL, ce;
struct context_entry *old_ce = NULL;
struct root_entry re; struct root_entry re;
phys_addr_t old_ce_phys; phys_addr_t old_ce_phys;
tbl_idx = ext ? bus * 2 : bus; tbl_idx = ext ? bus * 2 : bus;
memcpy_fromio(&re, old_re, sizeof(re)); memcpy(&re, old_re, sizeof(re));
for (devfn = 0; devfn < 256; devfn++) { for (devfn = 0; devfn < 256; devfn++) {
/* First calculate the correct index */ /* First calculate the correct index */
...@@ -2855,7 +2856,8 @@ static int copy_context_table(struct intel_iommu *iommu, ...@@ -2855,7 +2856,8 @@ static int copy_context_table(struct intel_iommu *iommu,
} }
ret = -ENOMEM; ret = -ENOMEM;
old_ce = ioremap_cache(old_ce_phys, PAGE_SIZE); old_ce = memremap(old_ce_phys, PAGE_SIZE,
MEMREMAP_WB);
if (!old_ce) if (!old_ce)
goto out; goto out;
...@@ -2867,7 +2869,7 @@ static int copy_context_table(struct intel_iommu *iommu, ...@@ -2867,7 +2869,7 @@ static int copy_context_table(struct intel_iommu *iommu,
} }
/* Now copy the context entry */ /* Now copy the context entry */
memcpy_fromio(&ce, old_ce + idx, sizeof(ce)); memcpy(&ce, old_ce + idx, sizeof(ce));
if (!__context_present(&ce)) if (!__context_present(&ce))
continue; continue;
...@@ -2903,7 +2905,7 @@ static int copy_context_table(struct intel_iommu *iommu, ...@@ -2903,7 +2905,7 @@ static int copy_context_table(struct intel_iommu *iommu,
__iommu_flush_cache(iommu, new_ce, VTD_PAGE_SIZE); __iommu_flush_cache(iommu, new_ce, VTD_PAGE_SIZE);
out_unmap: out_unmap:
iounmap(old_ce); memunmap(old_ce);
out: out:
return ret; return ret;
...@@ -2911,8 +2913,8 @@ static int copy_context_table(struct intel_iommu *iommu, ...@@ -2911,8 +2913,8 @@ static int copy_context_table(struct intel_iommu *iommu,
static int copy_translation_tables(struct intel_iommu *iommu) static int copy_translation_tables(struct intel_iommu *iommu)
{ {
struct root_entry __iomem *old_rt;
struct context_entry **ctxt_tbls; struct context_entry **ctxt_tbls;
struct root_entry *old_rt;
phys_addr_t old_rt_phys; phys_addr_t old_rt_phys;
int ctxt_table_entries; int ctxt_table_entries;
unsigned long flags; unsigned long flags;
...@@ -2937,7 +2939,7 @@ static int copy_translation_tables(struct intel_iommu *iommu) ...@@ -2937,7 +2939,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
if (!old_rt_phys) if (!old_rt_phys)
return -EINVAL; return -EINVAL;
old_rt = ioremap_cache(old_rt_phys, PAGE_SIZE); old_rt = memremap(old_rt_phys, PAGE_SIZE, MEMREMAP_WB);
if (!old_rt) if (!old_rt)
return -ENOMEM; return -ENOMEM;
...@@ -2986,7 +2988,7 @@ static int copy_translation_tables(struct intel_iommu *iommu) ...@@ -2986,7 +2988,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
ret = 0; ret = 0;
out_unmap: out_unmap:
iounmap(old_rt); memunmap(old_rt);
return ret; return ret;
} }
......
...@@ -384,7 +384,7 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev) ...@@ -384,7 +384,7 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev)
static int iommu_load_old_irte(struct intel_iommu *iommu) static int iommu_load_old_irte(struct intel_iommu *iommu)
{ {
struct irte __iomem *old_ir_table; struct irte *old_ir_table;
phys_addr_t irt_phys; phys_addr_t irt_phys;
unsigned int i; unsigned int i;
size_t size; size_t size;
...@@ -408,12 +408,12 @@ static int iommu_load_old_irte(struct intel_iommu *iommu) ...@@ -408,12 +408,12 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
size = INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte); size = INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte);
/* Map the old IR table */ /* Map the old IR table */
old_ir_table = ioremap_cache(irt_phys, size); old_ir_table = memremap(irt_phys, size, MEMREMAP_WB);
if (!old_ir_table) if (!old_ir_table)
return -ENOMEM; return -ENOMEM;
/* Copy data over */ /* Copy data over */
memcpy_fromio(iommu->ir_table->base, old_ir_table, size); memcpy(iommu->ir_table->base, old_ir_table, size);
__iommu_flush_cache(iommu, iommu->ir_table->base, size); __iommu_flush_cache(iommu, iommu->ir_table->base, size);
...@@ -426,7 +426,7 @@ static int iommu_load_old_irte(struct intel_iommu *iommu) ...@@ -426,7 +426,7 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
bitmap_set(iommu->ir_table->bitmap, i, 1); bitmap_set(iommu->ir_table->bitmap, i, 1);
} }
iounmap(old_ir_table); memunmap(old_ir_table);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment