From patchwork Wed Nov 19 11:15:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 41134 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6ACEF20CBB for ; Wed, 19 Nov 2014 11:16:38 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf251217lab.8 for ; Wed, 19 Nov 2014 03:16:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=/jinzvTePLJCEoeZ9neD2ScFKfwxgckL5tI/dcYbzKg=; b=RF17QClxmmtFk6Zmly200iuL9ZbsUtvaRrXKFq0lVSotCoMyEDEHAzjvsINCLt0i8n so3wxm3K8IKZhNIKeHGpI8zefct1PUqLR5bc8KX+wNjwlUm894NhM6udaF/SYAmVi/q8 mhi2+5IX61TAwxgoC+h0UtTxEG+Sh47GvaIoqB6+YzvavgAPqwnK7tbp6Rjkcdg0ZSyU EqoYaoSm6WtaptZkIKLCQs/1Esuxxo7ZOa6hnn97SqNaTcRIr1yLC9DIuo0rUtksNpI3 orlgjLdVIe6LRlF+YxYMrPX4sEWmcdIvP7uBwxx6KtaFUSWVn8ZG63av2KfPeLA8rzYk 6S0Q== X-Gm-Message-State: ALoCoQks7Xbs95R0Y+tmGN/3Iu3cs1ppk7WvQKhidSOTsgtxifE9VBQHwEOq8jtgtpZ1+bJoDtHH X-Received: by 10.112.199.167 with SMTP id jl7mr4725475lbc.5.1416395797361; Wed, 19 Nov 2014 03:16:37 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.227 with SMTP id i3ls1106678lae.28.gmail; Wed, 19 Nov 2014 03:16:37 -0800 (PST) X-Received: by 10.112.201.72 with SMTP id jy8mr4714713lbc.65.1416395797152; Wed, 19 Nov 2014 03:16:37 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id sn3si1448943lbb.77.2014.11.19.03.16.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 03:16:37 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so298378lbv.10 for ; Wed, 19 Nov 2014 03:16:37 -0800 (PST) X-Received: by 10.112.138.137 with SMTP id qq9mr1958144lbb.80.1416395797005; Wed, 19 Nov 2014 03:16:37 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp64282lbc; Wed, 19 Nov 2014 03:16:36 -0800 (PST) X-Received: by 10.70.96.193 with SMTP id du1mr19301999pdb.136.1416395792102; Wed, 19 Nov 2014 03:16:32 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xo9si2087857pbc.210.2014.11.19.03.16.31 for ; Wed, 19 Nov 2014 03:16:32 -0800 (PST) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754208AbaKSLQa (ORCPT + 4 others); Wed, 19 Nov 2014 06:16:30 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:39165 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204AbaKSLQ3 (ORCPT ); Wed, 19 Nov 2014 06:16:29 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFA001NYA41AR40@mailout2.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 19 Nov 2014 11:19:14 +0000 (GMT) X-AuditID: cbfec7f4-b7f6c6d00000120b-8c-546c7c0a5eb7 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 8E.E6.04619.A0C7C645; Wed, 19 Nov 2014 11:16:26 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NFA00GC59YMTL30@eusync1.samsung.com>; Wed, 19 Nov 2014 11:16:26 +0000 (GMT) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , linaro-mm-sig@lists.linaro.org, Arnd Bergmann , Shaik Ameer Basha , Cho KyongHo , Joerg Roedel , Thierry Reding , Olof Johansson , Laurent Pinchart , Rob Herring , Will Deacon , David Wodhouse , Inki Dae , Kukjin Kim , Tomasz Figa , Kyungmin Park Subject: [PATCH v3 07/19] iommu: exynos: don't read version register on every tlb operation Date: Wed, 19 Nov 2014 12:15:36 +0100 Message-id: <1416395748-10731-8-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1416395748-10731-1-git-send-email-m.szyprowski@samsung.com> References: <1416395748-10731-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xy7pcNTkhBt/PmVr8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK+P88XdMBd+FKk4/+MHWwHiav4uRk0NCwERi6tVudghbTOLCvfVs XYxcHEICSxklrtz4zA7h9DFJ7O1rYQOpYhMwlOh62wVmiwjkS7zY+5cFxGYWeMMicW+TIYgt LBAr8fXeaUYQm0VAVeLipwVMIDavgIfE5fkbmCG2yUn8f7kCKM7BwSngKXH9BdgYIaCSpunr WCcw8i5gZFjFKJpamlxQnJSea6hXnJhbXJqXrpecn7uJERIfX3YwLj5mdYhRgINRiYe3oTgn RIg1say4MvcQowQHs5IIb3EhUIg3JbGyKrUoP76oNCe1+BAjEwenVAPjNJv1zy0vf/3b6j2v Z0aBfKPagguqNT+nHn/RYCXnLHH57mPuLpbsygjXN8E5d3mnv1Bv02pLc/kcsMhk8nQDhidy ncHnv6mu2NSSqpnV/saqXZL9WcX5NWvtupOlL6XPVjkpsEVnY/PpVearquaUyd/+bb3kkJ7Y pzfz04X7ylY0GEwKChZQYinOSDTUYi4qTgQADvKJZ20CAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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.217.179 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 74233186f6f7..2912c4f9a8ad 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -212,6 +212,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) @@ -238,11 +239,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; @@ -402,7 +398,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; @@ -416,6 +412,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) @@ -525,7 +522,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); } @@ -574,7 +571,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)) {