From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A84ACAC587 for ; Thu, 11 Sep 2025 15:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cA4lRUteTcb9WjksIlGCZiugEHvfpFwo6Ak9+91ImX0=; b=Hoo4Xflxesey6W P9Lo9o5JMACl2V56SgDw4itF3lqk3r/MWBDOR+ejV6wYawh1agsT0I8RbK8bWlPPBpj9MmTjh5VWq jYhtfSHMdOLBFxRxvdAlRI4cGib31dYArudjMTxEVaYPCsDYMp3Nuswlyfc/RJNuX3c9/NNDg+Xl+ pjUpeD3dyrjv/7yC1k6zgRDppPfnXEItVeSnL3/5FvHC0f8s8OiGYrh2O5e9GwntkWIG6P+XEyvMM pJDnRH4PCWglXrisP9dDwIDmxLpmAUTO3cLPTCN2VsiLF2n2fKJtB1medAS6r1C+2VBKwRSiTWevN Dpncus12t9iL0cYcXkvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uwjgD-000000042YU-02MT; Thu, 11 Sep 2025 15:57:49 +0000 Received: from bali.collaboradmins.com ([148.251.105.195]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uwjfx-000000042B6-24J5; Thu, 11 Sep 2025 15:57:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1757606249; bh=b1HZDQqQsYr58FY+10TUUiHUY+LFzqNmIFdIpqRJYYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZI4sMszkrwaBn1LN54d6++i9mLnDvATVaOA/bFz3+q4DhlpXWT1SfYe3i8yycDWcF DJprBk24SkM3bk/zG2t9tOGxw0F4rSa+cictkNeFzh4SccsUbp8qzVxT2DZb1rZTvb cWyN9nXha/SoKhj0hQzAJoK6WiMdlW77oKR+i/Cq/pmKUeeAKjGYuY7p31NuJRZ1v2 SKjWLc4fD4d16N1cwOGJ7GD436YiYmVdrs3A0PYFog9A/OdphQ49IzpJu8K9F8yXKV tdqDfPcrpXrWbtnhv2Pxy66Wb9qv6GJlRpIql/oG8iTctsuRfq3Knx2VOd5jHhQE3T kE4wC3rrM/g0g== Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:36e5:357f:56a7:54dd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by bali.collaboradmins.com (Postfix) with ESMTPSA id 3873A17E1287; Thu, 11 Sep 2025 17:57:29 +0200 (CEST) From: Benjamin Gaignard To: joro@8bytes.org, robin.murphy@arm.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, heiko@sntech.de, nicolas.dufresne@collabora.com, jgg@ziepe.ca, 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, kernel@collabora.com, linux-media@vger.kernel.org, Benjamin Gaignard Subject: [PATCH v9 5/7] media: verisilicon: AV1: Restore IOMMU context before decoding a frame Date: Thu, 11 Sep 2025 17:57:15 +0200 Message-ID: <20250911155720.180465-6-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250911155720.180465-1-benjamin.gaignard@collabora.com> References: <20250911155720.180465-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250911_085733_729782_6C25F122 X-CRM114-Status: GOOD ( 11.04 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org 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 --- .../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 */ +#include +#include + #include #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 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip