From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB09B606A31F for ; Sun, 6 Dec 2026 07:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=uCjmSovX; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YCrA1oQL 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:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References: Message-Id:MIME-Version:Subject:Date:From:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=vhh1cTTFsXnJUerTtr5Ljd/jC4tmtOSaleTuVgrHl7k=; b=uCjmSovXtTvqRn3CARL0gSso5U JxcvxOrvoUZd6eKfBcZ4GGe3NfKVCpzzAQ3IMFt1H7sJrkSV6sl7CiPbhKzT+AITuBUGsCiZEh/gz o588ZyzX8HvoOhTZsCAWtBXxiig4qIg9t+cAHR3PxdPkUoV7pY4dry4N7mBTBGdlZxdYjciFcXHTs p3oUGx+vJEFSt8uHHCqf/CYnlycQnfSeSJWspH1dY9Cz29q0QwCpNYh+ecb4KMIfd4tYd7f2yplVP Kp3GXLzhlsuHqb4SvYJekgHphqfY8K+QdDYuB/xGHo3jfWwhO0bk4oQNd85HePAbWUo4fETkcFng/ HxNDMo6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xa6EW-00000003LQF-27MN; Sun, 06 Dec 2026 07:00:28 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xa6EQ-00000003LOg-0WmP; Sun, 06 Dec 2026 07:00:23 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 340936117F; Sun, 6 Dec 2026 07:00:21 +0000 (UTC) Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796540420; b=psYpUv7scJeDlK9OVCRdyckbGZ1pUVefmPzES601KkraZeR9WU6vu1QsoWndlyHVNis2 WxV6QG67z1fgBzKUH1VAUex2bG/cE4rG0+pz6B1nolITXMYtUgcbu5QmzmiMg7JO4rfSk uTrK6JaP7jUD+Z2toGjKedQrimaulbYl5Xn/Py25Ffx8yinRoJml2/W6L5rtRQdD4UDXw au9kbzPK12gAhiYTQQpMBXJmcvkn9dkVlUuPEcxPsWn5Smgkqygy/Pm3yIwa66WE5OYOj y6FKK8yKybOo+l/5Nf1WOgYcpbZ9KqLFPXD3xMCPQm2pmz7DkkU3/UaLwB33q/nIIuw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796540420; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=jP/hVsL32Itc1BhVw7i16KSMxmEZIsxtSrA7hZFPo1g=; b=kY6H1NG5d0j5W/mdsDgI9xkx3r9imMJKRDn4U+AHjIfg3RSPbbvYkBZx+za7JOmLCyls YxhGb/I+q6dhA3e9zAh9Bxboaa1nPEcjq9Y3y3A7l3BjXi466QPy3rgmSDr+Uc62dbNAc 79FNTUZ5tI9Ns7hTDeJzsQYuv/rXAyZizwBDtkVJEScrQg3+Y53eWsd/65LzpKLHHeS/D 2yaAcR6l4IQPJhN7uwIw1B/HNx8f7ESwU5mNwN53QxYj/ifigPAaASPbGEc5gWV2a7wQc QXGmxmcGNRKHP0ADup2bpDWAA5SKsVuHhrtjfM3KWyBh+3Y4ljcXmaJMZHe1yK9jnIA== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 51D5F1F0092B; Sun, 6 Dec 2026 07:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796540420; bh=jP/hVsL32Itc1BhVw7i16KSMxmEZIsxtSrA7hZFPo1g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=YCrA1oQL0JLLsoJ52fWIKp0jdeBaB8E+hcu6ZSBIkVo2NXe2LA86sO+5pKWe1heRP 2Lgkrcb2+AQgpefWHJjrNRoVe3ophpbppRbgQqBs6eG3w8WPioksM0nUo2IvangBgB KwSgjZP2CBRsuN/NL6rlgVYsiLrQaoIGWngDTww8JHLRbI4/PI56ku0E3DvlX1hfiZ iDF3SlSPeYGMung+7+aR0xuC40VZkodTfvRvSpGCjGtuC3jQ7GekRWrYjrbPBvSDlF 2LjUI+weNjMsgSzegBTWaDIQr1SzXbYZkepeZiphl+xSi7lQO5vk8ufdOG0rT0sU62 LAALm1aNfQjpg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id CA7D45066B; Sun, 6 Dec 2026 07:00:19 +0000 (UTC) From: Arun Iyengar via B4 Relay Date: Sun, 06 Dec 2026 07:00:19 +0000 Subject: [PATCH v7 2/2] media: verisilicon: Reset the VDPU2 decoder after an error X-Archived-By: MIME-Version: 1.0 Message-Id: <20261206-vdpu2-errreset-v7-2-7229b820ade3@gmail.com> References: <20261206-vdpu2-errreset-v7-0-7229b820ade3@gmail.com> In-Reply-To: <20261206-vdpu2-errreset-v7-0-7229b820ade3@gmail.com> To: Nicolas Dufresne , Benjamin Gaignard , Philipp Zabel , Mauro Carvalho Chehab , Heiko Stuebner , Jonas Karlman , Boris Brezillon , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Arun Iyengar , stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796540418; l=3791; i=aiyengar1990@gmail.com; s=20261110; h=from:subject:message-id; bh=SIxz14HQTNL80C8FTlcf422vb2xQ6y1gjCFf6DwnB5E=; b=Ku5X6MJtXNejzt95TFZH7EUDIp1X4eqneiSYKO9YO/hPQGo7X24KAjLDF0vPrFNc6BBHOee2g dohBd6GQcd5Bw3x57wqprNvO68f7Rf3NE56mrJ+NGsitZ0qjI5RPGT0 X-Developer-Key: i=aiyengar1990@gmail.com; a=ed25519; pk=zXpRgUTrhaFe6jLyPqbBy3ccfkj04w0g2690Wv3mg+0= X-Endpoint-Received: by B4 Relay for aiyengar1990@gmail.com/20261110 with auth_id=1480 X-Original-From: Arun Iyengar X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: aiyengar1990@gmail.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_REPLYTO_END_DIGIT, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Arun Iyengar After a buffer empty interrupt the VDPU2 core stays enabled, waiting for more stream, but the handler finishes the job. On the RK3588 VPU121 the core then read IOVA 0 until the hardware timeout and left the IOMMU in page fault. Lay the handler out like hantro_g2_irq() after Nicolas Dufresne's commit 19c286b75507 ("media: verisilicon: Fix CPU stalls on G2 bus error"): ignore interrupts the decoder did not raise and report the error type. Where G2 lets a still enabled core run into its timeout, soft-reset it, then fail the job. rockchip_vpu2_dec_reset() now waits for the reset too. Fixes: 879dee56a40c ("media: rockchip/vpu: Add MPEG2 decoding support to RK3399") Cc: stable@vger.kernel.org Signed-off-by: Arun Iyengar --- .../media/platform/verisilicon/rockchip_vpu_hw.c | 50 +++++++++++++++++++--- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c index 5784140f729f..c9e553fd2e79 100644 --- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c +++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c @@ -7,6 +7,7 @@ */ #include +#include #include "hantro.h" #include "hantro_av1.h" @@ -385,21 +386,59 @@ static irqreturn_t rockchip_vpu1_vepu_irq(int irq, void *dev_id) return IRQ_HANDLED; } +static void rockchip_vpu2_dec_soft_reset(struct hantro_dev *vpu) +{ + u32 val; + + vdpu_write(vpu, 0, VDPU_REG_EN_FLAGS); + vdpu_write(vpu, 1, VDPU_REG_SOFT_RESET); + if (read_poll_timeout_atomic(vdpu_read, val, !val, 1, 5, false, vpu, + VDPU_REG_SOFT_RESET)) + dev_warn_ratelimited(vpu->dev, "decoder soft reset timed out\n"); +} + static irqreturn_t rockchip_vpu2_vdpu_irq(int irq, void *dev_id) { struct hantro_dev *vpu = dev_id; - enum vb2_buffer_state state; u32 status; status = vdpu_read(vpu, VDPU_REG_INTERRUPT); - state = (status & VDPU_REG_INTERRUPT_DEC_RDY_INT) ? - VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + + if (!(status & VDPU_REG_INTERRUPT_DEC_IRQ)) + return IRQ_NONE; + + /* + * Unlike G2, DEC_E is not in the status register and the decoder + * stays enabled after a buffer empty. Stop it before the status clear. + */ + if (!(status & VDPU_REG_INTERRUPT_DEC_RDY_INT) && + (vdpu_read(vpu, VDPU_REG_EN_FLAGS) & VDPU_REG_INTERRUPT_DEC_E)) + rockchip_vpu2_dec_soft_reset(vpu); vdpu_write(vpu, 0, VDPU_REG_INTERRUPT); vdpu_write(vpu, 0, VDPU_REG_AXI_CTRL); - hantro_irq_done(vpu, state); + if (status & VDPU_REG_INTERRUPT_DEC_RDY_INT) { + hantro_irq_done(vpu, VB2_BUF_STATE_DONE); + return IRQ_HANDLED; + } + + if (status & VDPU_REG_INTERRUPT_DEC_BUS_INT) + dev_warn_ratelimited(vpu->dev, "bus error detected.\n"); + + if (status & VDPU_REG_INTERRUPT_DEC_ERROR_INT) + dev_warn_ratelimited(vpu->dev, "decode error detected.\n"); + + if (status & VDPU_REG_INTERRUPT_DEC_TIMEOUT) + dev_warn_ratelimited(vpu->dev, "frame decode timed out.\n"); + if (status & VDPU_REG_INTERRUPT_DEC_BUFFER_INT) + dev_warn_ratelimited(vpu->dev, "stream buffer empty.\n"); + + if (status & VDPU_REG_INTERRUPT_DEC_ASO_INT) + dev_warn_ratelimited(vpu->dev, "ASO error detected.\n"); + + hantro_irq_done(vpu, VB2_BUF_STATE_ERROR); return IRQ_HANDLED; } @@ -483,8 +522,7 @@ static void rockchip_vpu2_dec_reset(struct hantro_ctx *ctx) struct hantro_dev *vpu = ctx->dev; vdpu_write(vpu, VDPU_REG_INTERRUPT_DEC_IRQ_DIS, VDPU_REG_INTERRUPT); - vdpu_write(vpu, 0, VDPU_REG_EN_FLAGS); - vdpu_write(vpu, 1, VDPU_REG_SOFT_RESET); + rockchip_vpu2_dec_soft_reset(vpu); } static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx) -- 2.55.0 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip