From patchwork Mon Mar 27 08:04:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 96031 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1110895qgd; Mon, 27 Mar 2017 01:04:53 -0700 (PDT) X-Received: by 10.84.174.4 with SMTP id q4mr27321314plb.35.1490601893392; Mon, 27 Mar 2017 01:04:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r131si11776899pgr.299.2017.03.27.01.04.53; Mon, 27 Mar 2017 01:04:53 -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 S1752098AbdC0IEv (ORCPT + 4 others); Mon, 27 Mar 2017 04:04:51 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:20906 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752064AbdC0IEs (ORCPT ); Mon, 27 Mar 2017 04:04:48 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ONG003UCRRRP680@mailout2.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Mon, 27 Mar 2017 09:04:39 +0100 (BST) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170327080439eucas1p1af2a7398ff1505af8051f65451934fe3~vroL3FgTR1220412204eucas1p1w; Mon, 27 Mar 2017 08:04:39 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id C9.8C.25577.697C8D85; Mon, 27 Mar 2017 09:04:38 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170327080438eucas1p28a1a20c1bfeafc037fe26d94639044a9~vroLNJsU40860008600eucas1p2S; Mon, 27 Mar 2017 08:04:38 +0000 (GMT) X-AuditID: cbfec7f5-f792f6d0000063e9-4b-58d8c79627b5 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A6.B8.20206.7A7C8D85; Mon, 27 Mar 2017 09:04:55 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ONG00FT4RRM3N00@eusync1.samsung.com>; Mon, 27 Mar 2017 09:04:38 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Andrzej Hajda , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH] drm/exynos: Properly release default ARM DMA-IOMMU mapping Date: Mon, 27 Mar 2017 10:04:32 +0200 Message-id: <1490601872-17369-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsWy7djP87rTjt+IMDjwwcLi1rpzrBYbZ6xn tbjy9T2bxaT7E1gsXty7yGJx/vwGdosZ5/cxWaw9chfImvySzYHTY9OqTjaP+93HmTz6tqxi 9Pi8SS6AJYrLJiU1J7MstUjfLoErY9GfXSwFe7kq1j6Zx9jA+I+ji5GTQ0LAROL2h5MsELaY xIV769m6GLk4hASWMk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6gZF7ASPDKkaR1NLi3PTcYiO94sTc 4tK8dL3k/NxNjMBA3Xbs55YdjF3vgg8xCnAwKvHw7hC7ESHEmlhWXJl7iFGCg1lJhPfgfqAQ b0piZVVqUX58UWlOavEhRlOg5ROZpUST84FRlFcSb2hiaG5paGRsYWFuZKQkzjv1w5VwIYH0 xJLU7NTUgtQimD4mDk6pBsbmG18Suu8l7ik7Xi0rdIRhvsHylOfaHw6em8f0OWHjZZ6mh0Fv dWdxqnJoScyIzO8pOD7bvas4b316R/DrFZNmXpl+yt/xnbvlw5xWVYlfXjvvJrNcanRLWNhx XlCs/drlOsbvF75+MXWY8DRG4qxIE5v2n9zr+VxfWpRaHL09k/fWsv6b0qXEUpyRaKjFXFSc CABT7NLFagIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170327080438eucas1p28a1a20c1bfeafc037fe26d94639044a9 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 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: 20170327080438eucas1p28a1a20c1bfeafc037fe26d94639044a9 X-RootMTR: 20170327080438eucas1p28a1a20c1bfeafc037fe26d94639044a9 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Exynos DRM on ARM architecture creates its own DMA-IOMMU mapping, shared between all devices that builds the Exynos DRM subsystem. Thus, the default DMA-IOMMU mapping structure created by platform init code can be released to avoid leaking resources, because after exynos_iommu_attach() the default mapping is no longer accessible. Reported-by: Seung-Woo Kim Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_iommu.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 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/gpu/drm/exynos/exynos_drm_iommu.h b/drivers/gpu/drm/exynos/exynos_drm_iommu.h index 87f6b5672e11..7a4528461bba 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h @@ -37,8 +37,13 @@ static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv, static inline int __exynos_iommu_attach(struct exynos_drm_private *priv, struct device *dev) { - if (dev->archdata.mapping) + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + + /* release device from the default DMA-IOMMU mapping */ + if (mapping) { arm_iommu_detach_device(dev); + arm_iommu_release_mapping(mapping); + } return arm_iommu_attach_device(dev, priv->mapping); }