From patchwork Wed Aug 10 17:30:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 9273251 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 503E0600CB for ; Wed, 10 Aug 2016 17:32:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 420C927EE2 for ; Wed, 10 Aug 2016 17:32:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36E3B28407; Wed, 10 Aug 2016 17:32:59 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C489527EE2 for ; Wed, 10 Aug 2016 17:32:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bXXLo-0007do-UA; Wed, 10 Aug 2016 17:31:32 +0000 Received: from resqmta-po-12v.sys.comcast.net ([2001:558:fe16:19:96:114:154:171]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bXXLW-0007Uq-D9 for linux-arm-kernel@lists.infradead.org; Wed, 10 Aug 2016 17:31:15 +0000 Received: from resomta-po-11v.sys.comcast.net ([96.114.154.235]) by resqmta-po-12v.sys.comcast.net with SMTP id XXKubbGTWlHMYXXLBbsnjM; Wed, 10 Aug 2016 17:30:53 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by comcast with SMTP id XXLAbv5f2r3KpXXLBbX2Cr; Wed, 10 Aug 2016 17:30:53 +0000 Received: from shuah-XPS-13-9350.sisa.samsung.com (shuah-xps.internal [192.168.1.87]) by mail.gonehiking.org (Postfix) with ESMTP id 926E39F2FE; Wed, 10 Aug 2016 11:30:52 -0600 (MDT) From: Shuah Khan To: inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, kgene@kernel.org, k.kozlowski@samsung.com Subject: [PATCH] exynos-drm: Fix display manager failing to start without IOMMU problem Date: Wed, 10 Aug 2016 11:30:51 -0600 Message-Id: <1470850251-9150-1-git-send-email-shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.7.4 X-CMAE-Envelope: MS4wfB65CKSkHVd/T75nSvgf4Dv+9HGQUxbdmaUj7yKlvC8uJU4RLsXP2DZdOpfujVAVEx4Dpk7WXA4yeauE1YM8Qy0A0moukksZZtgnowT+TjZ51apkCkjH GWHjESJaNXrZ1KuZZcVa3uOQK4iGScXXbPDfFZCpne0PWedIBrr9wT820hUUGREt6tTzxIAvt8a2Cx9haAvVxYPKwHf3iFfeXUNRakxCEXzpgIGYjINoO2OG OQhtWjkeyMli4ycapxsFtfWTops+xPD6DKqVJlmpdacTtFPKz1NTOPvxLa5icutfRIrpt7shD6z6cIVKQsNUs39gKL6ucAa7G/Q4tXcTpWesWQDqu9PC2zdt 5RvlegvQse0NnztuyFORdlkXbT0VJkQ6O9IkPr1mdCgHRnyV+PzzvCieGyF+PMFPj5sdc1od/qQ8bmJbK9+cHr/IArfDnptsxuj1OrLrdlWL1+QS+WAfUKcq 3w/3B5bEsLq3G14uE88AioADJBS+rno7+Lg9LDahL14P/1Q2RPeC3vK7HGC13Qt4K/nnNtXLC1W4sZROZO709v3u/gyEqCkmyhLV2AR7mmnjNPVHs1OPxcfE 5eDxX3uKWqu1bIUdeTJpyW23 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160810_103114_588933_23DDFF77 X-CRM114-Status: UNSURE ( 6.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Shuah Khan , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Fix exynos_drm_gem_create_ioctl() attempts to allocate non-contiguous GEM memory without IOMMU. In this case, there is no point in attempting to allocate non-contiguous memory, only to return error during the next step from exynos_drm_framebuffer_init() which leads to display manager failing to start. Check if non-contiguous GEM memory is requested without IOMMU. If so, allocate contiguous GEM memory to help display manager start. Signed-off-by: Shuah Khan Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 4c4cb0e..4719116 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -266,6 +266,20 @@ int exynos_drm_gem_create_ioctl(struct drm_device *dev, void *data, struct exynos_drm_gem *exynos_gem; int ret; + /* + * Check if non-contiguous GEM memory is requested without IOMMU. + * If so, allocate contiguous GEM memory. + * + * There is no point in attempting to allocate non-contiguous memory, + * only to return error from exynos_drm_framebuffer_init() which leads + * to display manager failing to start. + */ + if (!is_drm_iommu_supported(dev) && + (args->flags & EXYNOS_BO_NONCONTIG)) { + args->flags &= ~EXYNOS_BO_NONCONTIG; + args->flags |= EXYNOS_BO_CONTIG; + } + exynos_gem = exynos_drm_gem_create(dev, args->flags, args->size); if (IS_ERR(exynos_gem)) return PTR_ERR(exynos_gem);