From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Benjamin Gaignard <benjamin.gaignard@collabora.com>,
joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
heiko@sntech.de, p.zabel@pengutronix.de, mchehab@kernel.org
Cc: iommu@lists.linux.dev, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-media@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH v10 5/7] media: verisilicon: AV1: Restore IOMMU context before decoding a frame
Date: Tue, 06 Jan 2026 15:07:15 -0500 [thread overview]
Message-ID: <70d2b73a4ec06bef75d7f4ad415ad654cf80ecf6.camel@collabora.com> (raw)
In-Reply-To: <20251215085349.10155-6-benjamin.gaignard@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 2783 bytes --]
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@collabora.com>
With the config fix you mentioned earlier, you can add my Rb in the next
revision please.
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.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@collabora.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);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-01-06 20:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 8:53 [PATCH v10 0/7] Add support for Verisilicon IOMMU used by media Benjamin Gaignard
2025-12-15 8:53 ` [PATCH v10 1/7] dt-bindings: vendor-prefixes: Add Verisilicon Benjamin Gaignard
2025-12-15 8:53 ` [PATCH v10 2/7] dt-bindings: iommu: verisilicon: Add binding for VSI IOMMU Benjamin Gaignard
2025-12-15 8:53 ` [PATCH v10 3/7] iommu: Add verisilicon IOMMU driver Benjamin Gaignard
2025-12-15 8:53 ` [PATCH v10 4/7] MAINTAINERS: Add entry for Verisilicon " Benjamin Gaignard
2025-12-15 8:53 ` [PATCH v10 5/7] media: verisilicon: AV1: Restore IOMMU context before decoding a frame Benjamin Gaignard
2025-12-16 15:27 ` kernel test robot
2025-12-17 9:01 ` Benjamin Gaignard
2025-12-22 15:32 ` kernel test robot
2026-01-06 20:07 ` Nicolas Dufresne [this message]
2025-12-15 8:53 ` [PATCH v10 6/7] arm64: dts: rockchip: Add verisilicon IOMMU node on RK3588 Benjamin Gaignard
2025-12-15 8:53 ` [PATCH v10 7/7] arm64: defconfig: enable Verisilicon IOMMU for Rockchip RK3588 Benjamin Gaignard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=70d2b73a4ec06bef75d7f4ad415ad654cf80ecf6.camel@collabora.com \
--to=nicolas.dufresne@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox