From patchwork Mon Mar 20 09:17:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9633419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 10082602D6 for ; Mon, 20 Mar 2017 09:18:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFB111FF87 for ; Mon, 20 Mar 2017 09:18:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E34DC27FA3; Mon, 20 Mar 2017 09:18:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 853B91FF87 for ; Mon, 20 Mar 2017 09:18:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753351AbdCTJSh (ORCPT ); Mon, 20 Mar 2017 05:18:37 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:20882 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752966AbdCTJSf (ORCPT ); Mon, 20 Mar 2017 05:18:35 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ON300244WIQWM90@mailout2.w1.samsung.com>; Mon, 20 Mar 2017 09:18:26 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170320091826eucas1p1bc25e0e709ef6809d006a979ee08f17b~tjHm82k0W0397203972eucas1p1n; Mon, 20 Mar 2017 09:18:26 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 46.96.16908.46E9FC85; Mon, 20 Mar 2017 09:18:28 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170320091825eucas1p19e9ee18390287c275c9406144e88eef8~tjHmUYmeo0396803968eucas1p1o; Mon, 20 Mar 2017 09:18:25 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-b9-58cf9e644648 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6A.07.06687.BCE9FC85; Mon, 20 Mar 2017 09:20:11 +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 <0ON300FS3WICYHA0@eusync4.samsung.com>; Mon, 20 Mar 2017 09:18:25 +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 , stable@vger.kernel.org Subject: [PATCH 2/2] iommu/exynos: Workaround FLPD cache flush issues for SYSMMU v5 Date: Mon, 20 Mar 2017 10:17:57 +0100 Message-id: <1490001484-18890-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1490001484-18890-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFIsWRmVeSWpSXmKPExsWy7djPc7op885HGMyaoW1xa905VouNM9az WizYb23ROXsDu8X580Bixvl9TBZrj9xlt1iw8RGjA4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tIYAmj xOsDgl2MXEB2E5PEvR8rmEASbAKGEl1vu8CKRATcJa7/ec4CUsQs8J5R4saC/UAOB4ewQKjE uYNgQ1kEVCWuX5jIAmLzCnhIrN3dxwaxTE7i5LHJrCA2p4CnxINP51khFntIXDs/j3ECI+8C RoZVjCKppcW56bnFhnrFibnFpXnpesn5uZsYgQG97djPzTsYL20MPsQowMGoxMNrcPVchBBr YllxZe4hRgkOZiUR3h0J5yOEeFMSK6tSi/Lji0pzUosPMZoCHTWRWUo0OR8YbXkl8YYmhuaW hkbGFhbmRkZK4rwlH66ECwmkJ5akZqemFqQWwfQxcXBKNTDyXAxy5dxfP8Ffddq6t/M/mbw4 K17h6bciuNp/WiZ7+I0/mWdNmWPeyLlOZJtRL2f7iCf46vuFOzqulcj6Hns+jYE9wPNqZIuB l1mis9jmVsU79e+uq2d8Ujxk8yf+out0rihxLvW/Nd+UPSZNb1VcblA8e+ZTr05RFTcbjUnn bfh3uTBvMlViKc5INNRiLipOBAC8UDJGfgIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170320091825eucas1p19e9ee18390287c275c9406144e88eef8 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170320091825eucas1p19e9ee18390287c275c9406144e88eef8 X-RootMTR: 20170320091825eucas1p19e9ee18390287c275c9406144e88eef8 References: <1490001484-18890-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For some unknown reasons, in some cases, FLPD cache invalidation doesn't work properly with SYSMMU v5 controllers found in Exynos5433 SoCs. This can be observed by a firmware crash during initialization phase of MFC video decoder available in the mentioned SoCs when IOMMU support is enabled. To workaround this issue perform a full TLB/FLPD invalidation in case of replacing any first level page descriptors in case of SYSMMU v5. Fixes: 740a01eee9ada ("iommu/exynos: Add support for v5 SYSMMU") CC: stable@vger.kernel.org # v4.10+ Signed-off-by: Marek Szyprowski Tested-by: Andrzej Hajda --- The mentioned commit has been merged to v4.6, but this fix applies only for v4.10+ kernels due to other changes in the surrounding code. --- drivers/iommu/exynos-iommu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 32d43f1994e4..c01bfcdb2383 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -513,7 +513,10 @@ static void sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data, if (data->active && data->version >= MAKE_MMU_VER(3, 3)) { clk_enable(data->clk_master); if (sysmmu_block(data)) { - __sysmmu_tlb_invalidate_entry(data, iova, 1); + if (data->version >= MAKE_MMU_VER(5, 0)) + __sysmmu_tlb_invalidate(data); + else + __sysmmu_tlb_invalidate_entry(data, iova, 1); sysmmu_unblock(data); } clk_disable(data->clk_master);