From patchwork Wed Nov 22 13:14:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10070475 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 554A3601D5 for ; Wed, 22 Nov 2017 13:15:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AF07284E7 for ; Wed, 22 Nov 2017 13:15:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F6F429975; Wed, 22 Nov 2017 13:15:12 +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 C3139284E7 for ; Wed, 22 Nov 2017 13:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751499AbdKVNPJ (ORCPT ); Wed, 22 Nov 2017 08:15:09 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:36987 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751244AbdKVNPF (ORCPT ); Wed, 22 Nov 2017 08:15:05 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171122131503euoutp028f2ea427d08e008417880f5bb707f577~5artkXoFW1076610766euoutp02D; Wed, 22 Nov 2017 13:15:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171122131503euoutp028f2ea427d08e008417880f5bb707f577~5artkXoFW1076610766euoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1511356503; bh=XoYhBqv3CZKmWiVLJmW6MhtzRsYyTCaPde+Nt5dCNJ4=; h=From:To:Cc:Subject:Date:References:From; b=LAsACHIE+dDD0P3AtarhZg79WWte2qs7VtyUDYVztxRCTs7HVWTrkJVtFbzw2IZc+ RwNKdmWCAUvX5nAqhWrdms063a7iPdx6r/hfng6QqAZtM81ch8NJGz/AimUPegLt1k FxI0c7gmKYl3oh84YPnfGEWtS77QZfO91ZKbkoJ8= Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171122131502eucas1p1d4947702900140ea250aa33cf4935363~5ars43DNO3050930509eucas1p1c; Wed, 22 Nov 2017 13:15:02 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 5D.27.12576.558751A5; Wed, 22 Nov 2017 13:15:02 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171122131501eucas1p1557c57b70990b11084228e64d54726c2~5arsDiSBu3099730997eucas1p1S; Wed, 22 Nov 2017 13:15:01 +0000 (GMT) X-AuditID: cbfec7ef-f79ee6d000003120-75-5a1578550b1d Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 74.52.18832.558751A5; Wed, 22 Nov 2017 13:15:01 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OZT00252M4XM5B0@eusync3.samsung.com>; Wed, 22 Nov 2017 13:15:01 +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 v2] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU Date: Wed, 22 Nov 2017 14:14:47 +0100 Message-id: <20171122131447.25627-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.14.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djPc7phFaJRBp++M1psnLGe1eLK1/ds FpPuT2CxOH9+A7vFjPP7mCzWHrnLbrF+2k9WiwUbHzFazJj8ks2B02PnrLvsHptWdbJ53O8+ zuTRt2UVo8fnTXIBrFFcNimpOZllqUX6dglcGadbCwr+8VY8PXaUuYHxBncXIyeHhICJxOx9 V9khbDGJC/fWs3UxcnEICSxjlLh2tJcFwvnMKNHx9hkjTMes+/MY4armb9rCDuE0MEkcfTaB FaSKTcBQouttFxuILSLgJtF0eCYrSBGzwEImiSdbvoKNEhaIk1jRvAYowcHBIqAqsXhGDEiY V8BWovXSZCaIbfIS7xfcB9smIdDBJnH70XOohIvEyUctLBC2sMSr41ugnpCR6Ow4CFXTzyjR 1KoNYc9glDj3lhfCtpY4fPwi2KHMAnwSk7ZNZwa5QUKAV6KjTQiixEPi9Np2qDGOErfPbwez hQRiJS5/fsY6gVFqASPDKkaR1NLi3PTUYkO94sTc4tK8dL3k/NxNjMAYPf3v+PsdjE+bQw4x CnAwKvHwzkgSiRJiTSwrrsw9xCjBwawkwrtXQTRKiDclsbIqtSg/vqg0J7X4EKM0B4uSOK9t VFukkEB6YklqdmpqQWoRTJaJg1OqgTH17fS40rdPQq/o7XX8MrGX73i42tdP+k/7o3+qr5jQ ahwoPdfraG6Y6fS/8ru/PNew3b/K50c1xwZjLm0ZZobsx3dkZmxqfarP9Nb1qPf9Nn2hk3/U 1tyZvL73SUbx7z4R3rzoo977loupBK1zzYpZUX8hXflIaOB2Tq+3HtIGBr3nJRZ9YVFiKc5I NNRiLipOBABcUt6izQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphluLIzCtJLcpLzFFi42I5/e/4Vd3QCtEog/XnxS02zljPanHl63s2 i0n3J7BYnD+/gd1ixvl9TBZrj9xlt1g/7SerxYKNjxgtZkx+yebA6bFz1l12j02rOtk87ncf Z/Lo27KK0ePzJrkA1igum5TUnMyy1CJ9uwSujNOtBQX/eCueHjvK3MB4g7uLkZNDQsBEYtb9 eYwQtpjEhXvr2boYuTiEBJYwSuz8tZ4dwmlikuhu+88EUsUmYCjR9baLDcQWEXCTaDo8kxWk iFlgIZPEsmufwYqEBeIktr1dClTEwcEioCqxeEYMSJhXwFai9dJkJoht8hLvF9xnnMDIvYCR YRWjSGppcW56brGhXnFibnFpXrpecn7uJkZg2Gw79nPzDsZLG4MPMQpwMCrx8M5IEokSYk0s K67MPcQowcGsJMK7V0E0Sog3JbGyKrUoP76oNCe1+BCjNAeLkjhv757VkUIC6YklqdmpqQWp RTBZJg5OqQZG509BvqUx3ZN+LdjeMIE/pu7qwu6d17U6pr+Jf+H3JPD8l6M/H25tbNmr82jv 3YovlQrb2nPswyyWerBNK3mvyZBv1qLX95f3oNqOl6me9274812XFV/eFOs57fKl3rPpP19L ztM5+KtPa+ZX4TucR8y2BHw/6pzLIRe0bsOhTHn59vfXdJ7vVGIpzkg01GIuKk4EAILy5d8X AgAA X-CMS-MailID: 20171122131501eucas1p1557c57b70990b11084228e64d54726c2 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171122131501eucas1p1557c57b70990b11084228e64d54726c2 X-RootMTR: 20171122131501eucas1p1557c57b70990b11084228e64d54726c2 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+ Reviewed-by: Tobias Jakobi --- 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. Changelog: v2: - added warning message when buffer flags are updadated (requested by Inki) v1: https://patchwork.kernel.org/patch/10034919/ - initial version --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 077de014d610..4400efe3974a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev, if (IS_ERR(exynos_gem)) return exynos_gem; + if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) { + /* + * when no IOMMU is available, all allocated buffers are + * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag + */ + flags &= ~EXYNOS_BO_NONCONTIG; + DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n"); + } + /* set memory type and cache attribute from user side. */ exynos_gem->flags = flags;