From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380832; b=XeUVb3P7lGKinKRqMU82rQHQRGWSBmhOqnZv2JglL22TG1RVL2DksFhIm+zQjNQzEP3e sjQr6i962HO/8b5SCYqugcx0P/PplzmbEOZ77GVMEYGN3jGcIbNcg0dZ9eoPPHx8h1uzd 3lRk/V0BxaZoHUJvWGZkCQHclWAW5W8VP83a9D94IxMqqQEQgq11z4IQhN3s/9p6TY+ZA cAofVPSVDPAAJodfbyo38qiIMk20MipYHZyIgF6P/kVKLg1pr4tUPM8LKFQhxqR5cjiHH MzhRu8ymWqXd9FXlcOn8qqjUcJwrguXV986oLoi5kT5f6ut+DOSWsbotiaiB6O7kkvw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380832; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=71ES44Ff4c+4WBLryzyCXaFmz8KsjFnJjMIuar64ShA=; b=2GTAzG3/hcXcuoJSIMxsuvcOny1Vg5AqzqOcZWlYU6d7swl7fW1RCMwEi2lrVL0Jpmld i2bqDJnyiUQmrC0KYcL8SvBZx1Xp5BACrjcLokYbA4plxbWRIWEwM/pwMABMf+Y7HFGmT 1hsrXfDGSAGPQfnq929Za4CliLTA2Tn3EGzUsRNYA3jGeSP4iG2TJuma4OqbrqMtgHaW1 Ydi5Xdca4LUl58uLJA8hdWjS8yjaQ0QFQDQ+5QoGTlYlWGS6ZmtXnkVjxWaleGKKm9HyW KVUjE/VliK9Fse39VelNNvGWCYVgdXPYos9J32DJB577gtP6Ghi0Ty0PqW3xnZg0wTQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=E+OPqpJ4; arc=none 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 B1090606A32F; Fri, 4 Dec 2026 10:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=E+OPqpJ4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CFBC1F000CE; Fri, 4 Dec 2026 10:40:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380832; bh=71ES44Ff4c+4WBLryzyCXaFmz8KsjFnJjMIuar64ShA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=E+OPqpJ4iI7KClCUn2AmRrBJgBWfC2D49PYxWqFbPd7h7GmtDwkMGC39o/G/lLiMi 7hcA8NDmWOUUBoLBn6o8AAN8vmkSl+RI3TRzB4x9vISYinrzufXwLLaK6xiNFQNiPv xw9iS2hvLyd0yUNc9p3jjNHchCtKbQeMWmeWcBBE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Iago Toral Quiroga , =?UTF-8?q?Ma=C3=ADra=20Canal?= Subject: [PATCH 7.3 402/742] drm/vc4: Clear the slice caches before resetting a stalled GPU Date: Fri, 4 Dec 2026 19:04:26 +0900 Message-ID: <20261204100645.774001844@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev 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: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maíra Canal commit af1cf92e8617a7f7aa24b415596cbf64b76a12e7 upstream. Starting shader code at varying offsets makes the GFXH-16 icache livelock unlikely, but not impossible. When the livelock happens, the QPUs make no progress and the hangcheck resets the GPU, losing the job. When the hangcheck finds no progress, clear the slice instruction and uniforms caches and check again before resetting. If the stall is a livelock, clearing the caches can break it and let the job continue. Drop round_jiffies_up() from the hangcheck timer, so checks run every 100 ms instead of at the next whole second. This shortens the screen freeze before the caches are cleared. Long jobs are unaffected: while the control lists advance, the hangcheck won't clear the caches or reset the GPU. Cc: stable@vger.kernel.org Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/16652 Reviewed-by: Iago Toral Quiroga Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-4-5b8adc2c84fe@igalia.com Signed-off-by: Maíra Canal Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vc4/vc4_drv.h | 5 +++++ drivers/gpu/drm/vc4/vc4_gem.c | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -223,6 +223,11 @@ struct vc4_dev { struct { struct timer_list timer; struct work_struct reset_work; + + /* The instruction and uniforms caches were cleared at the + * last check that found no progress. + */ + bool caches_cleared; } hangcheck; struct drm_modeset_lock ctm_state_lock; --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -43,8 +43,7 @@ vc4_queue_hangcheck(struct drm_device *d { struct vc4_dev *vc4 = to_vc4_dev(dev); - mod_timer(&vc4->hangcheck.timer, - round_jiffies_up(jiffies + msecs_to_jiffies(100))); + mod_timer(&vc4->hangcheck.timer, jiffies + msecs_to_jiffies(100)); } struct vc4_hang_state { @@ -343,6 +342,7 @@ vc4_hangcheck_elapsed(struct timer_list /* If idle, we can stop watching for hangs. */ if (!bin_exec && !render_exec) { + vc4->hangcheck.caches_cleared = false; spin_unlock_irqrestore(&vc4->job_lock, irqflags); return; } @@ -359,11 +359,27 @@ vc4_hangcheck_elapsed(struct timer_list bin_exec->last_ct0ca = ct0ca; if (render_exec) render_exec->last_ct1ca = ct1ca; + + vc4->hangcheck.caches_cleared = false; + spin_unlock_irqrestore(&vc4->job_lock, irqflags); vc4_queue_hangcheck(dev); return; } + /* Clear the slice caches to workaround GFXH-16 */ + if (!vc4->hangcheck.caches_cleared) { + V3D_WRITE(V3D_SLCACTL, VC4_SET_FIELD(0xf, V3D_SLCACTL_ICC) | + VC4_SET_FIELD(0xf, V3D_SLCACTL_UCC)); + + vc4->hangcheck.caches_cleared = true; + spin_unlock_irqrestore(&vc4->job_lock, irqflags); + vc4_queue_hangcheck(dev); + return; + } + + vc4->hangcheck.caches_cleared = false; + spin_unlock_irqrestore(&vc4->job_lock, irqflags); /* We've gone too long with no progress, reset. This has to