Skip to contentSkip to conversation

media: mx2-emmaprp: return failed buffers on bus errors

PATCH Applied Avi Weiss 2 participants 2 messages Oct 29 – Nov 4 Media (V4L/DVB)

lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 media: mx2-emmaprp: return failed buffers on bus errors

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")

---

 drivers/media/platform/nxp/mx2_emmaprp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/media/platform/nxp/mx2_emmaprp.c +4 -0
index d51a621007788..f957383e8df55 100644
@@ -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

Signature · 1 line
2.43.0
#1 lore raw

From: Frank Li <[email protected]>

Quoted 9 lines · 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.

[...]

Applied, thanks!

[1/1] media: mx2-emmaprp: return failed buffers on bus errors

      commit: 2e0758dcfb305acabbfeb5f38ad1a9f8f874898d

Best regards,

Signature · 1 line
Frank Li <[email protected]>