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 <[email protected]>
Cc: Lancelot Six <[email protected]>
Cc: Vladimir Indic <[email protected]>
Cc: Tishko Araz <[email protected]>
Cc: Max Erenberg <[email protected]>
---
 .../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

Reply via email to