[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <70d2b73a4ec06bef75d7f4ad415ad654cf80ecf6.camel@collabora.com>
Date: Tue, 06 Jan 2026 15:07:15 -0500
From: Nicolas Dufresne <nicolas.dufresne@...labora.com>
To: Benjamin Gaignard <benjamin.gaignard@...labora.com>, joro@...tes.org,
will@...nel.org, robin.murphy@....com, robh@...nel.org, krzk+dt@...nel.org,
conor+dt@...nel.org, heiko@...ech.de, p.zabel@...gutronix.de,
mchehab@...nel.org
Cc: iommu@...ts.linux.dev, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org, linux-media@...r.kernel.org,
kernel@...labora.com
Subject: Re: [PATCH v10 5/7] media: verisilicon: AV1: Restore IOMMU context
before decoding a frame
Hi,
Le lundi 15 décembre 2025 à 09:53 +0100, Benjamin Gaignard a écrit :
> AV1 is a stateless decoder which means multiple AV1 bitstreams could be
> decoded at the same time using the same hardware block. Before decoding
> a frame it is needed to restore the iommu tables to avoid mixing decode
> contexts.
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...labora.com>
With the config fix you mentioned earlier, you can add my Rb in the next
revision please.
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@...labora.com>
> ---
> changes in version 10:
> - Fix build as module issue when Verisilicon video decoder is built-in.
>
> drivers/media/platform/verisilicon/Kconfig | 1 +
> .../verisilicon/rockchip_vpu981_hw_av1_dec.c | 15 +++++++++++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/drivers/media/platform/verisilicon/Kconfig b/drivers/media/platform/verisilicon/Kconfig
> index 3272a24db71d..e64bc8b55235 100644
> --- a/drivers/media/platform/verisilicon/Kconfig
> +++ b/drivers/media/platform/verisilicon/Kconfig
> @@ -49,6 +49,7 @@ config VIDEO_HANTRO_ROCKCHIP
> bool "Hantro VPU Rockchip support"
> depends on VIDEO_HANTRO
> depends on ARCH_ROCKCHIP || COMPILE_TEST
> + select VSI_IOMMU
> default y
> help
> Enable support for RK3288, RK3328, and RK3399 SoCs.
> diff --git a/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c b/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
> index e4703bb6be7c..d9e68e0ded68 100644
> --- a/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
> +++ b/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
> @@ -5,6 +5,9 @@
> * Author: Benjamin Gaignard <benjamin.gaignard@...labora.com>
> */
>
> +#include <linux/iommu.h>
> +#include <linux/vsi-iommu.h>
> +
> #include <media/v4l2-mem2mem.h>
> #include "hantro.h"
> #include "hantro_v4l2.h"
> @@ -2095,12 +2098,24 @@ rockchip_vpu981_av1_dec_set_output_buffer(struct hantro_ctx *ctx)
> hantro_write_addr(vpu, AV1_TILE_OUT_MV, mv_addr);
> }
>
> +static void rockchip_vpu981_av1_restore_iommu(struct hantro_ctx *ctx)
> +{
> + struct iommu_domain *domain;
> +
> + /* Before decoding any frame iommu context need to be restored */
> + domain = iommu_get_domain_for_dev(ctx->dev->v4l2_dev.dev);
> + if (domain)
> + vsi_iommu_restore_ctx(domain);
> +}
> +
> int rockchip_vpu981_av1_dec_run(struct hantro_ctx *ctx)
> {
> struct hantro_dev *vpu = ctx->dev;
> struct vb2_v4l2_buffer *vb2_src;
> int ret;
>
> + rockchip_vpu981_av1_restore_iommu(ctx);
> +
> hantro_start_prepare_run(ctx);
>
> ret = rockchip_vpu981_av1_dec_prepare_run(ctx);
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists