mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: mx2-emmaprp: return failed buffers on bus errors
@ 2026-10-29 14:49 Avi Weiss
  0 siblings, 0 replies; only message in thread
From: Avi Weiss @ 2026-10-29 14:49 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linux-media, Hans Verkuil, Nicolas Dufresne, Javier Martin,
	Sylwester Nawrocki, linux-kernel, Avi Weiss

emmaprp_irq() resets the PrP engine on a read or channel-2 write
bus error but leaves the source and destination buffers queued.
v4l2_m2m_job_finish() releases the job without returning either
buffer, allowing the same pair to be scheduled again.

Complete both buffers with VB2_BUF_STATE_ERROR before finishing
the job so userspace can dequeue the failed pair.

Fixes: 8091cb7d9ce6 ("[media] MEM2MEM: Add support for eMMa-PrP mem2mem operations")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---

 drivers/media/platform/nxp/mx2_emmaprp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/nxp/mx2_emmaprp.c b/drivers/media/platform/nxp/mx2_emmaprp.c
index d51a621007788..f957383e8df55 100644
--- a/drivers/media/platform/nxp/mx2_emmaprp.c
+++ b/drivers/media/platform/nxp/mx2_emmaprp.c
@@ -354,6 +354,10 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data)
 		(irqst & PRP_INTR_ST_CH2WERR)) {
 			pr_err("PrP bus error occurred, this transfer is probably corrupted\n");
 			writel(PRP_CNTL_SWRST, pcdev->base_emma + PRP_CNTL);
+			v4l2_m2m_buf_done_and_job_finish(pcdev->m2m_dev,
+							 curr_ctx->fh.m2m_ctx,
+							 VB2_BUF_STATE_ERROR);
+			return IRQ_HANDLED;
 		} else if (irqst & PRP_INTR_ST_CH2B1CI) { /* buffer ready */
 			src_vb = v4l2_m2m_src_buf_remove(curr_ctx->fh.m2m_ctx);
 			dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx);

base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-29 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 14:49 [PATCH] media: mx2-emmaprp: return failed buffers on bus errors Avi Weiss

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®