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=1796386515; b=wUq6ZAzLvfF3G6f0rVIWlq7Hieie3kr9bVmSRo40+jED/BMSskzyRwW1//nwbChERbF1 vbIN+cr6dlDfYfc70mIdQ909noJCUgC4QWm3phooHX5xKTxjca1jw17XGzkqWdaTsvZzl dEklHOu9NQRV1v7r7vagLqbdigfPvbr0qevKzTOXuUN2kM7gNtSW0X82EIHGPhlk1QL2k mx2T3bkv6W1VvDH9y2Xn+XsvCaay/MhEu0SOzc0s6LndYlRdNvq3n0Algs/ExX9xu6KZL 5LIFgBmVhxJzVMTonwSHhG0lT21iAJtL5ubJLus3Qawp/59Cr53jomdlfkmr23aEZIA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386515; 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=VYl0TWDJiXsTKquEWspVunMk4jkS0vax0jIF/9LG+ME=; b=AhOgWJoqHRyF0DW+gY0aKalDexYn2V9Z2LsuJGbeSbqRoeR9XMJxv59InOoUR3ay97pA EkpGuY7lo7sQY2FZaBgozTq0gSeSzs+TutKdGeSTUAYmq7GI6zNc4vI1sjARm8o9A7j86 JZ3WPZF5igdSPQJLTGvC8tu8kEY78OFAnLlZVsdgJsmkqlH9zGOR8eJnWLadEMteZAREB uTisfdrbRq/U+NOL7bL9Nie8khwRd5L2IWFAhY2LWs7rjYUBLYO7fUE03tjgvnID1qvQn k/+JQ8X9qsnIth6gvYRmvEtIJgCYoANYYq3OQBa9EUdwjtqsmjF3Pv39uz52E1FQJaA== 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=o5nGfyu0; 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 EA437606A334; Fri, 4 Dec 2026 12:15:14 +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=o5nGfyu0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B3D1F0092C; Fri, 4 Dec 2026 12:15:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386514; bh=VYl0TWDJiXsTKquEWspVunMk4jkS0vax0jIF/9LG+ME=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=o5nGfyu0j4zPcVh9N/BlAQNiIiB2FMAO3N7l+xxzEFiekv141trUyb40qhrWhSw++ N1GgbkMfjBzPO0utjtx6pl8ouzjJK8YFZdh9E+tMQ3Xqk4mII+/EH/rQzQbBOd/BMb TEqVmw7Pdn8NOuxdxhzg2xdetBqkWZyJ6p/Nz4Qw= 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.6 0996/1167] drm/vc4: Clear the slice caches before resetting a stalled GPU Date: Fri, 4 Dec 2026 19:07:03 +0900 Message-ID: <20261204100728.148789583@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-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 @@ -219,6 +219,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