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 1/2] drm/vc4: dsi: Don't return error reports as read data
Date: Mon, 12 Oct 2026 12:02:42 -0700 [thread overview]
Message-ID: <20261012190249.3167-2-henryzhang62@gmail.com> (raw)
In-Reply-To: <20261012190249.3167-1-henryzhang62@gmail.com>
When a DSI peripheral detects an error, for example contention during
the bus turnaround, it may answer a read request with an Acknowledge
and Error Report short packet instead of the read response.
vc4_dsi_host_transfer() does not check the type of the received packet
(there is a FINISHME for it). It copies the two bytes of the error
report into the caller's buffer and returns success, so the caller
gets the error bits as if they were register contents. Packets
received with a checksum error, an uncorrectable ECC error or
incomplete are passed on the same way.
Return -EIO in these cases so that callers can tell a failed read from
data, and retry if they want to.
Signed-off-by: Henry Zhang <henryzhang62@gmail.com>
---
drivers/gpu/drm/vc4/vc4_dsi.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 0148f2b..c092a1a 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -40,6 +40,8 @@
#include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
+#include <video/mipi_display.h>
+
#include "vc4_drv.h"
#include "vc4_regs.h"
@@ -1300,6 +1302,24 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host,
u32 rxpkt1h = DSI_PORT_READ(RXPKT1H);
u8 *msg_rx = msg->rx_buf;
+ /*
+ * A peripheral that detected an error, e.g. contention during
+ * the bus turnaround, may answer with an Acknowledge and Error
+ * Report instead of the read response. Don't hand that, or a
+ * packet received with errors, to the caller as read data.
+ * Bits 7:6 of the Data ID are the virtual channel.
+ */
+ if ((rxpkt1h & (DSI_RXPKT1H_CRC_ERR | DSI_RXPKT1H_DET_ERR |
+ DSI_RXPKT1H_INCOMP_PKT)) ||
+ (!(rxpkt1h & DSI_RXPKT1H_PKT_TYPE_LONG) &&
+ (VC4_GET_FIELD(rxpkt1h, DSI_RXPKT1H_DT_LP_CMD) & 0x3f) ==
+ MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT)) {
+ drm_dbg_driver(drm, "DSI read rejected, RXPKT1H 0x%08x\n",
+ rxpkt1h);
+ ret = -EIO;
+ goto reset_fifo_and_return;
+ }
+
if (rxpkt1h & DSI_RXPKT1H_PKT_TYPE_LONG) {
u32 rxlen = VC4_GET_FIELD(rxpkt1h,
DSI_RXPKT1H_BC_PARAM);
@@ -1314,8 +1334,6 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host,
for (i = 0; i < msg->rx_len; i++)
msg_rx[i] = DSI_READ(DSI1_RXPKT_FIFO);
} else {
- /* FINISHME: Handle AWER */
-
msg_rx[0] = VC4_GET_FIELD(rxpkt1h,
DSI_RXPKT1H_SHORT_0);
if (msg->rx_len > 1) {
--
2.47.3
next prev parent reply other threads:[~2026-10-12 19:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 19:02 [PATCH 0/2] drm/vc4: dsi: Make failed reads visible and recoverable Henry Zhang
2026-10-12 19:02 ` Henry Zhang [this message]
2026-10-12 19:02 ` [PATCH 2/2] 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=20261012190249.3167-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®