diff options
author | Cho KyongHo <pullip.cho@samsung.com> | 2014-05-12 02:14:57 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2014-05-13 13:12:55 -0400 |
commit | 9d4e7a24d77a05fb5c4e4121051a8d80501c74d3 (patch) | |
tree | 73cefb21d4adc5b22747a19aafb86813889f3e4c /drivers/iommu/exynos-iommu.c | |
parent | 1fab7fa7230fa0422ca81cea7d1bfbf3f9b0d3f9 (diff) |
iommu/exynos: Change rwlock to spinlock
Since acquiring read_lock is not more frequent than write_lock, it is
not beneficial to use rwlock, this commit changes rwlock to spinlock.
Reviewed-by: Grant Grundler <grundler@chromium.org>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
Signed-off-by: Shaik Ameer Basha <shaik.ameer@samsung.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/exynos-iommu.c')
-rw-r--r-- | drivers/iommu/exynos-iommu.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index c1be65fd0af5..d89ad5f8747c 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c | |||
@@ -164,7 +164,7 @@ struct sysmmu_drvdata { | |||
164 | struct clk *clk; | 164 | struct clk *clk; |
165 | struct clk *clk_master; | 165 | struct clk *clk_master; |
166 | int activations; | 166 | int activations; |
167 | rwlock_t lock; | 167 | spinlock_t lock; |
168 | struct iommu_domain *domain; | 168 | struct iommu_domain *domain; |
169 | phys_addr_t pgtable; | 169 | phys_addr_t pgtable; |
170 | }; | 170 | }; |
@@ -263,12 +263,13 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) | |||
263 | unsigned long addr = -1; | 263 | unsigned long addr = -1; |
264 | int ret = -ENOSYS; | 264 | int ret = -ENOSYS; |
265 | 265 | ||
266 | read_lock(&data->lock); | ||
267 | |||
268 | WARN_ON(!is_sysmmu_active(data)); | 266 | WARN_ON(!is_sysmmu_active(data)); |
269 | 267 | ||
268 | spin_lock(&data->lock); | ||
269 | |||
270 | if (!IS_ERR(data->clk_master)) | 270 | if (!IS_ERR(data->clk_master)) |
271 | clk_enable(data->clk_master); | 271 | clk_enable(data->clk_master); |
272 | |||
272 | itype = (enum exynos_sysmmu_inttype) | 273 | itype = (enum exynos_sysmmu_inttype) |
273 | __ffs(__raw_readl(data->sfrbase + REG_INT_STATUS)); | 274 | __ffs(__raw_readl(data->sfrbase + REG_INT_STATUS)); |
274 | if (WARN_ON(!((itype >= 0) && (itype < SYSMMU_FAULT_UNKNOWN)))) | 275 | if (WARN_ON(!((itype >= 0) && (itype < SYSMMU_FAULT_UNKNOWN)))) |
@@ -302,7 +303,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) | |||
302 | if (!IS_ERR(data->clk_master)) | 303 | if (!IS_ERR(data->clk_master)) |
303 | clk_disable(data->clk_master); | 304 | clk_disable(data->clk_master); |
304 | 305 | ||
305 | read_unlock(&data->lock); | 306 | spin_unlock(&data->lock); |
306 | 307 | ||
307 | return IRQ_HANDLED; | 308 | return IRQ_HANDLED; |
308 | } | 309 | } |
@@ -312,7 +313,7 @@ static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data) | |||
312 | unsigned long flags; | 313 | unsigned long flags; |
313 | bool disabled = false; | 314 | bool disabled = false; |
314 | 315 | ||
315 | write_lock_irqsave(&data->lock, flags); | 316 | spin_lock_irqsave(&data->lock, flags); |
316 | 317 | ||
317 | if (!set_sysmmu_inactive(data)) | 318 | if (!set_sysmmu_inactive(data)) |
318 | goto finish; | 319 | goto finish; |
@@ -330,7 +331,7 @@ static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data) | |||
330 | data->pgtable = 0; | 331 | data->pgtable = 0; |
331 | data->domain = NULL; | 332 | data->domain = NULL; |
332 | finish: | 333 | finish: |
333 | write_unlock_irqrestore(&data->lock, flags); | 334 | spin_unlock_irqrestore(&data->lock, flags); |
334 | 335 | ||
335 | if (disabled) | 336 | if (disabled) |
336 | dev_dbg(data->sysmmu, "Disabled\n"); | 337 | dev_dbg(data->sysmmu, "Disabled\n"); |
@@ -353,7 +354,7 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, | |||
353 | int ret = 0; | 354 | int ret = 0; |
354 | unsigned long flags; | 355 | unsigned long flags; |
355 | 356 | ||
356 | write_lock_irqsave(&data->lock, flags); | 357 | spin_lock_irqsave(&data->lock, flags); |
357 | 358 | ||
358 | if (!set_sysmmu_active(data)) { | 359 | if (!set_sysmmu_active(data)) { |
359 | if (WARN_ON(pgtable != data->pgtable)) { | 360 | if (WARN_ON(pgtable != data->pgtable)) { |
@@ -384,7 +385,7 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, | |||
384 | 385 | ||
385 | dev_dbg(data->sysmmu, "Enabled\n"); | 386 | dev_dbg(data->sysmmu, "Enabled\n"); |
386 | finish: | 387 | finish: |
387 | write_unlock_irqrestore(&data->lock, flags); | 388 | spin_unlock_irqrestore(&data->lock, flags); |
388 | 389 | ||
389 | return ret; | 390 | return ret; |
390 | } | 391 | } |
@@ -431,7 +432,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova, | |||
431 | unsigned long flags; | 432 | unsigned long flags; |
432 | struct sysmmu_drvdata *data = dev_get_drvdata(dev->archdata.iommu); | 433 | struct sysmmu_drvdata *data = dev_get_drvdata(dev->archdata.iommu); |
433 | 434 | ||
434 | read_lock_irqsave(&data->lock, flags); | 435 | spin_lock_irqsave(&data->lock, flags); |
435 | 436 | ||
436 | if (is_sysmmu_active(data)) { | 437 | if (is_sysmmu_active(data)) { |
437 | unsigned int maj; | 438 | unsigned int maj; |
@@ -465,7 +466,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova, | |||
465 | dev_dbg(data->sysmmu, "Disabled. Skipping invalidating TLB.\n"); | 466 | dev_dbg(data->sysmmu, "Disabled. Skipping invalidating TLB.\n"); |
466 | } | 467 | } |
467 | 468 | ||
468 | read_unlock_irqrestore(&data->lock, flags); | 469 | spin_unlock_irqrestore(&data->lock, flags); |
469 | } | 470 | } |
470 | 471 | ||
471 | void exynos_sysmmu_tlb_invalidate(struct device *dev) | 472 | void exynos_sysmmu_tlb_invalidate(struct device *dev) |
@@ -473,7 +474,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) | |||
473 | unsigned long flags; | 474 | unsigned long flags; |
474 | struct sysmmu_drvdata *data = dev_get_drvdata(dev->archdata.iommu); | 475 | struct sysmmu_drvdata *data = dev_get_drvdata(dev->archdata.iommu); |
475 | 476 | ||
476 | read_lock_irqsave(&data->lock, flags); | 477 | spin_lock_irqsave(&data->lock, flags); |
477 | 478 | ||
478 | if (is_sysmmu_active(data)) { | 479 | if (is_sysmmu_active(data)) { |
479 | if (!IS_ERR(data->clk_master)) | 480 | if (!IS_ERR(data->clk_master)) |
@@ -488,7 +489,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) | |||
488 | dev_dbg(data->sysmmu, "Disabled. Skipping invalidating TLB.\n"); | 489 | dev_dbg(data->sysmmu, "Disabled. Skipping invalidating TLB.\n"); |
489 | } | 490 | } |
490 | 491 | ||
491 | read_unlock_irqrestore(&data->lock, flags); | 492 | spin_unlock_irqrestore(&data->lock, flags); |
492 | } | 493 | } |
493 | 494 | ||
494 | static int exynos_sysmmu_probe(struct platform_device *pdev) | 495 | static int exynos_sysmmu_probe(struct platform_device *pdev) |
@@ -543,7 +544,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) | |||
543 | } | 544 | } |
544 | 545 | ||
545 | data->sysmmu = dev; | 546 | data->sysmmu = dev; |
546 | rwlock_init(&data->lock); | 547 | spin_lock_init(&data->lock); |
547 | INIT_LIST_HEAD(&data->node); | 548 | INIT_LIST_HEAD(&data->node); |
548 | 549 | ||
549 | platform_set_drvdata(pdev, data); | 550 | platform_set_drvdata(pdev, data); |