aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-12-17 12:18:50 -0500
committerJoerg Roedel <joro@8bytes.org>2014-01-07 09:35:25 -0500
commite87c621dced122a9a0a51b56944b08421d273c8f (patch)
tree66df432b82d2d7306d846d2e734ce65a823b5ab6
parentdc89f797abdbfc58dfb28af944f80f0299a8fafa (diff)
iommu/shmobile: Turn the flush_lock mutex into a spinlock
The lock is taken in atomic context, replace it with a spinlock. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Joerg Roedel <joro@8bytes.org>
-rw-r--r--drivers/iommu/shmobile-ipmmu.c10
-rw-r--r--drivers/iommu/shmobile-ipmmu.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/iommu/shmobile-ipmmu.c b/drivers/iommu/shmobile-ipmmu.c
index 8321f89596c4..e3bc2e19b6dd 100644
--- a/drivers/iommu/shmobile-ipmmu.c
+++ b/drivers/iommu/shmobile-ipmmu.c
@@ -35,12 +35,12 @@ void ipmmu_tlb_flush(struct shmobile_ipmmu *ipmmu)
35 if (!ipmmu) 35 if (!ipmmu)
36 return; 36 return;
37 37
38 mutex_lock(&ipmmu->flush_lock); 38 spin_lock(&ipmmu->flush_lock);
39 if (ipmmu->tlb_enabled) 39 if (ipmmu->tlb_enabled)
40 ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH | IMCTR1_TLBEN); 40 ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH | IMCTR1_TLBEN);
41 else 41 else
42 ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH); 42 ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH);
43 mutex_unlock(&ipmmu->flush_lock); 43 spin_unlock(&ipmmu->flush_lock);
44} 44}
45 45
46void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size, 46void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size,
@@ -49,7 +49,7 @@ void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size,
49 if (!ipmmu) 49 if (!ipmmu)
50 return; 50 return;
51 51
52 mutex_lock(&ipmmu->flush_lock); 52 spin_lock(&ipmmu->flush_lock);
53 switch (size) { 53 switch (size) {
54 default: 54 default:
55 ipmmu->tlb_enabled = 0; 55 ipmmu->tlb_enabled = 0;
@@ -85,7 +85,7 @@ void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size,
85 } 85 }
86 ipmmu_reg_write(ipmmu, IMTTBR, phys); 86 ipmmu_reg_write(ipmmu, IMTTBR, phys);
87 ipmmu_reg_write(ipmmu, IMASID, asid); 87 ipmmu_reg_write(ipmmu, IMASID, asid);
88 mutex_unlock(&ipmmu->flush_lock); 88 spin_unlock(&ipmmu->flush_lock);
89} 89}
90 90
91static int ipmmu_probe(struct platform_device *pdev) 91static int ipmmu_probe(struct platform_device *pdev)
@@ -104,7 +104,7 @@ static int ipmmu_probe(struct platform_device *pdev)
104 dev_err(&pdev->dev, "cannot allocate device data\n"); 104 dev_err(&pdev->dev, "cannot allocate device data\n");
105 return -ENOMEM; 105 return -ENOMEM;
106 } 106 }
107 mutex_init(&ipmmu->flush_lock); 107 spin_lock_init(&ipmmu->flush_lock);
108 ipmmu->dev = &pdev->dev; 108 ipmmu->dev = &pdev->dev;
109 ipmmu->ipmmu_base = devm_ioremap_nocache(&pdev->dev, res->start, 109 ipmmu->ipmmu_base = devm_ioremap_nocache(&pdev->dev, res->start,
110 resource_size(res)); 110 resource_size(res));
diff --git a/drivers/iommu/shmobile-ipmmu.h b/drivers/iommu/shmobile-ipmmu.h
index 4d53684673e1..9524743ca1fb 100644
--- a/drivers/iommu/shmobile-ipmmu.h
+++ b/drivers/iommu/shmobile-ipmmu.h
@@ -14,7 +14,7 @@ struct shmobile_ipmmu {
14 struct device *dev; 14 struct device *dev;
15 void __iomem *ipmmu_base; 15 void __iomem *ipmmu_base;
16 int tlb_enabled; 16 int tlb_enabled;
17 struct mutex flush_lock; 17 spinlock_t flush_lock;
18 const char * const *dev_names; 18 const char * const *dev_names;
19 unsigned int num_dev_names; 19 unsigned int num_dev_names;
20}; 20};