From: Maíra Canal <mcanal@igalia.com>
To: Melissa Wen <mwen@igalia.com>, Iago Toral <itoral@igalia.com>
Cc: kernel-dev@igalia.com, dri-devel@lists.freedesktop.org,
stable@vger.kernel.org, Maíra Canal <mcanal@igalia.com>
Subject: [PATCH 1/4] drm/v3d: Wait for pending L2T flush before cleaning caches
Date: Sat, 30 May 2026 15:37:42 -0300 [thread overview]
Message-ID: <20260530-v3d-fix-rpi4-freezes-v1-1-c2c8307da6ce@igalia.com> (raw)
In-Reply-To: <20260530-v3d-fix-rpi4-freezes-v1-0-c2c8307da6ce@igalia.com>
v3d_clean_caches() starts the cache-clean sequence by writing
V3D_L2TCACTL_TMUWCF to V3D_CTL_L2TCACTL and then polling for that bit to
clear. It does not, however, check for an L2T flush (L2TFLS) that may
still be in flight from a previous operation.
On pre-V3D 7.1 hardware, kicking off the TMU write-combiner flush while an
L2T flush is still pending can clobber bits in L2TCACTL and cause cache
inconsistencies.
Poll for L2TFLS to clear before writing L2TCACTL on V3D < 7.1, ensuring
any pending flush has completed before a new clean is issued.
Cc: stable@vger.kernel.org
Fixes: d223f98f0209 ("drm/v3d: Add support for compute shader dispatch.")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
drivers/gpu/drm/v3d/v3d_gem.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
index 1ee3c038d5f6..c43d9af41374 100644
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -206,6 +206,14 @@ v3d_clean_caches(struct v3d_dev *v3d)
trace_v3d_cache_clean_begin(dev);
+ /* GFXH-1897: Ensure pending flushes complete before writing L2TCACTL */
+ if (v3d->ver < V3D_GEN_71) {
+ if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
+ V3D_L2TCACTL_L2TFLS), 100)) {
+ drm_err(dev, "Timeout waiting for L2T clean\n");
+ }
+ }
+
V3D_CORE_WRITE(core, V3D_CTL_L2TCACTL, V3D_L2TCACTL_TMUWCF);
if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
V3D_L2TCACTL_TMUWCF), 100)) {
--
2.54.0
next prev parent reply other threads:[~2026-05-30 18:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 18:37 [PATCH 0/4] drm/v3d: Fix RPi 4 system hangs from stale cache and MMU state Maíra Canal
2026-05-30 18:37 ` Maíra Canal [this message]
2026-06-04 5:23 ` Claude review: drm/v3d: Wait for pending L2T flush before cleaning caches Claude Code Review Bot
2026-05-30 18:37 ` [PATCH 2/4] drm/v3d: Flush MMU TLB and cache during runtime resume Maíra Canal
2026-06-04 5:23 ` Claude review: " Claude Code Review Bot
2026-05-30 18:37 ` [PATCH 3/4] drm/v3d: Clean caches before runtime suspend Maíra Canal
2026-06-04 5:23 ` Claude review: " Claude Code Review Bot
2026-05-30 18:37 ` [PATCH 4/4] drm/v3d: Reduce PM runtime autosuspend delay Maíra Canal
2026-06-04 5:23 ` Claude review: " Claude Code Review Bot
2026-06-04 5:23 ` Claude review: drm/v3d: Fix RPi 4 system hangs from stale cache and MMU state Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260530-v3d-fix-rpi4-freezes-v1-1-c2c8307da6ce@igalia.com \
--to=mcanal@igalia.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=itoral@igalia.com \
--cc=kernel-dev@igalia.com \
--cc=mwen@igalia.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox