From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
heiko@sntech.de, nicolas.dufresne@collabora.com,
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,
Benjamin Gaignard <benjamin.gaignard@collabora.com>
Subject: [PATCH v11 5/7] media: verisilicon: AV1: Restore IOMMU context before decoding a frame
Date: Wed, 7 Jan 2026 11:09:55 +0100 [thread overview]
Message-ID: <20260107101005.84039-6-benjamin.gaignard@collabora.com> (raw)
In-Reply-To: <20260107101005.84039-1-benjamin.gaignard@collabora.com>
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>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
.../verisilicon/rockchip_vpu981_hw_av1_dec.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
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);
--
2.43.0
next prev parent reply other threads:[~2026-01-07 10:10 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-07 10:09 [PATCH v11 0/7] Add support for Verisilicon IOMMU used by media Benjamin Gaignard
2026-01-07 10:09 ` [PATCH v11 1/7] dt-bindings: vendor-prefixes: Add Verisilicon Benjamin Gaignard
2026-01-07 10:09 ` [PATCH v11 2/7] dt-bindings: iommu: verisilicon: Add binding for VSI IOMMU Benjamin Gaignard
2026-01-07 10:09 ` [PATCH v11 3/7] iommu: Add verisilicon IOMMU driver Benjamin Gaignard
2026-01-13 16:10 ` Will Deacon
2026-01-13 16:25 ` Benjamin Gaignard
2026-01-14 12:59 ` Will Deacon
2026-01-14 13:10 ` Benjamin Gaignard
2026-01-19 12:32 ` Will Deacon
2026-01-19 14:03 ` Benjamin Gaignard
2026-01-21 12:51 ` Will Deacon
2026-01-21 13:50 ` Benjamin Gaignard
2026-01-23 17:14 ` Will Deacon
2026-01-26 9:03 ` Benjamin Gaignard
2026-01-26 14:19 ` Will Deacon
2026-01-26 14:46 ` Benjamin Gaignard
2026-02-16 10:03 ` Benjamin Gaignard
2026-01-18 9:41 ` Jörg Rödel
2026-01-19 7:51 ` Benjamin Gaignard
2026-01-19 8:56 ` Jörg Rödel
2026-01-19 10:28 ` Benjamin Gaignard
2026-01-19 14:06 ` Jörg Rödel
2026-01-07 10:09 ` [PATCH v11 4/7] MAINTAINERS: Add entry for Verisilicon " Benjamin Gaignard
2026-01-07 10:09 ` Benjamin Gaignard [this message]
2026-01-07 10:09 ` [PATCH v11 6/7] arm64: dts: rockchip: Add verisilicon IOMMU node on RK3588 Benjamin Gaignard
2026-01-07 10:09 ` [PATCH v11 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=20260107101005.84039-6-benjamin.gaignard@collabora.com \
--to=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=nicolas.dufresne@collabora.com \
--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