From patchwork Thu Aug 8 09:39:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 2840948 Return-Path: X-Original-To: patchwork-linux-arm@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 64E6A9F3B9 for ; Thu, 8 Aug 2013 09:57:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86B73204B4 for ; Thu, 8 Aug 2013 09:57:39 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 59A86204B0 for ; Thu, 8 Aug 2013 09:57:38 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7Mi0-0002bv-VH; Thu, 08 Aug 2013 09:40:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7MhD-00056j-2f; Thu, 08 Aug 2013 09:39:51 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7MhA-00054W-Iu for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2013 09:39:49 +0000 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MR7006ZVHGWJSG0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2013 18:39:27 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.47]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 2E.04.17404.F4763025; Thu, 08 Aug 2013 18:39:27 +0900 (KST) X-AuditID: cbfee68d-b7f096d0000043fc-43-5203674fb6c4 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 9E.58.32250.F4763025; Thu, 08 Aug 2013 18:39:27 +0900 (KST) Received: from DOPULLIPCHO07 ([12.23.118.94]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MR70024WHHRI750@mmp1.samsung.com>; Thu, 08 Aug 2013 18:39:27 +0900 (KST) From: Cho KyongHo To: 'Linux ARM Kernel' , 'Linux IOMMU' , 'Linux Kernel' , 'Linux Samsung SOC' , devicetree@vger.kernel.org Subject: [PATCH v9 09/16] iommu/exynos: remove prefetch buffer setting when enabling System MMU Date: Thu, 08 Aug 2013 18:39:27 +0900 Message-id: <002d01ce941b$2c8e1560$85aa4020$@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac6UF5avKfzT2kHzSwK83z01UWdALA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42I5/e+Zvq5/OnOQwZSjmhZ37p5jtZh/BEi8 OvKDyWLBfmuLztkb2C16F1xls/h46ji7xabH11gtLu+aw2Yx4/w+JosLKzayW0xZdJjV4uSf XkaLluu9TA58Hk8OzmPymN1wkcXjzrU9bB7nN61h9ti8pN5j8o3ljB59W1YxenzeJOdx5egZ pgDOKC6blNSczLLUIn27BK6MZ//mMRXMF6649TW3gfE0fxcjJ4eEgInE0U2LmSFsMYkL99az dTFycQgJLGOUeNW9kQ2m6OytFYwQiUWMEs+WdDJDOH8ZJf4tvQZWxSagJbF67nGwKhGB34wS t57NYQVxmAX+M0lsvd3EDlIlLJAo8a/vIQ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jIrHvxTvGCYwC s5CMmoVk1Cwko2YhaVnAyLKKUTS1ILmgOCk911CvODG3uDQvXS85P3cTIzi1PJPawbiyweIQ owAHoxIPb0cAU5AQa2JZcWXuIUYJDmYlEd6LxUAh3pTEyqrUovz4otKc1OJDjMlAn05klhJN zgemvbySeENjEzMjSyMzCyMTc3PShJXEeQ+0WgcKCaQnlqRmp6YWpBbBbGHi4JRqYHRfZn/Y vSw74Kjk9mI/hkrnwkXPo1rXH49Yb+0Vp5HIosd+Yf5PB7eVx+XDrjV0LONVz7zdnL9lScxU 01Bv/9Yb+x6kx2XMldfjqVvsE7t1xZNeRZ2bZqcOXf/cuqNuHve1LTqx8/OXpPXNTprLpPvk aPKinyf9u/Zcbr4psudmsvv1N2obHZVYijMSDbWYi4oTAZgxhsJxAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130808_053948_839123_F730385F X-CRM114-Status: GOOD ( 11.37 ) X-Spam-Score: -5.1 (-----) Cc: 'Kukjin Kim' , 'Prathyush' , 'Grant Grundler' , 'Joerg Roedel' , 'Subash Patel' , 'Sachin Kamat' , 'Antonios Motakis' , kvmarm@lists.cs.columbia.edu, 'Rahul Sharma' X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, 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 Prefetch buffer must be handled accurately, exact range of a buffer, frame by frame manually. Otherwise, it may causes page fault or deadlock in System MMU. Thus this patch removes prefetch buffer setting when System MMU is initialized(enabled). Signed-off-by: Cho KyongHo --- drivers/iommu/exynos-iommu.c | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 005a7ed..88b9139 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -80,6 +80,8 @@ #define CTRL_BLOCK 0x7 #define CTRL_DISABLE 0x0 +#define CFG_FLPDCACHE (1 << 20) /* System MMU 3.2+ only */ + #define REG_MMU_CTRL 0x000 #define REG_MMU_CFG 0x004 #define REG_MMU_STATUS 0x008 @@ -96,6 +98,9 @@ #define REG_MMU_VERSION 0x034 +#define MMU_MAJ_VER(reg) (reg >> 28) +#define MMU_MIN_VER(reg) ((reg >> 21) & 0x7F) + #define REG_PB0_SADDR 0x04C #define REG_PB0_EADDR 0x050 #define REG_PB1_SADDR 0x054 @@ -201,6 +206,22 @@ static bool is_sysmmu_active(struct sysmmu_drvdata *data) return data->activations > 0; } +static unsigned int __sysmmu_version(struct sysmmu_drvdata *data, + int idx, unsigned int *minor) +{ + unsigned long major; + + major = readl(data->sfrbases[idx] + REG_MMU_VERSION); + + if (minor) + *minor = MMU_MIN_VER(major); + + if (MMU_MAJ_VER(major) > 3) + return 1; + + return MMU_MAJ_VER(major); +} + static void sysmmu_unblock(void __iomem *sfrbase) { __raw_writel(CTRL_ENABLE, sfrbase + REG_MMU_CTRL); @@ -473,14 +494,15 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, clk_enable(data->clk_master); for (i = 0; i < data->nsfrs; i++) { + unsigned int min; + __sysmmu_set_ptbase(data->sfrbases[i], pgtable); - if ((readl(data->sfrbases[i] + REG_MMU_VERSION) >> 28) == 3) { - /* System MMU version is 3.x */ - __raw_writel((1 << 12) | (2 << 28), + if ((__sysmmu_version(data, i, &min) == 3) && (min > 1)) { + unsigned long cfg; + cfg = __raw_readl(data->sfrbases[i] + REG_MMU_CFG); + __raw_writel(cfg | CFG_FLPDCACHE, data->sfrbases[i] + REG_MMU_CFG); - __sysmmu_set_prefbuf(data->sfrbases[i], 0, -1, 0); - __sysmmu_set_prefbuf(data->sfrbases[i], 0, -1, 1); } __raw_writel(CTRL_ENABLE, data->sfrbases[i] + REG_MMU_CTRL);