From patchwork Fri Jul 5 12:29:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 2824149 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8633D9F7D6 for ; Fri, 5 Jul 2013 12:30:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8226520125 for ; Fri, 5 Jul 2013 12:30:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 642DD20121 for ; Fri, 5 Jul 2013 12:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964902Ab3GEM3b (ORCPT ); Fri, 5 Jul 2013 08:29:31 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:36100 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964883Ab3GEM31 (ORCPT ); Fri, 5 Jul 2013 08:29:27 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MPG00J62QNZFSG0@mailout4.samsung.com>; Fri, 05 Jul 2013 21:29:26 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.49]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id A0.93.08825.62CB6D15; Fri, 05 Jul 2013 21:29:26 +0900 (KST) X-AuditID: cbfee68e-b7f276d000002279-a1-51d6bc267ac9 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id DE.B5.21068.62CB6D15; Fri, 05 Jul 2013 21:29:26 +0900 (KST) Received: from DOPULLIPCHO07 ([12.23.118.94]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MPG00MJ1QP2AQ40@mmp2.samsung.com>; Fri, 05 Jul 2013 21:29:26 +0900 (KST) From: Cho KyongHo To: 'Linux ARM Kernel' , 'Linux IOMMU' , 'Linux Kernel' , 'Linux Samsung SOC' Cc: 'Hyunwoong Kim' , 'Joerg Roedel' , 'Kukjin Kim' , 'Prathyush' , 'Rahul Sharma' , 'Subash Patel' , 'Keyyoung Park' , 'Grant Grundler' Subject: [PATCH v7 5/9] iommu/exynos: change rwlock to spinlock Date: Fri, 05 Jul 2013 21:29:26 +0900 Message-id: <002d01ce797b$49c441a0$dd4cc4e0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac55d7SaVQM9RTz9RVCjnECx0AGuYg== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLIsWRmVeSWpSXmKPExsVy+t8zQ121PdcCDbZu17F4deQHk8WC/dYW nbM3sFtsPriOxaJ3wVU2i8Z7E9gsNj2+xmpxedccNosZ5/cxWVxYsZHdYsqiw6wWLdd7mRx4 PJ4cnMfkMbvhIovHnWt72Dw2L6n3mHxjOaNH35ZVjB6fN8kFsEdx2aSk5mSWpRbp2yVwZdz+ +oq5YIdqRderN0wNjMvluxg5OSQETCQ+Nh5hhbDFJC7cW8/WxcjFISSwjFGi7f5HFpiiS/M6 2CES0xkllrTeYYVw/jJKHHg4jR2kik1AS2L13OOMILaIwF1GiZfneUCKmAVuMEls+NQGNkpY wF5i0bldTCA2i4CqxMWPLWBxXgFLiS3nOtggbEGJH5PvgcWZgYau33mcCcKWl9i85i0zxEkK EjvOvoZapicxYeIhqBoRiX0v3jGCLJYQ+Msu8W/pTWaIZQI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rwpiZVVqUX58UWlOanFhxiTgT6dyCwlmpwPTGd5JfGGxiZmRpZGZhZGJubmpAkr ifMebLUOFBJITyxJzU5NLUgtgtnCxMEp1cAoI6VoM/lDo2WgXKD7LiGnnHlXeAqn/M94+O7U Jatnvx7L6nh8t3mjqHhRew/nR82us84s6i/ZLPUma2umrmNqzvmnKONvp5E3TbhYYoLgfMeD TG/3BezgtEjpt558QF5BW8w6oWmx7h0+IX32ohRWtg063x8u7SztrP5rETLP+HxA6os9y5VY ijMSDbWYi4oTARCRpmJdAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since acquiring read_lock is not more frequent than write_lock, it is not beneficial to use rwlock, this commit changes rwlock to spinlock. Signed-off-by: Cho KyongHo --- drivers/iommu/exynos-iommu.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 390f8b7..6793661 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -175,7 +175,7 @@ struct sysmmu_drvdata { void __iomem **sfrbases; struct clk *clk[2]; int activations; - rwlock_t lock; + spinlock_t lock; struct iommu_domain *domain; sysmmu_fault_handler_t fault_handler; unsigned long pgtable; @@ -259,7 +259,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, BUG_ON((base0 + size0) <= base0); BUG_ON((size1 > 0) && ((base1 + size1) <= base1)); - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (!is_sysmmu_active(data)) goto finish; @@ -289,7 +289,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, } } finish: - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } static void __set_fault_handler(struct sysmmu_drvdata *data, @@ -297,9 +297,9 @@ static void __set_fault_handler(struct sysmmu_drvdata *data, { unsigned long flags; - write_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); data->fault_handler = handler; - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } void exynos_sysmmu_set_fault_handler(struct device *dev, @@ -347,7 +347,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) int i, ret = -ENOSYS; - read_lock(&data->lock); + spin_lock(&data->lock); WARN_ON(!is_sysmmu_active(data)); @@ -391,7 +391,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) if (itype != SYSMMU_FAULT_UNKNOWN) sysmmu_unblock(data->sfrbases[i]); - read_unlock(&data->lock); + spin_unlock(&data->lock); return IRQ_HANDLED; } @@ -402,7 +402,7 @@ static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data) bool disabled = false; int i; - write_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (!set_sysmmu_inactive(data)) goto finish; @@ -419,7 +419,7 @@ static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data) data->pgtable = 0; data->domain = NULL; finish: - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); if (disabled) dev_dbg(data->sysmmu, "(%s) Disabled\n", data->dbgname); @@ -442,7 +442,7 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, int i, ret = 0; unsigned long flags; - write_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (!set_sysmmu_active(data)) { if (WARN_ON(pgtable != data->pgtable)) { @@ -481,7 +481,7 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, dev_dbg(data->sysmmu, "(%s) Enabled\n", data->dbgname); finish: - write_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); return ret; } @@ -528,7 +528,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) unsigned long flags; struct sysmmu_drvdata *data = dev_get_drvdata(dev->archdata.iommu); - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (is_sysmmu_active(data)) { int i; @@ -545,7 +545,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) data->dbgname); } - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } void exynos_sysmmu_tlb_invalidate(struct device *dev) @@ -553,7 +553,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) unsigned long flags; struct sysmmu_drvdata *data = dev_get_drvdata(dev->archdata.iommu); - read_lock_irqsave(&data->lock, flags); + spin_lock_irqsave(&data->lock, flags); if (is_sysmmu_active(data)) { int i; @@ -569,7 +569,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) data->dbgname); } - read_unlock_irqrestore(&data->lock, flags); + spin_unlock_irqrestore(&data->lock, flags); } static int exynos_sysmmu_probe(struct platform_device *pdev) @@ -666,7 +666,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) } data->sysmmu = dev; - rwlock_init(&data->lock); + spin_lock_init(&data->lock); INIT_LIST_HEAD(&data->node); __set_fault_handler(data, &default_fault_handler);