From patchwork Tue Sep 16 11:54:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 37448 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B296F2057E for ; Tue, 16 Sep 2014 11:55:16 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id p9sf3132396lbv.8 for ; Tue, 16 Sep 2014 04:55:15 -0700 (PDT) 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=zjC31rbIy2wDdbBlrxKciu5mq5jR2g7D63Sy6YQwBw4=; b=PfIpRT9oO++xhHu1KyWA+PjUHCTMDTpaN2sEE1V0sWo3oRQ26mSBCdThK07yBRNk6N d//6n2qehbGjkgUO6HBX8I9qu6pqfwXNJWPJ3xgBfFGIfXj0y+Avq/P+m7uROsOdFFm5 1ZxnJJS7WnAJchMRmmXHyl/YGPimCZDef1jHu0U2dHEeJ9P4b5ploDPNNWmYdOmTUe07 +8XGM7iF9VBWBD9l37CbHC9gA5OOP75/OyaNG1AqdPIKfJ1CGIqrrQtWQrgUbgCGPeJT Jt19paDSfN2745InE7Yv28nHNz/GBq9q2UjfhyuKU7ebIB+tvVtVCg4fIumFzL6kuZ9u ik8w== X-Gm-Message-State: ALoCoQmYgroPG+QL2g9SVTlMQvkyjPAtE12r9NTzRs9M/rFmwGsTFvRnmv8/ep6JSBOp9zs3RnKq X-Received: by 10.180.12.148 with SMTP id y20mr6565377wib.7.1410868513062; Tue, 16 Sep 2014 04:55:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.2 with SMTP id p2ls492591lag.10.gmail; Tue, 16 Sep 2014 04:55:12 -0700 (PDT) X-Received: by 10.152.9.37 with SMTP id w5mr35861651laa.28.1410868512707; Tue, 16 Sep 2014 04:55:12 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id z3si23841103lbk.51.2014.09.16.04.55.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 04:55:11 -0700 (PDT) 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 p9so6402682lbv.10 for ; Tue, 16 Sep 2014 04:55:11 -0700 (PDT) X-Received: by 10.152.7.8 with SMTP id f8mr35774956laa.27.1410868511411; Tue, 16 Sep 2014 04:55:11 -0700 (PDT) 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.130.169 with SMTP id of9csp374274lbb; Tue, 16 Sep 2014 04:55:10 -0700 (PDT) X-Received: by 10.70.89.3 with SMTP id bk3mr57998414pdb.41.1410868509557; Tue, 16 Sep 2014 04:55:09 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dw7si13274669pab.96.2014.09.16.04.55.08 for ; Tue, 16 Sep 2014 04:55:09 -0700 (PDT) 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 S1754342AbaIPLzG (ORCPT + 6 others); Tue, 16 Sep 2014 07:55:06 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:62696 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754322AbaIPLzA (ORCPT ); Tue, 16 Sep 2014 07:55:00 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) 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 <0NBZ00999T8AIBB0@mailout4.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 16 Sep 2014 12:57:46 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-e5-541825118d89 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 39.8C.15956.11528145; Tue, 16 Sep 2014 12:54:57 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBZ00CMIT3CL960@eusync2.samsung.com>; Tue, 16 Sep 2014 12:54:57 +0100 (BST) 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 v2 06/18] iommu: exynos: don't read version register on every tlb operation Date: Tue, 16 Sep 2014 13:54:33 +0200 Message-id: <1410868485-4143-7-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> References: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xK7qCqhIhBte2aFj8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK+NmTydbwXehisZ9ig2Mp/m7GDk5JARMJJ4tvc4OYYtJXLi3nq2L kYtDSGApo8SfJ3fYIZw+Jolbe1aygVSxCRhKdL3tArNFBPIlXuz9ywJiMwu8YZG4t8kQxBYW iJXY8fcdE4jNIqAq8Xt6DyuIzSvgLrH2xyqobXIS/1+uAKvhFPCQmNz2hBnEFgKq+fjtFNME Rt4FjAyrGEVTS5MLipPSc430ihNzi0vz0vWS83M3MULi4+sOxqXHrA4xCnAwKvHwZvwTDxFi TSwrrsw9xCjBwawkwquhKBEixJuSWFmVWpQfX1Sak1p8iJGJg1OqgbH/QfRzRYMmDp5zHhF7 Two62nz/+nFt0Klr27R6zbtPtVd9ufudZ/PSXsknSZeq7r8IinZI2D5/guQ8pSrehqtaqyyr GkM2rNh77sDvkCXqNuJPZNx0//V9kJgmE699jb1CdImzzuNneboXSm5U/1bfGvbwceb5LtuW 204OKXIFP7erejNJeiixFGckGmoxFxUnAgCCrdl3bQIAAA== 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 d037e87a1fe5..73499b05e62e 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)) {