Re: [PATCH v4 4/6] media: rockchip: Introduce the rkvdec2 driver

Jianfeng Liu
2025-10-20T11:57:33Z

Hi Detlev,

On Tue, 25 Mar 2025 17:22:20 -0400, Detlev Casanova wrote:

>+        case RKVDEC2_ALLOC_SRAM:
>+            virt_addr = (unsigned long)ctx->rcb_bufs[i].cpu;
>+
>+            iommu_unmap(rkvdec->iommu_domain, virt_addr, rcb_size);

I'm testing your patch with ffmpeg patched with v4l2-request patches[1],
and I usually

get kernel panic here. After checking rkvdec->iommu_domain before
running iommu_unmap,

I can pass fluster ffmpeg v4l2-request test. Here is my patch based on
your commit:

diff --git a/drivers/media/platform/rockchip/rkvdec2/rkvdec2.c
b/drivers/media/platform/rockchip/rkvdec2/rkvdec2.c
index 75768561399..122bcdcebd4 100644
--- a/drivers/media/platform/rockchip/rkvdec2/rkvdec2.c
+++ b/drivers/media/platform/rockchip/rkvdec2/rkvdec2.c
@@ -681,8 +681,8 @@ static void rkvdec2_free_rcb(struct rkvdec2_ctx *ctx)
switch (ctx->rcb_bufs[i].type) {
case RKVDEC2_ALLOC_SRAM:
virt_addr = (unsigned long)ctx->rcb_bufs[i].cpu;
-
-                       iommu_unmap(rkvdec->iommu_domain, virt_addr,
rcb_size);
+                       if (rkvdec->iommu_domain)
+ iommu_unmap(rkvdec->iommu_domain, virt_addr, rcb_size);
gen_pool_free(ctx->dev->sram_pool, virt_addr,
rcb_size);
break;
case RKVDEC2_ALLOC_DMA:

[1] https://github.com/amazingfate/FFmpeg/commits/n6.1.1-new-patches/

Best regards,

Jianfeng