From patchwork Tue Oct 31 16:28:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10034919 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 7B80C60327 for ; Tue, 31 Oct 2017 16:28:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E93A2000A for ; Tue, 31 Oct 2017 16:28:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 630EF28B3D; Tue, 31 Oct 2017 16:28:32 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 005A92000A for ; Tue, 31 Oct 2017 16:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753773AbdJaQ2b (ORCPT ); Tue, 31 Oct 2017 12:28:31 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:46516 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753762AbdJaQ22 (ORCPT ); Tue, 31 Oct 2017 12:28:28 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171031162826euoutp029760ba679dd7b994d5d71dfbdff32b51~ytIRx0GYz0317803178euoutp02h; Tue, 31 Oct 2017 16:28:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171031162826euoutp029760ba679dd7b994d5d71dfbdff32b51~ytIRx0GYz0317803178euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509467306; bh=g5RQPpabnBnjMwzZ3bKISaf+ZhkAnj+fKjmF2vXJ5k4=; h=From:To:Cc:Subject:Date:References:From; b=ovmpbSE5rJSa6CL7Un3Qv9sLhsORAIIImHM36AVeqoT9eVB07S8B9uMmKe0cPFyPA xF+EWvNPSURiyMNzEP/vg0Jqez7fEOra/UQsF63tfESTGkQhaimtWZHSYjs6aYd/zm kdbDPXhLjYVORZfbvSpAeNzJVh9pcfPFRXVfm9vo= Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171031162825eucas1p2c0b98ce467e5f0ad2a9ea59caa7a3611~ytIREY0ho0478304783eucas1p2N; Tue, 31 Oct 2017 16:28:25 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 8C.A6.12743.8A4A8F95; Tue, 31 Oct 2017 16:28:25 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171031162824eucas1p1d15c2ea1d529edd18e16506b26669b91~ytIQU7v7A1633616336eucas1p1n; Tue, 31 Oct 2017 16:28:24 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d0000031c7-77-59f8a4a8b7c5 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6E.84.20118.8A4A8F95; Tue, 31 Oct 2017 16:28:24 +0000 (GMT) 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 <0OYP0039O4F88Y30@eusync1.samsung.com>; Tue, 31 Oct 2017 16:28:24 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Seung-Woo Kim , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Marian Mihailescu , stable@vger.kernel.org Subject: [PATCH] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU Date: Tue, 31 Oct 2017 17:28:13 +0100 Message-id: <20171031162813.1546-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.14.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djPc7orl/yINNh8mNFi44z1rBZXvr5n s5h0fwKLxfnzG9gtZpzfx2Sx9shddov1036yWizY+IjRYsbkl2wOnB47Z91l99i0qpPN4373 cSaPvi2rGD0+b5ILYI3isklJzcksSy3St0vgynj29iZjwS7uihPnbrI1MJ7m7GLk5JAQMJF4 PXEaK4QtJnHh3nq2LkYuDiGBpYwSN5bNYYVwPjNKXD18gA2m49S7FVCJZYwSyw4+Y4FwGpgk Ph1qZAapYhMwlOh62wXWISLgJtF0eCZYB7PAQiaJJ1u+MoIkhAWiJZ6/mgTWwCKgKtH++BQ7 iM0rYCPx4H8X1Dp5ifcL7jOCNEsI9LBJHHr6DirhInH0zU92CFtY4tXxLVC2jMTlyd0sEHY/ o0RTqzaEPYNR4txbXgjbWuLw8YtgXzML8ElM2jYd6AgOoDivREebEESJh8SEGTOhVjlKLHs1 gQ2kREggVmLia88JjFILGBlWMYqklhbnpqcWm+oVJ+YWl+al6yXn525iBEbp6X/Hv+5gXHrM 6hCjAAejEg/vjMTvkUKsiWXFlbmHGCU4mJVEeFMX/4gU4k1JrKxKLcqPLyrNSS0+xCjNwaIk zmsb1RYpJJCeWJKanZpakFoEk2Xi4JRqYAz5NCcr9AXLnxKFAy8DnTKVvt/5sSW3fNqVVV1t 4VO1ts6JSvkRmNrObHB3rYXHShUd5osswqHpi9zydSwSV132e22hJF9qdvrVWgcWYbv/n8V+ 77o3u7Qzb82Xszw75lo+/aHBuTBvxinvjOn2Ibpv7r/8/PDa1o17DG42XdrBeeXW7yNn131W YinOSDTUYi4qTgQAz0+qHc4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjluLIzCtJLcpLzFFi42I5/e/4Zd0VS35EGhybJ2uxccZ6VosrX9+z WUy6P4HF4vz5DewWM87vY7JYe+Quu8X6aT9ZLRZsfMRoMWPySzYHTo+ds+6ye2xa1cnmcb/7 OJNH35ZVjB6fN8kFsEZx2aSk5mSWpRbp2yVwZTx7e5OxYBd3xYlzN9kaGE9zdjFyckgImEic ereCFcIWk7hwbz1bFyMXh5DAEkaJJ5tfskI4TUwSvx/2soBUsQkYSnS97WIDsUUE3CSaDs8E K2IWWMgksezaZyaQhLBAtMTzV5OYQWwWAVWJ9sen2EFsXgEbiQf/IZolBOQl3i+4zziBkXsB I8MqRpHU0uLc9NxiI73ixNzi0rx0veT83E2MwNDZduznlh2MXe+CDzEKcDAq8fDOSPweKcSa WFZcmXuIUYKDWUmEN3Xxj0gh3pTEyqrUovz4otKc1OJDjNIcLErivL17VkcKCaQnlqRmp6YW pBbBZJk4OKUaGA20Ci6fkMi8+oh967YZvud6avfFzckK2h8Vdy1R5GyE452Dh8/e+3uQ1VVi SsC1Invv6iuxTBPsbz/3kM+XMFm77zh74+fwOyLqwfUrJu+ZH3jq3OlLL/xTjT38L2iuPfNG ckPJac/bodITXnPea554OfjfllWsriJzNjxl2bPV1jhzu3i1nJUSS3FGoqEWc1FxIgBHa8dV GQIAAA== X-CMS-MailID: 20171031162824eucas1p1d15c2ea1d529edd18e16506b26669b91 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171031162824eucas1p1d15c2ea1d529edd18e16506b26669b91 X-RootMTR: 20171031162824eucas1p1d15c2ea1d529edd18e16506b26669b91 References: 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 When no IOMMU is available, all GEM buffers allocated by Exynos DRM driver are contiguous, because of the underlying dma_alloc_attrs() function provides only such buffers. In such case it makes no sense to keep BO_NONCONTIG flag for the allocated GEM buffers. This allows to avoid failures for buffer contiguity checks in the subsequent operations on GEM objects. Signed-off-by: Marek Szyprowski CC: stable@vger.kernel.org # v4.4+ --- This issue is there since commit 0519f9a12d011 ("drm/exynos: add iommu support for exynos drm framework"), but this patch applies cleanly only to v4.4+ kernel releases due changes in the surrounding code. --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 02f978bb9261..476c00fe1998 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -227,6 +227,13 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev, if (IS_ERR(exynos_gem)) return exynos_gem; + /* + * when no IOMMU is available, all allocated buffers are contiguous + * anyway, so drop EXYNOS_BO_NONCONTIG flag + */ + if (!is_drm_iommu_supported(dev)) + flags &= ~EXYNOS_BO_NONCONTIG; + /* set memory type and cache attribute from user side. */ exynos_gem->flags = flags;