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>,
Vladimir Indic <vladimir.indic@amd.com>,
Tishko Araz <tishko.araz@amd.com>,
Max Erenberg <max.erenberg@amd.com>
Subject: [PATCH] drm/amdkfd: Fix named barrier restore in gfx12.1 trap handler
Date: Mon, 6 Jul 2026 17:00:43 -0500 [thread overview]
Message-ID: <20260706220043.612554-1-jay.cornwall@amd.com> (raw)
Barrier state layout has non-zero fields above the signal count.
Mask these off to restore the correct signal count.
Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Cc: Lancelot Six <lancelot.six@amd.com>
Cc: Vladimir Indic <vladimir.indic@amd.com>
Cc: Tishko Araz <tishko.araz@amd.com>
Cc: Max Erenberg <max.erenberg@amd.com>
---
.../gpu/drm/amd/amdkfd/cwsr_trap_handler.h | 150 +++++++++---------
.../amd/amdkfd/cwsr_trap_handler_gfx12.asm | 2 +-
2 files changed, 77 insertions(+), 75 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index 54fa76f374c9..42e4a5773ad6 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -3929,7 +3929,7 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x00030000, 0x807d847d,
0x8070ff70, 0x00000400,
0xbf0a7b7d, 0xbfa2ffe9,
- 0xbfa0014c, 0xbef4007e,
+ 0xbfa0014d, 0xbef4007e,
0x8b75ff7f, 0x0000ffff,
0xbef1007f, 0xb8f20742,
0x84729972, 0x8b6eff7f,
@@ -4070,36 +4070,36 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0xb96ef812, 0xf4601bbb,
0xf8000030, 0xbf8a0000,
0xb96ef813, 0x8b6eff7f,
- 0x04000000, 0xbfa1000b,
+ 0x04000000, 0xbfa1000c,
0xf4601bbb, 0xf8000038,
0xbf8a0000, 0xbf0d806e,
- 0xbfa10006, 0x856e906e,
- 0x8b6e6e6e, 0xbfa10003,
- 0xbe804ec1, 0x816ec16e,
- 0xbfa0fffb, 0xbefd006f,
- 0xbefe0070, 0xbeff0071,
- 0xb97b2011, 0x857b867b,
- 0xb97b0191, 0x857b827b,
- 0xb97bba11, 0xb973f801,
- 0xb8ee3b05, 0x806e816e,
- 0xbf0d9972, 0xbfa20002,
- 0x846e896e, 0xbfa00001,
- 0x846e8a6e, 0x806eff6e,
- 0x00000240, 0x806e746e,
- 0x826f8075, 0xf4605c37,
- 0xf8000010, 0xf4605d37,
- 0xf8000020, 0xf4601e77,
- 0xf8000034, 0xbf8a0000,
- 0x8b6dff6d, 0x0000ffff,
- 0x8bfe7e7e, 0x8bea6a6a,
- 0x936eff77, 0x0002001a,
- 0xb96ef81a, 0xb97af804,
+ 0xbfa10007, 0x936eff6e,
+ 0x00070010, 0x8b6e6e6e,
+ 0xbfa10003, 0xbe804ec1,
+ 0x816ec16e, 0xbfa0fffb,
+ 0xbefd006f, 0xbefe0070,
+ 0xbeff0071, 0xb97b2011,
+ 0x857b867b, 0xb97b0191,
+ 0x857b827b, 0xb97bba11,
+ 0xb973f801, 0xb8ee3b05,
+ 0x806e816e, 0xbf0d9972,
+ 0xbfa20002, 0x846e896e,
+ 0xbfa00001, 0x846e8a6e,
+ 0x806eff6e, 0x00000240,
+ 0x806e746e, 0x826f8075,
+ 0xf4605c37, 0xf8000010,
+ 0xf4605d37, 0xf8000020,
+ 0xf4601e77, 0xf8000034,
+ 0xbf8a0000, 0x8b6dff6d,
+ 0x0000ffff, 0x8bfe7e7e,
+ 0x8bea6a6a, 0x936eff77,
+ 0x0002001a, 0xb96ef81a,
+ 0xb97af804, 0xbe804ec2,
+ 0xbf94fffe, 0xbe804a6c,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbe804ec2,
- 0xbf94fffe, 0xbfb10000,
+ 0xbfb10000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
- 0xbf9f0000, 0x00000000,
};
static const uint32_t cwsr_trap_gfx9_5_0_hex[] = {
@@ -5066,7 +5066,7 @@ static const uint32_t cwsr_trap_gfx12_1_0_hex[] = {
0x018c0000, 0x00030000,
0x807d847d, 0x8070ff70,
0x00000400, 0xbf0a7b7d,
- 0xbfa2ffe9, 0xbfa00184,
+ 0xbfa2ffe9, 0xbfa00187,
0xbef4007e, 0x8b75ff7f,
0x01ffffff, 0xbef1007f,
0xb8f20742, 0x84729972,
@@ -5208,64 +5208,66 @@ static const uint32_t cwsr_trap_gfx12_1_0_hex[] = {
0xf4601bbb, 0xf8000030,
0xbf8a0000, 0xb96ef813,
0x8b6eff7f, 0x04000000,
- 0xbfa10022, 0xf4601bbb,
+ 0xbfa10024, 0xf4601bbb,
0xf8000038, 0xbf8a0000,
- 0xbf0d806e, 0xbfa1001d,
- 0x856e906e, 0x8b6e6e6e,
- 0xbfa10003, 0xbe804ec1,
- 0x816ec16e, 0xbfa0fffb,
- 0xbef800ff, 0x00000080,
- 0xbefd0081, 0xf4601bbb,
- 0xf0000000, 0xbfc70000,
- 0x80788478, 0x937eff6e,
- 0x00070004, 0x847e907e,
- 0x8c7d7e7d, 0xbe80517d,
- 0x917dff7d, 0x007f0000,
- 0x856e906e, 0x8b6e6e6e,
+ 0xbf0d806e, 0xbfa1001f,
+ 0x936eff6e, 0x00070010,
+ 0x8b6e6e6e, 0xbfa10003,
+ 0xbe804ec1, 0x816ec16e,
+ 0xbfa0fffb, 0xbef800ff,
+ 0x00000080, 0xbefd0081,
+ 0xf4601bbb, 0xf0000000,
+ 0xbfc70000, 0x80788478,
+ 0x937eff6e, 0x00070004,
+ 0x847e907e, 0x8c7d7e7d,
+ 0xbe80517d, 0x917dff7d,
+ 0x007f0000, 0x936eff6e,
+ 0x00070010, 0x8b6e6e6e,
0xbfa10003, 0xbe804e7d,
0x816ec16e, 0xbfa0fffb,
0x807d817d, 0xbf08907d,
- 0xbfa1ffec, 0xf4601bbb,
+ 0xbfa1ffeb, 0xf4601bbb,
0xf800003c, 0xbfc70000,
- 0xbf0d806e, 0xbfa1000c,
+ 0xbf0d806e, 0xbfa1000d,
0xbf0d9a7f, 0xbfa10002,
0xbf068180, 0xbe804fc4,
- 0xbf94fffc, 0xbfa10006,
- 0x856e906e, 0x8b6e6e6e,
- 0xbfa10003, 0xbe804ec3,
- 0x816ec16e, 0xbfa0fffb,
- 0xf4601bbb, 0xf8000040,
- 0xbfc70000, 0xb96ef81a,
- 0xbefd006f, 0xbefe0070,
- 0xbeff0071, 0xb979f822,
- 0xb97b2011, 0x857b867b,
- 0xb97b0191, 0x857b827b,
- 0xb97bba11, 0xb973f801,
- 0xb8ee3b05, 0x806e816e,
- 0xbf0d9972, 0xbfa20002,
- 0x846e896e, 0xbfa00001,
- 0x846e8a6e, 0x806eff6e,
- 0x000001c0, 0x806e746e,
- 0x826f8075, 0xf4605c37,
- 0xf8000010, 0xf4605d37,
- 0xf8000020, 0xf4601e77,
- 0xf8000034, 0xbf8a0000,
- 0x856e9677, 0xb96e04a1,
- 0x856e9577, 0xb96e0421,
- 0x856e8e77, 0xb96e3021,
- 0x8b6dff6d, 0x01ffffff,
- 0x8bfe7e7e, 0x8bea6a6a,
- 0xb97af804, 0xb8eef802,
- 0xbf0c8b6e, 0xbfa20003,
- 0xbe804fc2, 0xbf94fffe,
- 0xbfa10001, 0xbe804ec4,
- 0xbf94fffc, 0x857a897a,
- 0xb97a0244, 0xbe804a6c,
+ 0xbf94fffc, 0xbfa10007,
+ 0x936eff6e, 0x00070010,
+ 0x8b6e6e6e, 0xbfa10003,
+ 0xbe804ec3, 0x816ec16e,
+ 0xbfa0fffb, 0xf4601bbb,
+ 0xf8000040, 0xbfc70000,
+ 0xb96ef81a, 0xbefd006f,
+ 0xbefe0070, 0xbeff0071,
+ 0xb979f822, 0xb97b2011,
+ 0x857b867b, 0xb97b0191,
+ 0x857b827b, 0xb97bba11,
+ 0xb973f801, 0xb8ee3b05,
+ 0x806e816e, 0xbf0d9972,
+ 0xbfa20002, 0x846e896e,
+ 0xbfa00001, 0x846e8a6e,
+ 0x806eff6e, 0x000001c0,
+ 0x806e746e, 0x826f8075,
+ 0xf4605c37, 0xf8000010,
+ 0xf4605d37, 0xf8000020,
+ 0xf4601e77, 0xf8000034,
+ 0xbf8a0000, 0x856e9677,
+ 0xb96e04a1, 0x856e9577,
+ 0xb96e0421, 0x856e8e77,
+ 0xb96e3021, 0x8b6dff6d,
+ 0x01ffffff, 0x8bfe7e7e,
+ 0x8bea6a6a, 0xb97af804,
0xb8eef802, 0xbf0c8b6e,
0xbfa20003, 0xbe804fc2,
0xbf94fffe, 0xbfa10001,
0xbe804ec4, 0xbf94fffc,
- 0xbfb10000, 0xbf9f0000,
+ 0x857a897a, 0xb97a0244,
+ 0xbe804a6c, 0xb8eef802,
+ 0xbf0c8b6e, 0xbfa20003,
+ 0xbe804fc2, 0xbf94fffe,
+ 0xbfa10001, 0xbe804ec4,
+ 0xbf94fffc, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
+ 0xbf9f0000, 0x00000000,
};
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 456db8199899..0da98cbc4c30 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm
@@ -1387,7 +1387,7 @@ end
function restore_barrier_signal_count(barrier_id)
// extract the saved signal count from s_restore_tmp
- s_lshr_b32 s_restore_tmp, s_restore_tmp, BARRIER_STATE_SIGNAL_OFFSET
+ s_bfe_u32 s_restore_tmp, s_restore_tmp, (BARRIER_STATE_SIGNAL_OFFSET | (BARRIER_STATE_SIGNAL_SIZE << 0x10))
// We need to call s_barrier_signal repeatedly to restore the signal count
// of the group/cluster barrier. The member count is already initialized.
--
2.34.1
next reply other threads:[~2026-07-06 22:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 22:00 Jay Cornwall [this message]
2026-07-07 10:42 ` [PATCH] drm/amdkfd: Fix named barrier restore in gfx12.1 trap handler Indic, Vladimir
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=20260706220043.612554-1-jay.cornwall@amd.com \
--to=jay.cornwall@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=lancelot.six@amd.com \
--cc=max.erenberg@amd.com \
--cc=tishko.araz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.