From patchwork Mon Mar 25 07:13:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10868049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE57414DE for ; Mon, 25 Mar 2019 07:14:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5EF629255 for ; Mon, 25 Mar 2019 07:14:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AC0029258; Mon, 25 Mar 2019 07:14:05 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4071D29257 for ; Mon, 25 Mar 2019 07:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729822AbfCYHOE (ORCPT ); Mon, 25 Mar 2019 03:14:04 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:41968 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729800AbfCYHOE (ORCPT ); Mon, 25 Mar 2019 03:14:04 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190325071403euoutp01c4110838d7c65524dffe3243c43c5768~PIj1hE7CY0752607526euoutp01Q; Mon, 25 Mar 2019 07:14:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190325071403euoutp01c4110838d7c65524dffe3243c43c5768~PIj1hE7CY0752607526euoutp01Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553498043; bh=cpYT42EusnvUENfsBe2CbH4a+nZgA0tdO6X2xO+kOvw=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=aMw8dsPznmNuPu41JyRAN3Db7c/5MUMa6YA1ZHC8NnCAggWveg4AsmPK0SCK+lPKO 0RZwY8S8L2QSZecS9w8u6GhXRJHiPl1x00DB3uThlQMqtw/LlaCYiKNKkuQ0mhcaRX MQRW48FxOGY7Eoih3o4POjS6V4pw9ACs9qJIWdf8= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190325071403eucas1p18e02726ab0fbe405bf21721f8a7c4d03~PIj1ItzRl3105331053eucas1p1H; Mon, 25 Mar 2019 07:14:03 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id E4.6E.04298.ABF789C5; Mon, 25 Mar 2019 07:14:02 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190325071402eucas1p12176421bacd4f9bcf9341bc776044c56~PIj0cSFfj2091720917eucas1p1d; Mon, 25 Mar 2019 07:14:02 +0000 (GMT) X-AuditID: cbfec7f2-f13ff700000010ca-cb-5c987fbaa0be Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 63.29.04140.ABF789C5; Mon, 25 Mar 2019 07:14:02 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.51.74]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0POW003QHUR43P00@eusync3.samsung.com>; Mon, 25 Mar 2019 07:14:02 +0000 (GMT) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v3 RESEND 22/24] drm/exynos/decon5433: wait for finish previous update Date: Mon, 25 Mar 2019 08:13:47 +0100 Message-id: <20190325071349.22600-23-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190325071349.22600-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRmVeSWpSXmKPExsWy7djP87q76mfEGMzeb2Rxa905VouNM9az Wlz5+p7NYtL9CSwW589vYLeYcX4fk8XaI3fZHdg9Nq3qZPO4332cyaNvyypGj8+b5AJYorhs UlJzMstSi/TtErgy9i5dzF7QJVBxbMc/pgbGj7xdjBwcEgImEvN/RncxcnEICaxglLj5oJEJ wvnMKHHl3SfWLkZOsKKr2ztZIBLLGCWmX77IDuH8Z5Q4tqEVrIpNQFPi7+abbCC2iICyxKp9 7WBFzAK/gTqWb2MHSQgLREh0ruxgBrFZBFQlVi1bxwJi8wpYSrRe+MUGsU5eYvWGA2A1nEDx /6cvMYMMkhD4yypxtnUlE0SRi8SqpxuhGmQkLk/uZoGw6yXur2iBauhglNi6YSczRMJa4vDx i2CnMgvwSUzaNp0ZEgK8Eh1tQhCmh8TGyxogFUICPYwSM65XTGCUWMDIsIpRPLW0ODc9tdgw L7Vcrzgxt7g0L10vOT93EyMwuk7/O/5pB+PXS0mHGAU4GJV4eF/snB4jxJpYVlyZe4hRgoNZ SYT3ieiMGCHelMTKqtSi/Pii0pzU4kOM0hwsSuK81QwPooUE0hNLUrNTUwtSi2CyTBycUg2M C6LWLRbt4Wq+NF0s+/NCibdZ7Tz5NqW/F/qy6R1tmjFv/eok52PFCouWcV2dVuVWd8Px+p1U c+UKhXniKSaGi37nPWlyDLwpWL7l4I+D00omHH+eY+K9nEMk8feH05Zn5muK2/EWBt2z2PT9 jJjC6ud/1xnf3KF+8aqaMveVl5vzHac/dE6qVmIpzkg01GIuKk4EADXT7ZGqAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpiluLIzCtJLcpLzFFi42I5/e/4Vd1d9TNiDDY1C1ncWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF12B3aPTas62Tzudx9n8ujbsorR4/MmuQCWKC6b lNSczLLUIn27BK6MvUsXsxd0CVQc2/GPqYHxI28XIyeHhICJxNXtnSwgtpDAEkaJPYu4uhi5 gOxGJomPrS2sIAk2AU2Jv5tvsoHYIgLKEqv2tbODFDEL/GaU+DzjKzNIQlggQuLY4XYmEJtF QFVi1bJ1YFN5BSwlWi/8YoPYJi+xesMBsHpOoPj/05eYITZbSOxd1sg+gZFnASPDKkaR1NLi 3PTcYiO94sTc4tK8dL3k/NxNjMCQ2Xbs55YdjF3vgg8xCnAwKvHwOuyZHiPEmlhWXJl7iFGC g1lJhPeJ6IwYId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rznDSqjhATSE0tSs1NTC1KLYLJMHJxS DYxthfti2CbKW/11FDrL9/b9rxbdhXlXK/L8eT4VTNrJtyDituXUyy2ftvrdir69fT3LqRkz lS4sYkn//fWnx/TdDbOn2T77szX8sOXL9bELjno/y+Ntubj+b/MEjxdlV3i5/p58epo1j/fh pptNp2+q7tcwZQyYtX7J5EmnbgpO7at+s+il8PY9tkosxRmJhlrMRcWJACwS91gVAgAA X-CMS-MailID: 20190325071402eucas1p12176421bacd4f9bcf9341bc776044c56 CMS-TYPE: 201P X-CMS-RootMailID: 20190325071402eucas1p12176421bacd4f9bcf9341bc776044c56 References: <20190325071349.22600-1-a.hajda@samsung.com> 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 DECON should wait for previous update before starting new one. Otherwise internal registers can be updated in non-atomic, error prone way. This patch fixes occasional occurrences of vblank timeouts on tm2 platform: [ 3167.968742] [CRTC:55:crtc-0] vblank wait timed out [ 3167.987440] WARNING: CPU: 1 PID: 194 at ../drivers/gpu/drm/drm_atomic_helper.c:1423 drm_atomic_helper_wait_for_vblanks.part.9+0x2c0/0x2c8 [ 3168.029990] Modules linked in: [ 3168.047240] CPU: 1 PID: 194 Comm: modetest Tainted: G W 5.0.0-rc1+ #694 [ 3168.069539] Hardware name: Samsung TM2 board (DT) ... [ 3168.453566] Call trace: [ 3168.469705] drm_atomic_helper_wait_for_vblanks.part.9+0x2c0/0x2c8 [ 3168.489983] drm_atomic_helper_commit_tail_rpm+0x60/0x78 [ 3168.509463] commit_tail+0x44/0x78 [ 3168.527053] drm_atomic_helper_commit+0xe8/0x160 [ 3168.546010] drm_atomic_commit+0x48/0x58 [ 3168.564304] drm_atomic_helper_update_plane+0x11c/0x140 [ 3168.584080] __setplane_atomic+0x130/0x150 [ 3168.602799] setplane_internal+0xb0/0x1a8 [ 3168.621493] drm_mode_setplane+0xc4/0x1b8 [ 3168.640219] drm_ioctl_kernel+0x94/0x110 [ 3168.658920] drm_ioctl+0x1c8/0x428 ... Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index b0332763594e..09f035f52444 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -406,6 +406,11 @@ static void decon_set_gscl_mode(struct decon_context *ctx) static void decon_atomic_begin(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = to_decon(crtc); + u32 val; + + /* wait for finish previous updates */ + if (readl_poll_timeout(ctx->addr + DECON_UPDATE, val, !val, 1000, 20000) < 0) + dev_err(ctx->dev, "DECON_UPDATE timeout\n"); decon_shadow_protect(ctx, true); decon_set_gscl_mode(ctx);