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: 9276951 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 E323160CDC for ; Fri, 12 Aug 2016 13:14:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5349289EB for ; Fri, 12 Aug 2016 13:14:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA1DA289ED; Fri, 12 Aug 2016 13:14:43 +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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 54F5B289EC for ; Fri, 12 Aug 2016 13:14:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DC146EB6B; Fri, 12 Aug 2016 13:14:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from resqmta-po-10v.sys.comcast.net (resqmta-po-10v.sys.comcast.net [96.114.154.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id B70E76E80F for ; Wed, 10 Aug 2016 17:31:54 +0000 (UTC) Received: from resomta-po-11v.sys.comcast.net ([96.114.154.235]) by resqmta-po-10v.sys.comcast.net with SMTP id XXLBbYP2zHqolXXLBb0sSB; 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-Mailman-Approved-At: Fri, 12 Aug 2016 13:13:55 +0000 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 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" 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);