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=1796389206; b=pdVvPqLmoJSbUeinP7AHPoNTTBKiUMxgANcFfZcS0sdDDcEijnkvpeVU+Sns5k7omJWJ RHjubosNZ6LEtOds+MpuWnM8g1Q9u6T3dFqohtRceXqY/7HMaXs/JrNndLdw0SY67+4At FTLGQ8p/pd9KLRbBt/J4OeygeSdMmWQ0LUfQANTH5JC9UDsO87kaI6x+CMqyr9uveuXSv 5LDEcDTHEUMLljVNrBAbkZfPMyn7YDP6CIdV/nnFi7gp2ZFaYDR4vWcFRspYnxfJ0dlup wgs3WLnkRBIPOzRqxTwPZtvwyUlPDbEZ2TTRjzOdIA+WrHknOL5FlDeXb5jg7gTvZXQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389206; 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=DySFl77K6opnOA88H2DsL9oszHrRI9qaIgNPXPE9Dvc=; b=qLzXrwssH7j1nQTjQ+DNMap0gA7vs5SbG2rGXObsUOUCmkAdmWwu2wuqvRlhaOze4PL5 ab4ao86cgZLVg4mQFt2PhsOHPQ00dqbRxbR4ZrE1O5OvcEw+JB8PjNNHSxZ/m3Sfva5Go bT6kLPhMLu12MOSbxnkPMA7Uh6BraxJxT5NyA3xtyekhfT/WlNmw7BIwd4hIt2nI1Jneg kg18JIwfHIM67qirpS51t2lFi2bWDCxcmF+J9zRdW2TeBHdPDwbHFouIlozFxCRnC+sxS LfM7Bcny5JMWw3KLXtZK3Kbm5FuEpKFLW257821oX+BzFpxh6+OT4mv61CStOIq0uxw== 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=ywP+GXmB; 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 8DB3F606A334; Fri, 4 Dec 2026 13:00:06 +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=ywP+GXmB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A5831F000CE; Fri, 4 Dec 2026 13:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389206; bh=DySFl77K6opnOA88H2DsL9oszHrRI9qaIgNPXPE9Dvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ywP+GXmBBRddImtNNN0KJCVNDtRwxaB7uq1on+yE8dACfEU28daMS/5ZdkCnDuxPu eOu5Y6qNUtvOx0HelT3cRUsVefeQMNXSIha1kRpWZlpmfMclyleGhebE+TghxKmbpC mFDkl6XfYcsfoJzRTwM1LJMf8La0vCjswmmvgGAY= 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 6.1 0905/1059] drm/vc4: Clear the slice caches before resetting a stalled GPU Date: Fri, 4 Dec 2026 19:07:16 +0900 Message-ID: <20261204100707.458616601@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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 6.1-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 @@ -214,6 +214,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 @@ -41,8 +41,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 { @@ -341,6 +340,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; } @@ -357,11 +357,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