From: Jay Cornwall <jay.cornwall@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Jay Cornwall <jay.cornwall@amd.com>,
Lancelot Six <lancelot.six@amd.com>,
Joseph Greathouse <joseph.greathouse@amd.com>,
Vladimir Indic <vladimir.indic@amd.com>
Subject: [PATCH 2/5] drm/amdkfd: Fix scalar load ordering in gfx12.1 trap handler
Date: Fri, 16 Jan 2026 14:39:29 -0600 [thread overview]
Message-ID: <20260116203932.988704-3-jay.cornwall@amd.com> (raw)
In-Reply-To: <20260116203932.988704-1-jay.cornwall@amd.com>
Scalar loads may arrive out-of-order with respect to KMCNT.
The affected code expects the two loads to arrive in-order.
Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Cc: Lancelot Six <lancelot.six@amd.com>
Cc: Joseph Greathouse <joseph.greathouse@amd.com>
Cc: Vladimir Indic <vladimir.indic@amd.com>
---
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h | 8 ++++----
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index 6281b2f9faee..453c08845d74 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -4638,8 +4638,8 @@ static const uint32_t cwsr_trap_gfx12_1_0_hex[] = {
0x01ffffff, 0xb8fbf811,
0xbf0d847b, 0xbfa20078,
0xf4003eb6, 0xf8000000,
- 0xf4003bb6, 0xf8000008,
- 0xbfc70001, 0x8b76ff7a,
+ 0xbfc70000, 0xf4003bb6,
+ 0xf8000008, 0x8b76ff7a,
0x80000000, 0xbfa20027,
0x9376ff7a, 0x00060019,
0x81f9a376, 0xbf0b8179,
@@ -4717,8 +4717,8 @@ static const uint32_t cwsr_trap_gfx12_1_0_hex[] = {
0xb980f821, 0x00000000,
0xbf0d847b, 0xbfa20078,
0xf4003eb6, 0xf8000000,
- 0xf4003bb6, 0xf8000008,
- 0xbfc70001, 0x8b76ff7a,
+ 0xbfc70000, 0xf4003bb6,
+ 0xf8000008, 0x8b76ff7a,
0x80000000, 0xbfa20027,
0x9376ff7a, 0x00060019,
0x81f9a376, 0xbf0b8179,
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm
index 1624a02ad0ef..7ed4b502eb22 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm
@@ -1357,8 +1357,8 @@ function fixup_vgpr_bank_selection
// ttmp[0:1]: {7b'0} PC[56:0]
// ttmp2, 3, 10, 13, 14, 15: free
s_load_b64 [ttmp14, ttmp15], [ttmp0, ttmp1], 0 scope:SCOPE_CU // Load the 2 instruction DW we are returning to
+ s_wait_kmcnt 0
s_load_b64 [ttmp2, ttmp3], [ttmp0, ttmp1], 8 scope:SCOPE_CU // Load the next 2 instruction DW, just in case
- s_wait_kmcnt 1
s_and_b32 ttmp10, ttmp14, 0x80000000 // Check bit 31 in the first DWORD
// SCC set if ttmp10 is != 0, i.e. if bit 31 == 1
s_cbranch_scc1 L_FIXUP_NOT_VOP12C // If bit 31 is 1, we are not VOP1, VOP2, or VOP3C
--
2.34.1
next prev parent reply other threads:[~2026-01-16 20:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 20:39 [PATCH 0/5] drm/amdkfd: Trap handler fixes and gfx12.1 support Jay Cornwall
2026-01-16 20:39 ` [PATCH 1/5] drm/amdkfd: Sync trap handler binary with source Jay Cornwall
2026-01-20 22:34 ` Lancelot SIX
2026-01-21 10:27 ` Indic, Vladimir
2026-01-16 20:39 ` Jay Cornwall [this message]
2026-01-20 22:38 ` [PATCH 2/5] drm/amdkfd: Fix scalar load ordering in gfx12.1 trap handler Lancelot SIX
2026-01-21 10:32 ` Indic, Vladimir
2026-01-16 20:39 ` [PATCH 3/5] drm/amdkfd: gfx12.1 cluster barrier context save workaround Jay Cornwall
2026-01-20 23:27 ` Lancelot SIX
2026-01-21 10:37 ` Indic, Vladimir
2026-01-16 20:39 ` [PATCH 4/5] drm/amdkfd: gfx12.1 trap handler support for expert scheduling mode Jay Cornwall
2026-01-20 23:30 ` Lancelot SIX
2026-01-21 10:46 ` Indic, Vladimir
2026-01-16 20:39 ` [PATCH 5/5] drm/amdkfd: Do not include VGPR MSBs in saved PC during save Jay Cornwall
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=20260116203932.988704-3-jay.cornwall@amd.com \
--to=jay.cornwall@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=joseph.greathouse@amd.com \
--cc=lancelot.six@amd.com \
--cc=vladimir.indic@amd.com \
/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