From patchwork Tue Aug 5 10:47:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 34928 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f199.google.com (mail-ig0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 796612397D for ; Tue, 5 Aug 2014 10:50:20 +0000 (UTC) Received: by mail-ig0-f199.google.com with SMTP id l13sf3697779iga.10 for ; Tue, 05 Aug 2014 03:50:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=GUqK4LBGCknNoZCeu0GH7tmIKLHlIlOLWyPW9iVrbV0=; b=KFOPMtIsF+r6Jbep8AFeL1WmG/FmUBQXowh8709K4dp+7UQ645lOQotF54fwf9A+Tk KOFR2XpxOu4Mj2n9eNx/qqk4i39N+NkRFw/0p4jXap8P2jkj97kZeaWGg1pJyHe2Oqiw hmLvCSkx+SibxeoBhhhLH0EhhNX41EwLzfCS1E0gGE8kBPVDpKjWHjB0soOH8pJ+/Bl6 g8ghxDksYFHCoK5yraOEkqDppVvK2G4MQEiAEyh92otS2G9LYx+Sf0ttg8YSrwtHFta9 eAGriezEeLiveo2TaIr5ya3exoRzqmw/95Ygor93YRzbdin+RnSpvd2H88cCfB9IMuyN 64XQ== X-Gm-Message-State: ALoCoQnIKgD2phjeneE96UtYkp0gvzCvSGmrWoqqepsFLhUF04T73vUbvhI6OYEnw20/m4/SxcAq X-Received: by 10.50.43.168 with SMTP id x8mr11951367igl.4.1407235820056; Tue, 05 Aug 2014 03:50:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.35 with SMTP id k32ls216559qgd.73.gmail; Tue, 05 Aug 2014 03:50:20 -0700 (PDT) X-Received: by 10.52.8.71 with SMTP id p7mr425767vda.77.1407235819982; Tue, 05 Aug 2014 03:50:19 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id z4si790922vei.17.2014.08.05.03.50.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:50:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so1139548vcb.29 for ; Tue, 05 Aug 2014 03:50:19 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr2275899vca.45.1407235819889; Tue, 05 Aug 2014 03:50:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp374633vcb; Tue, 5 Aug 2014 03:50:19 -0700 (PDT) X-Received: by 10.224.43.77 with SMTP id v13mr4277558qae.34.1407235819353; Tue, 05 Aug 2014 03:50:19 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 61si2168666qgr.27.2014.08.05.03.50.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:50:19 -0700 (PDT) Received-SPF: none (google.com: linaro-mm-sig-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEcJt-0005Qa-Eu; Tue, 05 Aug 2014 10:50:17 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEcIk-0005FP-K7 for linaro-mm-sig@lists.linaro.org; Tue, 05 Aug 2014 10:49:06 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9T00BFUY1HV200@mailout4.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 05 Aug 2014 11:48:54 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-cf-53e0b69fc7a6 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 38.1C.25543.F96B0E35; Tue, 05 Aug 2014 11:49:03 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N9T0057MY17SE80@eusync3.samsung.com>; Tue, 05 Aug 2014 11:49:03 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Tue, 05 Aug 2014 12:47:45 +0200 Message-id: <1407235677-26324-18-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsVy+t/xq7rztz0INljSY2Txd9IxdovmxevZ LCbdn8BisWC/tUXn7A3sFr0LrrJZnG16w27ROXEJu8WXKw+ZLDY9vsZqcXnXHDaLGef3MVms PXKX3eLU9c9sFv96DzJanDl9idXi/54d7BaH37SzWhx5uJvdYtWuP4wWt3/zOYh6PDk4j8nj 969JjB47Z91l95jdMZPVY9OqTjaP/XPXsHtsXlLvcfvfY2aPyTeWM3pcOdHE6tHb/I7NY8vV dhaPvi2rGD0+b5IL4IvisklJzcksSy3St0vgyth7ZyJTwVuhip9rvrE2MB7k72Lk5JAQMJFY 1LWECcIWk7hwbz1bFyMXh5DAUkaJcw+Ws0A4fUwSn9cdAqtiEzCU6HrbBVYlItDLKNHf9IMJ xGEWWMcqsb/3OgtIlbBAlMTtfw1gHSwCqhIPZ+8Bs3kFPCV+nv7CDLFPTuL/yxVgcU6g+OGb B1hBbCEBD4mfG9awT2DkXcDIsIpRNLU0uaA4KT3XUK84Mbe4NC9dLzk/dxMjJHa+7GBcfMzq EKMAB6MSD6/B6bvBQqyJZcWVuYcYJTiYlUR4JdY8CBbiTUmsrEotyo8vKs1JLT7EyMTBKdXA 6LzgrnBT3XMh9YCuuPL+1gvcO9pPWltrm6hk/nm/OrCGcdpr6SXdU37KKykvFlaZ/02Gb4Ll q/2LC5Y8vpkeqHXS5s/xh0o2l2rauSLcn//6sjbQ9Ci3sZ+QjuzC1e9ygpcvEf3d3O9rHlzQ firu3aKs6bVTqmvnB1/Suj611FBqi4OWgiq3EktxRqKhFnNRcSIA+jJAZXsCAAA= Cc: Rob Herring , Thierry Reding , Shaik Ameer Basha , Arnd Bergmann , Inki Dae , Greg Kroah-Hartman , Joerg Roedel , "Rafael J. Wysocki" , Tomasz Figa , linaro-mm-sig@lists.linaro.org, Kyungmin Park , Kukjin Kim , Laurent Pinchart , Sylwester Nawrocki , Olof Johansson , Cho KyongHo Subject: [Linaro-mm-sig] [PATCH 17/29] iommu: exynos: don't read version register on every tlb operation X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-mm-sig-bounces@lists.linaro.org Sender: linaro-mm-sig-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This patch removes reading of REG_MMU_VERSION register on every tlb operation and caches SYSMMU version in driver's internal data. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 64b3bc8..8927923 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -213,6 +213,7 @@ struct sysmmu_drvdata { spinlock_t lock; struct iommu_domain *domain; phys_addr_t pgtable; + int version; }; static bool set_sysmmu_active(struct sysmmu_drvdata *data) @@ -239,11 +240,6 @@ static void sysmmu_unblock(void __iomem *sfrbase) __raw_writel(CTRL_ENABLE, sfrbase + REG_MMU_CTRL); } -static unsigned int __raw_sysmmu_version(struct sysmmu_drvdata *data) -{ - return MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION)); -} - static bool sysmmu_block(void __iomem *sfrbase) { int i = 120; @@ -403,7 +399,7 @@ static void __sysmmu_init_config(struct sysmmu_drvdata *data) unsigned int cfg = CFG_LRU | CFG_QOS(15); unsigned int ver; - ver = __raw_sysmmu_version(data); + ver = MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION)); if (MMU_MAJ_VER(ver) == 3) { if (MMU_MIN_VER(ver) >= 2) { cfg |= CFG_FLPDCACHE; @@ -417,6 +413,7 @@ static void __sysmmu_init_config(struct sysmmu_drvdata *data) } __raw_writel(cfg, data->sfrbase + REG_MMU_CFG); + data->version = ver; } static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data) @@ -526,7 +523,7 @@ static bool exynos_sysmmu_disable(struct device *dev) static void __sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data, sysmmu_iova_t iova) { - if (__raw_sysmmu_version(data) == MAKE_MMU_VER(3, 3)) + if (data->version == MAKE_MMU_VER(3, 3)) __raw_writel(iova | 0x1, data->sfrbase + REG_MMU_FLUSH_ENTRY); } @@ -575,7 +572,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, sysmmu_iova_t iova, * 1MB page can be cached in one of all sets. * 64KB page can be one of 16 consecutive sets. */ - if (MMU_MAJ_VER(__raw_sysmmu_version(data)) == 2) + if (MMU_MAJ_VER(data->version) == 2) num_inv = min_t(unsigned int, size / PAGE_SIZE, 64); if (sysmmu_block(data->sfrbase)) {