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

Detlev Casanova
2025-06-19T18:36:18Z

Hi Jianfeng,

This patch set is now a bit outdated. I will soon send a new version that you
can find at [1].
That being said, you may be right. without an iommu, it would panic here
(although the iommu should really be used).

[1]: https://gitlab.collabora.com/detlev/linux/-/tree/add-vdpu381-and-383-to-rkvdec

Regards,
Detlev

On Thursday, 19 June 2025 05:19:32 EDT Jianfeng Liu wrote:
> 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