From patchwork Fri Mar 24 09:19:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 95927 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1144638qgd; Fri, 24 Mar 2017 02:19:15 -0700 (PDT) X-Received: by 10.99.154.9 with SMTP id o9mr7729654pge.69.1490347155195; Fri, 24 Mar 2017 02:19:15 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21si1962552pgj.268.2017.03.24.02.19.14; Fri, 24 Mar 2017 02:19:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934851AbdCXJTO (ORCPT + 4 others); Fri, 24 Mar 2017 05:19:14 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:26340 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934719AbdCXJTN (ORCPT ); Fri, 24 Mar 2017 05:19:13 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ONB00HNTB7XOD60@mailout4.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Fri, 24 Mar 2017 09:19:09 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170324091909eucas1p178e236d3840d878a74c0503fa2424897~uxtX8VaN01717017170eucas1p1f; Fri, 24 Mar 2017 09:19:09 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id FD.80.28517.C84E4D85; Fri, 24 Mar 2017 09:19:08 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170324091908eucas1p1afc5e0375908fd2e620b119eeb089cad~uxtXLqS0b1872318723eucas1p1d; Fri, 24 Mar 2017 09:19:08 +0000 (GMT) X-AuditID: cbfec7f4-f79716d000006f65-41-58d4e48c766c Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D0.12.06687.9F4E4D85; Fri, 24 Mar 2017 09:20:57 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ONB00ATSB7TG350@eusync4.samsung.com>; Fri, 24 Mar 2017 09:19:08 +0000 (GMT) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joerg Roedel , Krzysztof Kozlowski , Andrzej Hajda , Bartlomiej Zolnierkiewicz Subject: [PATCH] iommu/exynos: Use smarter TLB flush method for v5 SYSMMU Date: Fri, 24 Mar 2017 10:19:01 +0100 Message-id: <1490347141-17980-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djPc7o9T65EGGx5bGBxa905VouNM9az WizYb23ROXsDu8X580Bixvl9TBZrj9xld2D3eHJwHpPHplWdbB6Tbyxn9OjbsorR4/MmuQDW KC6blNSczLLUIn27BK6MB6evMRUc463oPt3E2MD4jauLkZNDQsBEYsqpqYwQtpjEhXvr2boY uTiEBJYySqxf9J0dJCEk8JlR4vh2T5iGa8v72CGKljFKLDm2hwXCa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8372C8tDH4EKMAB6MSD29EzaUIIdbEsuLK3EOMEhzMSiK8oiuuRAjxpiRW VqUW5ccXleakFh9iNAVaPpFZSjQ5Hxg5eSXxhiaG5paGRsYWFuZGRkrivCUfroQLCaQnlqRm p6YWpBbB9DFxcEo1MC7oXLXzU/Xug95363XCXlx5sfnR808Jderb07YtdI0XrWrewqqc9tYt Sa5tz8yVkTeyJkaVr+fhPhPAoOkyKfba186HZtODAzyi56Rv7zdalOr7ZrV6WrHQrDzRPuEz 4pYL24RuMDR9OO184kkgy+55gt+Pas3kuqTFEs98mvWicH9N36cTzkosxRmJhlrMRcWJANqM luFkAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170324091908eucas1p1afc5e0375908fd2e620b119eeb089cad X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170324091908eucas1p1afc5e0375908fd2e620b119eeb089cad X-RootMTR: 20170324091908eucas1p1afc5e0375908fd2e620b119eeb089cad References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org SYSMMU v5 has dedicated registers to perform TLB flush range operation, so use them instead of looping with FLUSH_ENTRY command. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index c01bfcdb2383..48b5dabd06ce 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -171,6 +171,9 @@ static u32 lv2ent_offset(sysmmu_iova_t iova) #define REG_V5_PT_BASE_PFN 0x00C #define REG_V5_MMU_FLUSH_ALL 0x010 #define REG_V5_MMU_FLUSH_ENTRY 0x014 +#define REG_V5_MMU_FLUSH_RANGE 0x018 +#define REG_V5_MMU_FLUSH_START 0x020 +#define REG_V5_MMU_FLUSH_END 0x024 #define REG_V5_INT_STATUS 0x060 #define REG_V5_INT_CLEAR 0x064 #define REG_V5_FAULT_AR_VA 0x070 @@ -319,14 +322,23 @@ static void __sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data, { unsigned int i; - for (i = 0; i < num_inv; i++) { - if (MMU_MAJ_VER(data->version) < 5) + if (MMU_MAJ_VER(data->version) < 5) { + for (i = 0; i < num_inv; i++) { writel((iova & SPAGE_MASK) | 1, data->sfrbase + REG_MMU_FLUSH_ENTRY); - else + iova += SPAGE_SIZE; + } + } else { + if (num_inv == 1) { writel((iova & SPAGE_MASK) | 1, data->sfrbase + REG_V5_MMU_FLUSH_ENTRY); - iova += SPAGE_SIZE; + } else { + writel((iova & SPAGE_MASK), + data->sfrbase + REG_V5_MMU_FLUSH_START); + writel((iova & SPAGE_MASK) + (num_inv - 1) * SPAGE_SIZE, + data->sfrbase + REG_V5_MMU_FLUSH_END); + writel(1, data->sfrbase + REG_V5_MMU_FLUSH_RANGE); + } } }