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: 119487 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp157686qgn; Wed, 22 Nov 2017 05:15:08 -0800 (PST) X-Google-Smtp-Source: AGs4zManejaw2zcCc+e/Xcs7n0ufZ021iHIOdZCDTC6T3IDt3XGU8HjbJtb+Tg9tOAtyrhLzFwQ9 X-Received: by 10.99.138.194 with SMTP id y185mr20359695pgd.290.1511356508051; Wed, 22 Nov 2017 05:15:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511356508; cv=none; d=google.com; s=arc-20160816; b=HQn8XFpd5EklPcN/H2QxyeXpK20DBQph/ZBh5pm2Xb1MCJqY7xoSsMXDZVB5Wdjqhe ubYi9YkGLVrZdc11vU+eAs+471YPw0QZ0mox4fM529bB+sqcPDx3BYHXnGxDM2cSpFNA CT/n6Wq8Aj2LKVCol63s/y2qGS2aT0dJMXVnOb6KLYqo/9gX/rcW46QFMxKKYZY2+mtN vfdHV9ah4tS8aWlt/Uk/pxeATUuWYDkpKweeolkQ0v8+0g7WEXfFDnNzgCKztkLz8dWK jBTYXT7hsORkpBD1TOQkKNkOJnEIZYq1CMGaJoYzdeANToipoPI8IW85w5/L6m7E+9bT sItw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:cms-type:message-id:date:subject :to:from:dkim-signature:dkim-filter:delivered-to :arc-authentication-results; bh=TN+yADOS3IimApjxqdHE7qK5tW6ZPtUye0Y/wVdRgls=; b=StJT/KqYqySS/Fm93s/YduiPtkWXjhpA0YuA25b9OQLNGCjRf4V2+XsYHlh9IsSdmd UQxC4AbRMQh8Zq7N8Z272Gjxcm4rYLmyu9ZyZSWW1c8zl8NVgd59uhP3z9Rsc3RVaXLS OLsBZrk5EpF6PPa77Q0WY/LOG2kjJ9X9cIZU323BtLJF/rBhllY9AIYK1K9hcH/u23eB qTfmQJwy5FZp9RRfJOhb2qSCQbwSV2C+IBm/7cZ9K+RS2KZfU4/n9oRHT4NF1umRI15Q UB3Zs30ENKzAA+NW/94TvZprrbeMo8zAA/TpzTkyi9Uz8JR3PN8qS0gFWhLa0OzNs0/F 8lkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=LAsACHIE; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 72si14662973pft.236.2017.11.22.05.15.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 05:15:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=LAsACHIE; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA1676E652; Wed, 22 Nov 2017 13:15:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id C8EA96E652 for ; Wed, 22 Nov 2017 13:15:05 +0000 (UTC) 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 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: Cc: Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Krzysztof Kozlowski , stable@vger.kernel.org, Marian Mihailescu , Marek Szyprowski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. 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;