Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18A4BC11F66 for ; Wed, 30 Jun 2021 22:50:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB50E60233 for ; Wed, 30 Jun 2021 22:50:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB50E60233 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37B156EA8D; Wed, 30 Jun 2021 22:50:07 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5B536EA8D for ; Wed, 30 Jun 2021 22:50:05 +0000 (UTC) Received: from [IPv6:::1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id ED415831D4; Thu, 1 Jul 2021 00:50:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1625093404; bh=KfQ+uHNpsb8lWq1hgu1r0YZFfD57+v51UOgAiCNdoT4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=gvwSQybH1XQpwqFqdBNhQdsNRJOofXILRds4lYUMbDd4MzE28RGaNWRibS0C2NXt9 Bt7V/ri06tNh3Uaw29lk1zXGA4foiz+kBVtBVd27nl26MKnkJpKQkgH+EUO/6APHYK vf/Q+byGBCwegNH/kD0BTxEAdQJu2huCEdOJwCfJrmA5lZfvOeTCzKViy/6dMlKHiI +iV3vNlAGusGH53Si2v47W04GyrYSAM/SzuvkxfYDLsReZgaQaO0f4jxYk0GF37E17 4syxeH0YmvqMV0I29aww4EzETQQ+A4Ix46QSmolp6pikwq6FODcm8c/2AJtD00tPcn exjuibIzO7P0g== Subject: Re: [PATCH] drm: mxsfb: Clear FIFO_CLEAR bit To: Lucas Stach , dri-devel@lists.freedesktop.org References: <20210620224946.189524-1-marex@denx.de> <85372867-2b5b-e97f-aa04-ed976db1eddb@denx.de> <07f58c1181e2e66277d0355055ff794fb091991d.camel@pengutronix.de> <6e1b79de-d748-000c-fd47-72ff7c265d9c@denx.de> From: Marek Vasut Message-ID: <6ec45690-e85b-b267-b189-ee54de673692@denx.de> Date: Thu, 1 Jul 2021 00:50:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Abrecht , Emil Velikov , ch@denx.de, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 6/29/21 10:02 AM, Lucas Stach wrote: > Am Dienstag, dem 29.06.2021 um 05:04 +0200 schrieb Marek Vasut: >> On 6/28/21 10:09 AM, Lucas Stach wrote: >>> Am Samstag, dem 26.06.2021 um 20:15 +0200 schrieb Marek Vasut: >>>> On 6/24/21 2:01 PM, Lucas Stach wrote: >>>>> Am Dienstag, dem 22.06.2021 um 11:33 +0200 schrieb Marek Vasut: >>>>>> On 6/22/21 9:28 AM, Lucas Stach wrote: >>>>>>> Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut: >>>>>>>> On 6/21/21 2:14 PM, Lucas Stach wrote: >>>>>>>> >>>>>>>> [...] >>>>>>>> >>>>>>>>>> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c >>>>>>>>>> index 98d8ba0bae84..22cb749fc9bc 100644 >>>>>>>>>> --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c >>>>>>>>>> +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c >>>>>>>>>> @@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, >>>>>>>>>> >>>>>>>>>> /* Clear the FIFOs */ >>>>>>>>>> writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET); >>>>>>>>>> + readl(mxsfb->base + LCDC_CTRL1); >>>>>>>>> >>>>>>>>> Do you really need those readbacks? As both writes are targeting the >>>>>>>>> same slave interface, the memory barrier in the clear write should push >>>>>>>>> the set write. >>>>>>>> >>>>>>>> What would push the clear write then ? We can drop one of the readl()s, >>>>>>>> but not the last one. >>>>>>> >>>>>>> There are a lot of more writes with barriers to the controller slave >>>>>>> interface in that function after clearing the FIFO. I don't see why >>>>>>> this readback would be required. >>>>>> >>>>>> Because you really do want to make sure the fifo is cleared before you >>>>>> start doing any of those other writes or configuring the controller in >>>>>> any way. >>>>> >>>>> I still don't see the reason. What additional properties do you think >>>>> the readback provides that isn't already provided by the barriers in >>>>> the following writes? >>>> >>>> See the paragraph above -- we have to make sure the writes that trigger >>>> the FIFO clearing really take place before any other writes do. >>> >>> And they do, as there are write barriers prepended to the writes >>> following the FIFO clear. The readback just lets the CPU wait until the >>> write reached the peripheral, which I don't see a reason to do here. >>> The ordering of the writes from the perspective of the peripheral is >>> completely the same with or without the readback. The later writes can >>> not overtake the FIFO clear writes due to the barriers. >>> >>> I'm strongly against adding stuff because it "might have an effect", if >>> it isn't required by architectural rules. It clutters the code and some >>> months/years down the line nobody dares to cleanup/remove this stuff >>> anymore, because everyone assumes that there was a good reason for >>> adding those things. >> >> Since there is no RTL for any of the iMXes or their IPs, how do you >> propose anyone except NXP can validate what is and what is not required ? >> >> This patch helps with a problem where I sporadically observe shifted >> image on boot on mx8mm. > > The order of writes to a device mapped region are defined by the ARM > architecture and the AMBA bus standard, not the peripheral. I'm not > saying this patch isn't needed. I'm saying the readbacks look bogus. > > Have you checked that just adding the write to the REG_CLR doesn't fix > your issue? No, it does not help with the issue.