From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6AA9606A32C for ; Sun, 22 Nov 2026 15:10:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QyKXk+v3; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=dWk5wVF+ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=vZeJ151erQY6V166IfiHzHXqBCEL5A2S1Gcx7AJ03+s=; b=QyKXk+v3xtcapJD8xCHZSW/WLz BpKRNJYdhHuoo8RpB0RIVjb1G6Kotqlb0uGlCI8WGn22xa9SBcGBLbx/Br6X3OCB4p+h9tPPABDZp MKxHw2XCh55j16+Yt53Gm1aPRgUf6wFQLqoCRitq4x5/2CIC6comf0Gnedsjr4FQVUXwJokj8Q83X bSGpHY6kAKIEGI28YR6m+IfUqundclcLLgdZwTuFNoC/TlsZXAkSUobq2feBRbsHKBu6P4iMzVeq2 4xZsWS5NbdRMwp0Nub+lug9TlWdyiV5ngCJDnJ7y7vsEB6RjrL8n4HA+XD7grJRzfScqoNOGw8+76 vBeXz6MA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xV9CW-00000001EwL-160M; Sun, 22 Nov 2026 15:09:56 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xV9CS-00000001Evy-2hNC; Sun, 22 Nov 2026 15:09:54 +0000 Received: from killaraus.ideasonboard.com (2001-14ba-7086-3000--a06.rev.dnainternet.fi [IPv6:2001:14ba:7086:3000::a06]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4F6BF177; Sun, 22 Nov 2026 16:07:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795360038; bh=IMRAy5bUasbpD/Tw7zcQxXeVbhBdEkFoZeMY9+96wKQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dWk5wVF+6fLHQBBzxh8b2SS8ij5qaN6OUs6mMgqr5B56aWY/s8wpt4WGX6K5RokYX YetOQSn/qU3V41NW6+zsFVBBquu+Wf2EV61tExw2fhKOBFkLcWcAUeoPycSmgCVhy7 dM165WjS6P2F6oQMPZOEbbMXDZ5ydXwQnm5mmVkQ= Date: Sun, 22 Nov 2026 17:09:48 +0200 From: Laurent Pinchart To: Sebastian Reichel Cc: Sandy Huang , Heiko =?utf-8?Q?St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Rob Herring , Krzysztof Kozlowski , Conor Dooley , David Airlie , Simona Vetter , Dmitry Baryshkov , Luca Ceresoli , Philipp Zabel , Cristian Ciocaltea , Damon Ding , Dmitry Baryshkov , Alexey Charkov , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-arm-kernel@lists.infradead.org, Sashiko , Igor Paunovic Subject: Re: [PATCH v12 06/23] drm/bridge: synopsys: dw-dp: Fix AUX transfer timeout race condition Message-ID: <20261122150948.GA2881876@killaraus.ideasonboard.com> References: <20261114-synopsys-dw-dp-improvements-v12-0-d42d3dc5bdd4@collabora.com> <20261114-synopsys-dw-dp-improvements-v12-6-d42d3dc5bdd4@collabora.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261114-synopsys-dw-dp-improvements-v12-6-d42d3dc5bdd4@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261122_070953_172559_DAE3C5EE X-CRM114-Status: GOOD ( 23.85 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Sat, Nov 14, 2026 at 06:00:39AM +0100, Sebastian Reichel wrote: > The DP AUX transfer method uses a completion triggered by an interrupt, > which can timeout. If the function runs into the timeout and the > interrupt fires afterwards, the following DP aux transfer completion > would trigger immediately without waiting for the interrupt. This in > turn means the next one would also be broken and so on. > > Fix this potential issue by re-initializing the completion directly > before sending the AUX command. > > As this is racy (the interrupt might arrive between the completion > re-init and the new command being programmed), also reset the AUX > controller on timeouts and synchronize pending interrupts to guarantee > that there are no pending AUX transfers when the dw_dp_aux_transfer() > returns. > > Due to lack of a sink, which generates AUX timeouts, this change is > effectively untested. > > Reported-by: Sashiko > Fixes: 86eecc3a9c2e ("drm/bridge: synopsys: Add DW DPTX Controller support library") > Tested-by: Igor Paunovic # Orange Pi 5+ > Signed-off-by: Sebastian Reichel > --- > drivers/gpu/drm/bridge/synopsys/dw-dp.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c > index 7351b70bdac9..df0b98cbbaab 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c > @@ -1465,6 +1465,8 @@ static ssize_t dw_dp_aux_transfer(struct drm_dp_aux *aux, > if (WARN_ON(msg->size > 16)) > return -E2BIG; > > + reinit_completion(&dp->complete); > + > switch (msg->request & ~DP_AUX_I2C_MOT) { > case DP_AUX_NATIVE_WRITE: > case DP_AUX_I2C_WRITE: > @@ -1491,6 +1493,12 @@ static ssize_t dw_dp_aux_transfer(struct drm_dp_aux *aux, > status = wait_for_completion_timeout(&dp->complete, timeout); > if (!status) { > dev_err(dp->dev, "timeout waiting for AUX reply\n"); > + regmap_update_bits(dp->regmap, DW_DP_SOFT_RESET_CTRL, > + AUX_RESET, FIELD_PREP(AUX_RESET, 1)); As this is just one bit, I'd find regmap_update_bits(dp->regmap, DW_DP_SOFT_RESET_CTRL, AUX_RESET, AUX_RESET); more readable. Same below with s/AUX_RESET);/);0/. Up to you. > + usleep_range(10, 20); fsleep() uses udelay() for delays up to 10µs included. Is there a particular reason to sleep ? Please also document somewhere (the commit message is fine) where the value of the delay comes from. > + regmap_update_bits(dp->regmap, DW_DP_SOFT_RESET_CTRL, > + AUX_RESET, FIELD_PREP(AUX_RESET, 0)); > + synchronize_irq(dp->irq); > return -ETIMEDOUT; > } > -- Regards, Laurent Pinchart