提交 e87c621d 编写于 作者: L Laurent Pinchart 提交者: Joerg Roedel

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: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: NJoerg Roedel <joro@8bytes.org>
上级 dc89f797
...@@ -35,12 +35,12 @@ void ipmmu_tlb_flush(struct shmobile_ipmmu *ipmmu) ...@@ -35,12 +35,12 @@ void ipmmu_tlb_flush(struct shmobile_ipmmu *ipmmu)
if (!ipmmu) if (!ipmmu)
return; return;
mutex_lock(&ipmmu->flush_lock); spin_lock(&ipmmu->flush_lock);
if (ipmmu->tlb_enabled) if (ipmmu->tlb_enabled)
ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH | IMCTR1_TLBEN); ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH | IMCTR1_TLBEN);
else else
ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH); ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH);
mutex_unlock(&ipmmu->flush_lock); spin_unlock(&ipmmu->flush_lock);
} }
void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size, void 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,7 +49,7 @@ void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size,
if (!ipmmu) if (!ipmmu)
return; return;
mutex_lock(&ipmmu->flush_lock); spin_lock(&ipmmu->flush_lock);
switch (size) { switch (size) {
default: default:
ipmmu->tlb_enabled = 0; ipmmu->tlb_enabled = 0;
...@@ -85,7 +85,7 @@ void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size, ...@@ -85,7 +85,7 @@ void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size,
} }
ipmmu_reg_write(ipmmu, IMTTBR, phys); ipmmu_reg_write(ipmmu, IMTTBR, phys);
ipmmu_reg_write(ipmmu, IMASID, asid); ipmmu_reg_write(ipmmu, IMASID, asid);
mutex_unlock(&ipmmu->flush_lock); spin_unlock(&ipmmu->flush_lock);
} }
static int ipmmu_probe(struct platform_device *pdev) static int ipmmu_probe(struct platform_device *pdev)
...@@ -104,7 +104,7 @@ static int ipmmu_probe(struct platform_device *pdev) ...@@ -104,7 +104,7 @@ static int ipmmu_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "cannot allocate device data\n"); dev_err(&pdev->dev, "cannot allocate device data\n");
return -ENOMEM; return -ENOMEM;
} }
mutex_init(&ipmmu->flush_lock); spin_lock_init(&ipmmu->flush_lock);
ipmmu->dev = &pdev->dev; ipmmu->dev = &pdev->dev;
ipmmu->ipmmu_base = devm_ioremap_nocache(&pdev->dev, res->start, ipmmu->ipmmu_base = devm_ioremap_nocache(&pdev->dev, res->start,
resource_size(res)); resource_size(res));
......
...@@ -14,7 +14,7 @@ struct shmobile_ipmmu { ...@@ -14,7 +14,7 @@ struct shmobile_ipmmu {
struct device *dev; struct device *dev;
void __iomem *ipmmu_base; void __iomem *ipmmu_base;
int tlb_enabled; int tlb_enabled;
struct mutex flush_lock; spinlock_t flush_lock;
const char * const *dev_names; const char * const *dev_names;
unsigned int num_dev_names; unsigned int num_dev_names;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册