@@ -47,7 +47,6 @@ struct shmobile_iommu_domain {
atomic_t active;
};
-static struct dma_iommu_mapping *iommu_mapping;
static struct device *ipmmu_devices;
static struct dma_pool *l1pool, *l2pool;
static spinlock_t lock;
@@ -311,19 +310,22 @@ static struct iommu_ops shmobile_iommu_ops = {
static int shmobile_iommu_attach_all_devices(struct shmobile_ipmmu *ipmmu)
{
+ struct dma_iommu_mapping *mapping;
struct device *dev;
- iommu_mapping = arm_iommu_create_mapping(&platform_bus_type, 0x0,
- L1_LEN << 20, 0);
- if (IS_ERR_OR_NULL(iommu_mapping))
- return PTR_ERR(iommu_mapping);
+ mapping = arm_iommu_create_mapping(&platform_bus_type, 0,
+ L1_LEN << 20, 0);
+ if (IS_ERR(mapping))
+ return PTR_ERR(mapping);
+
+ ipmmu->iommu_mapping = mapping;
for (dev = ipmmu_devices; dev; ) {
struct shmobile_iommu_arch_data *data = dev->archdata.iommu;
data->ipmmu = ipmmu;
- if (arm_iommu_attach_device(dev, iommu_mapping))
+ if (arm_iommu_attach_device(dev, mapping))
pr_err("arm_iommu_attach_device failed\n");
dev = data->next;
@@ -1,11 +1,15 @@
#ifndef __SHMOBILE_IPMMU_H__
#define __SHMOBILE_IPMMU_H__
+struct dma_iommu_mapping;
+
struct shmobile_ipmmu {
struct device *dev;
void __iomem *ipmmu_base;
int tlb_enabled;
struct mutex flush_lock;
+
+ struct dma_iommu_mapping *iommu_mapping;
};
#ifdef CONFIG_SHMOBILE_IPMMU_TLB
And remove the global iommu_mapping variable. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- drivers/iommu/shmobile-iommu.c | 14 ++++++++------ drivers/iommu/shmobile-ipmmu.h | 4 ++++ 2 files changed, 12 insertions(+), 6 deletions(-)