mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Henry Zhang <henryzhang62@gmail.com>
To: Maxime Ripard <mripard@kernel.org>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: "Henry Zhang" <henryzhang62@gmail.com>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Raspberry Pi Kernel Maintenance" <kernel-list@raspberrypi.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v4 1/5] drm/vc4: dsi: Set the transfer result before completing the transfer
Date: Wed, 28 Oct 2026 09:45:26 -0700	[thread overview]
Message-ID: <20261028164539.3471833-2-henryzhang62@gmail.com> (raw)
In-Reply-To: <20261028164539.3471833-1-henryzhang62@gmail.com>

On an HSTX timeout the interrupt handler completes the transfer and
only then sets xfer_result to -ETIMEDOUT. The waiter, which may run on
another CPU, can wake up and read xfer_result in between, still 0 from
the start of the transfer, and report the timed-out transfer as a
success.

Set xfer_result first. complete() orders the store before the wake-up.

Fixes: 4078f5757144 ("drm/vc4: Add DSI driver")
Signed-off-by: Henry Zhang <henryzhang62@gmail.com>
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 5ed3c35ee..aa2b46fb0 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -1526,8 +1526,8 @@ static irqreturn_t vc4_dsi_irq_handler(int irq, void *data)
 		complete(&dsi->xfer_completion);
 		ret = IRQ_HANDLED;
 	} else if (stat & DSI_PORT_BIT(INT_HSTX_TO)) {
-		complete(&dsi->xfer_completion);
 		dsi->xfer_result = -ETIMEDOUT;
+		complete(&dsi->xfer_completion);
 		ret = IRQ_HANDLED;
 	}
 
-- 
2.47.3


  reply	other threads:[~2026-10-28 16:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 16:45 [PATCH v4 0/5] drm/vc4: dsi: Make failed reads visible and recoverable Henry Zhang
2026-10-28 16:45 ` Henry Zhang [this message]
2026-10-28 16:45 ` [PATCH v4 2/5] drm/vc4: dsi: Don't return error reports as read data Henry Zhang
2026-10-28 16:45 ` [PATCH v4 3/5] drm/vc4: dsi: Rate-limit error interrupt messages Henry Zhang
2026-10-28 16:45 ` [PATCH v4 4/5] drm/vc4: dsi: Serialize host transfers Henry Zhang
2026-10-28 16:45 ` [PATCH v4 5/5] drm/vc4: dsi: Recover from a timed-out transfer Henry Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261028164539.3471833-2-henryzhang62@gmail.com \
    --to=henryzhang62@gmail.com \
    --cc=airlied@gmail.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-list@raspberrypi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mcanal@igalia.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®