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=1796540420; b=pS4KeB6zH0wUi7uzjs1anbSkrMEClbPx64wR2r2sU9iDbidKHq2Zkf/5dl6bIjp+WXhV x85BaHn+CjVZ4Tc7etvrzlW+5+0OBKqWTYmXIcJfbjlPf411G3jS1qA32iAr1/yZFT958 xZHFCb5x7r1/g9eDOgpGKoRpyTd8MsGZODk3bmBir9aj5c0P0iJqq+gTPSJo8A/D60qor IJze3xjkmBLPWyBxSji0a/JeZTsEVWFr+ikcRhBDv3AZ8QxSyEkrQ6NjwYCpNK7o+NPRg H0CV0aRtzk4NJzVf8OdKS6ua02RMEhmChuKx/xR0wiyERlBbBGhYCoMxE73g81cmgzQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796540420; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=ZleYiv97vOQwq3XX+F2fP3YqxFlgrivaTPqHAulvcTA=; b=aYgeRunoaTcM7panzaWyuwqNRTVXgJ9fyhG3Jy4wbfZ6BIabUMnz16EoMN4hRNXbcTri zTQIQRpLHWBtMRkSkEVYFWTMyBaKp6T6W9X1WuqqD7syKkCV5+1o20K46hA1Pry9UeGOI XFV3bNG7Rr6VbSdWbxFmpqB3jVgiyPD/zv4PRn8b25Z0J4Sgm9dZ100eS9ozI6RcniKHS 6LQygxeH0MWgmcnNLbpMB2aS5FgpwSGB7w7vTipowDGXQFOf98r9++ax34QH87KrqBkJ4 wJtJ3KE2bcGBk1Ie2+YI0RMySVF17XLW7bAq9/GChsOStMzHxq99w4+zbzh95onWNhw== 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=ChQFrePC; 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 67CE2606A321; Sun, 6 Dec 2026 07:00:20 +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=ChQFrePC 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=kwpIBTQe8xTtKSFjWm0kQ7xvlR+ftc8YYg+WdrzMhAI0YEHuAbP/VA0r28vP2wD114Ey iM3X5gBjjJ74FrRXTPMRIHU7pzwkZrgmD8o88fJQDsAQqGwQinFv2GadJNHI7osqaMSo3 VI7hqzKKmlX1VNxaq4W7fpcALdz8G4FxMEdzbYsFqjcwk1RlYqFnKt7eVIXh5C175Sfue ZN9dPN0A3+37lgHQzKR8KWE9UzD8vpuIGlBx738yAaEpzKul1TXjknMxTsrIEuf1rEFF3 MJdaWNA46awn7hoJxrtNThpiK3l44lu1A5/bdfbzBNb3HjjpwjX1uIn5rd7EOzdpqDA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796540420; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=ZleYiv97vOQwq3XX+F2fP3YqxFlgrivaTPqHAulvcTA=; b=2LOGgvDwGXrrxGEqU57JhoquxUlSy2ernVvo0m6vwHnw9damHVjlwHKrXeIHcK7rrtNC VxsmzsPx2Mz1VKG+U0OTejA8LHTyGUixZF7bvpSGr7GpXiZEVDgEoFZLctgqA86222m05 TzE3sX++0dL0dTi7IXrOuhRi8VZKevLi+Gf+pl+cpZNeDe3R+aF00doInWPCw9oougdgW rKxKknfG60BT1p5t74Pl9jx4fu6mC48P8Xj4zKR4VZhUMEzc99H6wZkPlEssamsF/1c1m NoGGY9s/YjkenYhygo9/3OmL7a+hLlco4wvyNm++/A7w+NuVk+wKtgI0AX5LedXK6/w== 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 67B001F0093B; Sun, 6 Dec 2026 07:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796540420; bh=ZleYiv97vOQwq3XX+F2fP3YqxFlgrivaTPqHAulvcTA=; h=From:Subject:Date:To:Cc:Reply-To; b=ChQFrePCkV8Nf3R9qGAbYwuztj/CphmfJkFuu2YGlJPCyjS3+OEybW86r+jP+y4j7 pn2b2POL/GCZbaWdgFPkBZkEmWHidVfRhUFGht4OPKYlpwVkUrQTo8HT+sRXb+p7fQ IZDeOT1k2XfhOsKMEhHLDWEcB14E6SSRNGny24tlNjR/z/4jqYE2hPz8Ovgh0va/Rj uuJKFjX/zV/XGDTZw7UBxnCzi+minmMSNN++LKwxNJTEafEap+H/nXo6NaI8IbMQbT aeF44dnZRDm79+lWw6rMjyXGqqzpWm72vh5Mwm5LvAreRoWvAuF1N/JpGXrYfhdlxy vKYQFnvwylVug== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id A9C7450667; Sun, 6 Dec 2026 07:00:18 +0000 (UTC) From: Arun Iyengar via B4 Relay Subject: [PATCH v7 0/2] media: verisilicon: Fix VDPU2 decoder error handling Date: Sun, 06 Dec 2026 07:00:17 +0000 Message-Id: <20261206-vdpu2-errreset-v7-0-7229b820ade3@gmail.com> 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" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/2XRwWrEIBAG4FdZPNeijmNMT32P0oPGcdfS3Syal ZYl716zpTQkl4Ef5vtl8M4K5USFvRzuLFNNJY2XFrqnAxtO7nIknkLLTAllpJTIa7jeFKecMxW auDXWdkJADw5YQ9dMMX09Ct/ef3O5+Q8apqVl2TilMo35+/FilcveX3m/La+SCx5tdFqANw7c6 /Hs0ufzMJ7ZUl7Viiux46pxGzVFRDKBaMthzeWOQ+OiA4+EPgSjt1yvudlx3bjrEb0crG/XbTn +cyX0jmPjNKAXfefa9Ftu1nz3L9UsPAYNhKojgDWf5/kHFL5Bi/kBAAA= X-Change-ID: 20261115-vdpu2-errreset-8688700393a3 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=3644; i=aiyengar1990@gmail.com; s=20261110; h=from:subject:message-id; bh=1X/q/zeusCOns4CmeSfRzgpYLUlhRTPFXQql6nwsPg4=; b=mLAwToDqHdwvKzIfln26FYJZVDcUhzDPCgzpAUqBaOyW4n2HNAR2InUBYfRN0KV8pZHsd1x7m boS/jf+QGXBCI0qWeRFAx7U8eYWYuGwFrHkjZwNad/CQ9f9d/3ehcF2 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 The VDPU2 decoder reports failed decodes as done. After a buffer empty interrupt it also stays enabled while the handler finishes the job; on RK3588 it then read IOVA 0 into an IOMMU fault. Patch 1: complete the job as done only on picture ready. Patch 2: lay the handler out like hantro_g2_irq() and soft-reset a core that is still enabled after an error. Tested on Orange Pi 5 (RK3588S, VPU121) on 7.3 with these two patches, KASAN and lockdep. Unpatched, an MPEG-2 request with an all-zero payload leaves the IOMMU in page fault until reboot. Patched, two such requests each raised buffer empty, the handler reset the decoder, both failed within 4 ms with no IOMMU fault or timeout, and the next stream decoded as on the unpatched kernel. 88 MPEG stream decodes are identical to the unpatched kernel. Two of the 88 are 16x16 and 32x32, below the driver's 48x48 minimum: their output was garbage before and is unchanged, and every frame now returns an error. 1300 + 186 error interrupts, no reset timeout; an injected reset timeout failed one job, the next decoded bit-exact. H.264 MR8_BT_B 25/25 and VP8 61/61 pass, JVT-AVC_V1 results are unchanged. Buffer empty was hit with MPEG and H.264 streams; VP8 never raised it. Bus errors and timeouts were only injected. Media next is build-tested only. RK3328, RK3399, PX30 and RK3568 are untested. Claude (Anthropic) wrote the code and messages; I reviewed every change. Signed-off-by: Arun Iyengar --- Changes in v7: - Patch 2: lay out the interrupt handler like the G2 one and cite its fix, commit 19c286b75507; no functional change (Nicolas) - Rebased on media next - Link to v6: https://patch.msgid.link/20261205-vdpu2-errreset-v6-0-efd43e527e33@gmail.com Changes in v6: - Patch 2: soft-reset only if DEC_E is still set, the bit G2 also tests; poll the reset bit every 1 us; log ASO errors; add Fixes (Sashiko) - Link to v5: https://patch.msgid.link/20261204-vdpu2-errreset-v5-0-ec5b097a5b0b@gmail.com Changes in v5: - Patch 2: also reset and fail the job on buffer empty, dropping the keep-job branch (v2) and the DEC_E read (v3): on buffer empty the core does not reset itself and stays enabled waiting for stream a stateless job cannot supply, so keeping the job leaves a running decoder that can only end in a timeout (on RK3588 it read IOVA 0 into an IOMMU fault) - Rebased on media next - Link to v4: https://patch.msgid.link/20261126-vdpu2-errreset-v4-0-a955b1c8b119@gmail.com Changes in v4: - Patch 2: soft-reset the decoder after a bus, stream or ASO error or a timeout, before finishing the job (Nicolas) - Rebased on media next - Link to v3: https://patch.msgid.link/20261121-vdpu2-errreset-v3-0-073b5e5bdd64@gmail.com Changes in v3: - Patch 2: read DEC_E before clearing the status, as G2 does (Sashiko) - Link to v2: https://patch.msgid.link/20261120-vdpu2-errreset-v2-0-8f4ef55e6dee@gmail.com Changes in v2: - Patch 2: no reset after an error; handle the interrupt like the G2 handler instead (Nicolas) - Link to v1: https://patch.msgid.link/20261119-vdpu2-errreset-v1-0-f8fa403b6a3a@gmail.com --- Arun Iyengar (2): media: verisilicon: Don't report VDPU2 decoder errors as success media: verisilicon: Reset the VDPU2 decoder after an error .../media/platform/verisilicon/rockchip_vpu_hw.c | 50 +++++++++++++++++++--- 1 file changed, 44 insertions(+), 6 deletions(-) --- base-commit: fd568e1139cc43b39fad1108463d1f7681d82ce2 change-id: 20261115-vdpu2-errreset-8688700393a3 Best regards, -- Arun Iyengar