From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796540421; b=NbwT8PQLHikzvoieBqg+atuw2DwJwJFKtlabALFjNd7Jl4bYCuZTSDjDPJyL2zSXIiGy 1+A8VL7oH+ngu4FS+Yz2eCjjb+MNp5lPF0pEbRJ7VL7hzq0FKAMpV2UgucT87Vn2fL+AP HX7VXDA+YxtUswVcZ1kZa1wyiw0FBYRNXeXVhv9it+sLlJDLiN+eVGbxdw8HfOdoKcDAD Ez4KhocQz34v91WnKw2IfqR3ceUY78GAPxbMwQMqJe0ZKOXbzKbONwTPT7U4jBeCMIYzn FUsISQ0lYM6r41RVDsJwLJLC9BRPrigK5NpdqwvCWHu9JSk1y4wIOsP5UvzXW7ws8/A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796540421; h=Received: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=VzussJOsF0fCMIo0fmXwyqDdN+Zk8Ybfabgsm1W7sMvbZ25BsR7voXCK/JgzU9dJ4EE7 XcQ9CVw2JiGICpOV8YdnviU+i4QV24hdgorEFrmaDncb7X0AgZ4so0DwEZA/l7j3aozs+ JFBGUZ2kz4AgayF5Trrm+o5ICEztzZ0sM48hn6qXiM/xPqgcBkd99ySNtXwUf59cXidRE OQL0YLK61Y4V3Z1x/aWEll7jpggffVkk5hlLl7pUZmsKlfmqREZjOsHr7LUtmlB17DJZQ oXPNojp9s7a7cB8ILlW8lqpNOdmK86fM3fzbQeP3d4imwXbhoAURvXixueAoQV5WL1g== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YCrA1oQL; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EAFC606A680; Sun, 6 Dec 2026 07:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YCrA1oQL 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-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reply-To: aiyengar1990@gmail.com Content-Transfer-Encoding: 7bit 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