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,
Benjamin Gaignard <benjamin.gaignard@collabora.com>
Subject: [PATCH v13 4/6] media: verisilicon: AV1: Restore IOMMU context before decoding a frame
Date: Mon, 16 Feb 2026 10:51:36 +0100 [thread overview]
Message-ID: <20260216095144.107356-5-benjamin.gaignard@collabora.com> (raw)
In-Reply-To: <20260216095144.107356-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-02-16 9:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 9:51 [PATCH v13 0/6] Add support for Verisilicon IOMMU used by media Benjamin Gaignard
2026-02-16 9:51 ` [PATCH v13 1/6] dt-bindings: vendor-prefixes: Add Verisilicon Benjamin Gaignard
2026-02-16 9:51 ` [PATCH v13 2/6] dt-bindings: iommu: verisilicon: Add binding for VSI IOMMU Benjamin Gaignard
2026-02-16 9:51 ` [PATCH v13 3/6] iommu: Add verisilicon IOMMU driver Benjamin Gaignard
2026-03-24 15:46 ` Will Deacon
2026-03-24 16:28 ` Benjamin Gaignard
2026-03-25 16:36 ` Will Deacon
2026-02-16 9:51 ` Benjamin Gaignard [this message]
2026-02-16 9:51 ` [PATCH v13 5/6] arm64: dts: rockchip: Add verisilicon IOMMU node on RK3588 Benjamin Gaignard
2026-02-16 9:51 ` [PATCH v13 6/6] arm64: defconfig: enable Verisilicon IOMMU for Rockchip RK3588 Benjamin Gaignard
2026-02-16 15:16 ` Krzysztof Kozlowski
2026-02-16 15:30 ` Benjamin Gaignard
2026-02-16 15:32 ` Krzysztof Kozlowski
2026-02-16 15:33 ` Krzysztof Kozlowski
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=20260216095144.107356-5-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=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