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=1796453487; b=bI0HiDjWUxrNmbv0MwHxjGLtWswBH8ib6GaCXaBZ96hYkRYO41MqAyK6ioYphkue3pVF peWXTKOlACBqTX5Hf+4TEN4GRmRaaqkBdV1wsO3ShCApChKEhAUeH3MsByavonjJVSzvr y/Yzbv1VODbUJWMyiA4wLDQdrimWokF9B67kJfHK6z7fbC6l9Q69Wt8fIwcQlUP+89cWM j/5pzn3S3JnMET3cXlzxLWprqFwyCphxWP8HKxLXfKeJcE3i4XSn5mwXORqo9Tw+5Nsvc xZNQ8fhH0FyEuNhzsO9lOPBT7s/jwy6qDLwB+U+pEL59ldpdgdZRYnnvqoMluFFnsSw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796453487; 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=QwnkblouqMP0ZVfVlXWDzYHtupvvFyMQ/Xdhe84qA0M=; b=vZG6aH5xkVheKHj3j7R3E76qgil+2+JlfHulJv5Xw/kt/5Vgrsz4iPlb55PMn0eYmmEN cZxZtFkacWlnhfOCTrg3pnmIXGNtzvmn2+C3GEvBw5Plqj5tmrYZAoyNPQOF2VFEXMaMw zo/KNVyVkL6f6v78eqa6dvVzWYUA2ualoRhyRVDrGcDvfdR/SgPfJV7Y5NE0gEDXQCHFi j6t7ufceXQZ07bKto9c8WdD8pMjnlwVpAfE/Wu4cPqPfomQddUG0tI9dg9jzfdkIorvdd /uvzGU/DFnlpB0yM4hjKjo+nZ5aqRVYBiVMNbkJjCVQkR6AguHaYVerhhsgVcdLS/ZQ== 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=Z9d5igne; 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 081B3606A680; Sat, 5 Dec 2026 06:51:26 +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=Z9d5igne 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=1796453486; b=Ip0f7lZoIV3w5QZnJpLQUkdeUA7R1yHZuiPFutAhnK1NjBcJxZ84JQWGtrZkYDnpCF2A HR7j7TlGi6GP7TggJnOaXic801i36lMxcVkQDEkCrLvwfzriLcx5+iWnkC8tuzu4mKzh3 DDjt6/rZkpzqCzQBwENESM4j0yVygS3NMwp0BWCNoDa/20VuCYISXKgKxgvd/2Sy6hIEG amcgkGKA6peISzK8YnKMx02JHUyawSsifjlx9whfs92cIZBPGlkHUIz//UYZ5t1LUabaq 0GZs8NdKz5zn89zEMEczKztckywc7BVDU53EsujccrVm8uoC5XjRx9hhkTpFe3Py7Ng== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796453486; 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=QwnkblouqMP0ZVfVlXWDzYHtupvvFyMQ/Xdhe84qA0M=; b=G1XLUyVLtSWIXGcSKV0fjm91o4keAjnG1iNgIn78qD4Roz6R3XuAkW+ebJVBG2go+F9u VOlwVCPwQ6SkaW7MhHh+D1icWUbltd/FfnaCfgRcdoTLAcSw1W13UgOyhayfxjAd16Np+ L2qjN8WhriCbDXNVx1A/O4DAv+a5Dy0BzMfvaYRMqGlC0V0HCuNIvG/k26YSZJBKYK7Eh u1BnhuIyRAyBI6k+ZKzcmN3RwGdemE/uJ10ML51Y//61XusZQJP1N904LmpZhVf+UAckt H9s0jykn76uD6ba24gEqkHfmXtd0ITXS7Yv6DyzCEU4vYBMltDu29lv3jcVFDb7Da4w== 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 E6C601F00A10; Sat, 5 Dec 2026 06:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796453486; bh=QwnkblouqMP0ZVfVlXWDzYHtupvvFyMQ/Xdhe84qA0M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=Z9d5igneiRBCviqDL9Zs/gHX1149HpNSmo2Aczy62VcYztlUW4zMEVeS48UgXYbcI aAJP4kDniLuXo6dr3qD2by2VlGuPgWSCT8Vfmgh0DRqMc/rcH/upDKF5FiqpjXWbsw sJEWFeE+Yu56TSTaT65ZDw6KlzR/sP655zZb4N9JRJWchg9M8+xO0fZj4ga/DaZJit 6FCohu+1ShfR7nS+aqBR7hC46MwoMQTAipFHG95A3HaTqJJa+ySGMDcvBtJmnmIk7H PyoPjy4PbU30GyIy64dnFgIUNEIdo4BfREHYVGd49jg/qQX7bjriZ9irdvc1lZZTdk zoDgwRRVsknwg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 7B626501D9; Sat, 5 Dec 2026 06:51:25 +0000 (UTC) From: Arun Iyengar via B4 Relay Date: Sat, 05 Dec 2026 06:51:25 +0000 Subject: [PATCH v6 2/2] media: verisilicon: Reset the VDPU2 decoder after an error X-Mailing-List: linux-media@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: <20261205-vdpu2-errreset-v6-2-efd43e527e33@gmail.com> References: <20261205-vdpu2-errreset-v6-0-efd43e527e33@gmail.com> In-Reply-To: <20261205-vdpu2-errreset-v6-0-efd43e527e33@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=1796453484; l=3394; i=aiyengar1990@gmail.com; s=20261110; h=from:subject:message-id; bh=v8oiDpebt1ymCiBH8rvVDQIPRK+EZz4JqQtKo238nPg=; b=K1Nh0848qKdnwIzwWCidXCclgT9cU4zHgvn6ZWH2pWcWZJF7tpCpnM7xfE7s23JeFD9X6jWDc uSFtMty5m7SDTlDLslwPBOqUBK7OeBDIMgmkK3yaIdxZHQL3eo61lNT 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 Ignore interrupts the decoder did not raise and report the error type. On an error interrupt, soft-reset the decoder if it is still enabled, then fail the job. The core stops itself after bus, stream and ASO errors and timeouts, but not on buffer empty: it stays enabled waiting for more stream. On the RK3588 VPU121 it then read IOVA 0 until the hardware timeout and left the IOMMU in page fault. 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 | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c index 5784140f729f..8fce81b9d859 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,6 +386,17 @@ 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; @@ -392,8 +404,30 @@ static irqreturn_t rockchip_vpu2_vdpu_irq(int irq, void *dev_id) u32 status; status = vdpu_read(vpu, VDPU_REG_INTERRUPT); + if (!(status & VDPU_REG_INTERRUPT_DEC_IRQ)) + return IRQ_NONE; + state = (status & VDPU_REG_INTERRUPT_DEC_RDY_INT) ? VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + if (state == VB2_BUF_STATE_ERROR) { + 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"); + + /* + * After a buffer empty the decoder stays enabled, waiting for + * stream the job doesn't have. Stop it before the status clear. + */ + if (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); @@ -483,8 +517,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