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 DC612606A32F for ; Sat, 5 Dec 2026 06:51:37 +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=s5227q11; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z9d5igne DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Cc:To:In-Reply-To:References:Message-Id: Content-Type: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=QwnkblouqMP0ZVfVlXWDzYHtupvvFyMQ/Xdhe84qA0M=; b=s5227q11CexAhcHJ55zFZQVKR1 6koKwykisu73twFa03VRFMGXNr9X2Z9b+egzF1xXykLUb9shhL6AerATnThBdX99Chj95ZyxhVlIb hqdVBmUyJls+StBTDN6GkhPKhUOYoI2rr4V+A1FatjCP5VHcKSaoZsDDEfHnrQTpFeF6GhemLU8lo +0PheiEA/af1FrZ+IMgY10EQholadZ/YP7t9o3fA9wSDn7ZYucYXYDQa1sLWotd3rwmVobLZuNPty rrsEgTrJttUFnfysVt8bnouqE8mabYXNgBz8MmyMACXt/dWYGRJGWiC/ynhcrQD514c21nHBcuKcD 8vcY7wAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZjcJ-000000025XR-2eES; Sat, 05 Dec 2026 06:51:31 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZjcF-000000025VN-07RS; Sat, 05 Dec 2026 06:51:27 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id C602A4475C; Sat, 5 Dec 2026 06:51:26 +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=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-Archived-By: 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 Content-Transfer-Encoding: 7bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: aiyengar1990@gmail.com Sender: "linux-arm-kernel" X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 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