From patchwork Wed Mar 20 13:07:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10861603 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 DE8FC1823 for ; Wed, 20 Mar 2019 13:07:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4C7C299B6 for ; Wed, 20 Mar 2019 13:07:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2FD929BDC; Wed, 20 Mar 2019 13:07:25 +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 2AAEA299B6 for ; Wed, 20 Mar 2019 13:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727760AbfCTNHX (ORCPT ); Wed, 20 Mar 2019 09:07:23 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:58268 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727663AbfCTNHX (ORCPT ); Wed, 20 Mar 2019 09:07:23 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190320130722euoutp02337f312d83444ba3c4ed3f13711e2c01~NrJ5Pf9QZ1589615896euoutp02l; Wed, 20 Mar 2019 13:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190320130722euoutp02337f312d83444ba3c4ed3f13711e2c01~NrJ5Pf9QZ1589615896euoutp02l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553087242; bh=cpYT42EusnvUENfsBe2CbH4a+nZgA0tdO6X2xO+kOvw=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=MVswihdT5tuJAL4AAHyckz+OewXP6Y7jyELq+wd8FBqT6Cht7Qu0lMIfYVeU82Mth IUTXYSzeaD6neGxh0MAokW+TPUd0wWeOGJwISuGAUTUqC3HfyjBrkXfjWXfblbltGy 3/DFjAZc9xmwpO7p7GqEHVD10FynWQqooCXWcziM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190320130722eucas1p1d2425948b06f0a928ffb3cc2e2f4ad99~NrJ4238HK2305023050eucas1p17; Wed, 20 Mar 2019 13:07:22 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id EF.35.04441.90B329C5; Wed, 20 Mar 2019 13:07:21 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190320130721eucas1p2097f22c60919e45a10f9dff6dd678c99~NrJ4OaYPc1479814798eucas1p2X; Wed, 20 Mar 2019 13:07:21 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-bd-5c923b0963f6 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id FA.AF.04284.90B329C5; Wed, 20 Mar 2019 13:07:21 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0POO004P71RZN460@eusync1.samsung.com>; Wed, 20 Mar 2019 13:07:21 +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 v2 RESEND 22/24] drm/exynos/decon5433: wait for finish previous update Date: Wed, 20 Mar 2019 14:07:05 +0100 Message-id: <20190320130707.25161-23-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190320130707.25161-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRmVeSWpSXmKPExsWy7djP87qc1pNiDFpm6FrcWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF12B3aPTas62Tzudx9n8ujbsorR4/MmuQCWKC6b lNSczLLUIn27BK6MvUsXsxd0CVQc2/GPqYHxI28XIyeHhICJxJ1779m7GLk4hARWMEq8WniD CcL5zCix8Mw8Npiqtdt/M0IkljFKvG6fAlX1n1Fi/q8PYFVsApoSfzffBLNFBJQlVu1rB5vL LPCbUWL68m3sIAlhgQiJbxe2MoPYLAKqEssOLGAFsXkFLCUuPNnGCrFOXmL1hgNgNZxA8Ydz /oMNkhBoZJNouLcGqshF4tOmFmYIW0ais+MgE4RdL3F/BUgcpKGDUWLrhp1QRdYSh49fBGtm FuCTmLRtOlCcAyjOK9HRJgRR4iFxcdddVojXehglnjxYwzKBUWIBI8MqRvHU0uLc9NRiw7zU cr3ixNzi0rx0veT83E2MwBg7/e/4px2MXy8lHWIU4GBU4uFteDMhRog1say4MvcQowQHs5II b4TSpBgh3pTEyqrUovz4otKc1OJDjNIcLErivNUMD6KFBNITS1KzU1MLUotgskwcnFINjMGC 1qXyjA3560O+8bxVXvTnXPZ5b90nN+Z/rhCrM7f0ZQtdMo1TmNs2L/kVa+M+L4bXP7NlFore 8L8qv/Xai89rlcv99ugESs8NbKjtmt1ya23CvS3rJAt/8y5SzkxwExD9cp+9TvPLEuYjKa6d azxflMYpzDj9ujTkmMinFyVTW50nH3c8qMRSnJFoqMVcVJwIAGEp/aatAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmluLIzCtJLcpLzFFi42I5/e/4ZV1O60kxBnee81vcWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF12B3aPTas62Tzudx9n8ujbsorR4/MmuQCWKC6b lNSczLLUIn27BK6MvUsXsxd0CVQc2/GPqYHxI28XIyeHhICJxNrtvxm7GLk4hASWMEo8+LWW HcJpZJKYe/IFM0gVm4CmxN/NN9lAbBEBZYlV+9rBipgFfjNKfJ7xFaxIWCBCYs/CDiYQm0VA VWLZgQWsIDavgKXEhSfbWCHWyUus3nAArJ4TKP5wzn92EFtIwEJi8Ym7jBMYeRYwMqxiFEkt Lc5Nzy021CtOzC0uzUvXS87P3cQIDJptx35u3sF4aWPwIUYBDkYlHt6KpxNihFgTy4orcw8x SnAwK4nwRihNihHiTUmsrEotyo8vKs1JLT7EKM3BoiTOe96gMkpIID2xJDU7NbUgtQgmy8TB KdXAqK21V+lV47U6rTyhux1aIW/djyXOvXy1P/fBt0MfLyiu/xwRuHrXkmkKileN2r1t3Gf2 Xf7/+O9xW/WppxJW71x4+sFXvlNd29UOBX0z/R1k+vv+za6+c0KTEpus3x1irt/2Our/rNvx 9f/PPPledMcvuNrdf8t7zwuVV58KsZ3O8LC+abDINUeJpTgj0VCLuag4EQBVRjIFFgIAAA== X-CMS-MailID: 20190320130721eucas1p2097f22c60919e45a10f9dff6dd678c99 CMS-TYPE: 201P X-CMS-RootMailID: 20190320130721eucas1p2097f22c60919e45a10f9dff6dd678c99 References: <20190320130707.25161-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);