From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: stable@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH] drm/xe: Add memory barrier before H2G tail write on wrap
Date: Thu, 23 Jul 2026 17:31:08 -0700 [thread overview]
Message-ID: <20260724003108.1561414-1-matthew.brost@intel.com> (raw)
When the H2G buffer wraps, it is padded with NOPs before updating the
H2G descriptor tail. However, the tail update is performed without a
memory barrier, allowing the GuC to observe the new tail value before
the NOP writes become visible.
This can result in the GuC reading stale H2G commands, potentially
causing a variety of failures. Fix this by inserting a memory barrier
before updating the H2G descriptor tail.
Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
drivers/gpu/drm/xe/xe_guc_ct.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
index fe70c0fd85c5..49031497e9dd 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.c
+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
@@ -993,6 +993,7 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len,
(h2g->info.size - tail) * sizeof(u32));
h2g_reserve_space(ct, (h2g->info.size - tail));
h2g->info.tail = 0;
+ xe_device_wmb(xe);
desc_write(xe, h2g, tail, h2g->info.tail);
return -EAGAIN;
--
2.34.1
next reply other threads:[~2026-07-24 0:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 0:31 Matthew Brost [this message]
2026-07-24 0:40 ` ✗ CI.checkpatch: warning for drm/xe: Add memory barrier before H2G tail write on wrap Patchwork
2026-07-24 0:42 ` ✓ CI.KUnit: success " Patchwork
2026-07-24 6:56 ` ✗ CI.checkpatch: warning " Patchwork
2026-07-24 6:58 ` ✓ CI.KUnit: success " Patchwork
2026-07-24 8:11 ` ✗ CI.checkpatch: warning " Patchwork
2026-07-24 8:12 ` ✓ CI.KUnit: success " Patchwork
2026-07-24 11:53 ` [PATCH] " Matthew Auld
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=20260724003108.1561414-1-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-bot@kernel.org \
--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