All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdkfd: Fix gfx10 wave64 VGPR context restore
@ 2019-07-29 15:31 Cornwall, Jay
       [not found] ` <1564414258-18161-1-git-send-email-jay.cornwall-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Cornwall, Jay @ 2019-07-29 15:31 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
  Cc: Cornwall, Jay, Liu, Shaoyun

Copy/paste error, first 4 VGPRs are separated by 64 dwords (256 bytes).

Cc: Shaoyun Liu <shaoyun.liu@amd.com>
Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h         | 6 +++---
 drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index 2b3d701..c10e424 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -982,9 +982,9 @@ static const uint32_t cwsr_trap_gfx10_hex[] = {
 	0x00000080, 0xbf0a6f7c,
 	0xbf85fff7, 0xbeff03c1,
 	0xe0304000, 0x725d0000,
-	0xe0304080, 0x725d0100,
-	0xe0304100, 0x725d0200,
-	0xe0304180, 0x725d0300,
+	0xe0304100, 0x725d0100,
+	0xe0304200, 0x725d0200,
+	0xe0304300, 0x725d0300,
 	0xb9782a05, 0x80788178,
 	0x907c9973, 0x877c817c,
 	0xbf06817c, 0xbf850002,
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
index 261e054..be6f7d1 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
@@ -747,9 +747,9 @@ L_RESTORE_SHARED_VGPR_WAVE64_LOOP:
 	/* VGPR restore on v0 */
 L_RESTORE_V0:
 	buffer_load_dword	v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1
-	buffer_load_dword	v1, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:128
-	buffer_load_dword	v2, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:128*2
-	buffer_load_dword	v3, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:128*3
+	buffer_load_dword	v1, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256
+	buffer_load_dword	v2, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256*2
+	buffer_load_dword	v3, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256*3
 
 	/* restore SGPRs */
 	//will be 2+8+16*6
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] drm/amdkfd: Save/restore flat_scratch_lo/hi on gfx10
       [not found] ` <1564414258-18161-1-git-send-email-jay.cornwall-5C7GfCeVMHo@public.gmane.org>
@ 2019-07-29 15:31   ` Cornwall, Jay
  2019-07-29 15:31   ` [PATCH 3/3] drm/amdkfd: Save/restore vcc " Cornwall, Jay
  1 sibling, 0 replies; 5+ messages in thread
From: Cornwall, Jay @ 2019-07-29 15:31 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
  Cc: Cornwall, Jay, Liu, Shaoyun

These moved from SGPRs in gfx9 to HWREG in gfx10.

Cc: Shaoyun Liu <shaoyun.liu@amd.com>
Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h     | 56 +++++++++++++---------
 .../gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm | 14 ++++++
 2 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index c10e424..8089bb3 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -680,7 +680,7 @@ static const uint32_t cwsr_trap_gfx9_hex[] = {
 };
 
 static const uint32_t cwsr_trap_gfx10_hex[] = {
-	0xbf820001, 0xbf8201b2,
+	0xbf820001, 0xbf8201c0,
 	0xb0804004, 0xb978f802,
 	0x8a788678, 0xb971f803,
 	0x876eff71, 0x00000400,
@@ -772,6 +772,13 @@ static const uint32_t cwsr_trap_gfx10_hex[] = {
 	0xb97bf801, 0xbefe037c,
 	0xbefc037a, 0xf4611efa,
 	0xf8000000, 0x807a847a,
+	0xbefc037e, 0xb97bf814,
+	0xbefe037c, 0xbefc037a,
+	0xf4611efa, 0xf8000000,
+	0x807a847a, 0xbefc037e,
+	0xb97bf815, 0xbefe037c,
+	0xbefc037a, 0xf4611efa,
+	0xf8000000, 0x807a847a,
 	0xbefc037e, 0x8776ff7f,
 	0x04000000, 0xbeef0380,
 	0x886f6f76, 0xb97a2a05,
@@ -897,7 +904,7 @@ static const uint32_t cwsr_trap_gfx10_hex[] = {
 	0xe0704000, 0x7a5d0000,
 	0x807c817c, 0x807aff7a,
 	0x00000080, 0xbf0a717c,
-	0xbf85fff8, 0xbf820138,
+	0xbf85fff8, 0xbf820141,
 	0xbef4037e, 0x8775ff7f,
 	0x0000ffff, 0x8875ff75,
 	0x00040000, 0xbef60380,
@@ -1033,30 +1040,35 @@ static const uint32_t cwsr_trap_gfx10_hex[] = {
 	0x80788478, 0xf4211e7a,
 	0xf0000000, 0x80788478,
 	0xf4211cfa, 0xf0000000,
+	0x80788478, 0xf4211bba,
+	0xf0000000, 0x80788478,
+	0xbf8cc07f, 0xb9eef814,
+	0xf4211bba, 0xf0000000,
 	0x80788478, 0xbf8cc07f,
-	0xbef2036d, 0x876dff72,
-	0x0000ffff, 0xbefc036f,
-	0xbefe037a, 0xbeff037b,
-	0x876f71ff, 0x000003ff,
-	0xb9ef4803, 0xb9f9f816,
-	0x876f71ff, 0xfffff800,
-	0x906f8b6f, 0xb9efa2c3,
-	0xb9f3f801, 0x876fff72,
-	0xfc000000, 0x906f9a6f,
-	0x8f6f906f, 0xbef30380,
+	0xb9eef815, 0xbef2036d,
+	0x876dff72, 0x0000ffff,
+	0xbefc036f, 0xbefe037a,
+	0xbeff037b, 0x876f71ff,
+	0x000003ff, 0xb9ef4803,
+	0xb9f9f816, 0x876f71ff,
+	0xfffff800, 0x906f8b6f,
+	0xb9efa2c3, 0xb9f3f801,
+	0x876fff72, 0xfc000000,
+	0x906f9a6f, 0x8f6f906f,
+	0xbef30380, 0x88736f73,
+	0x876fff72, 0x02000000,
+	0x906f996f, 0x8f6f8f6f,
 	0x88736f73, 0x876fff72,
-	0x02000000, 0x906f996f,
-	0x8f6f8f6f, 0x88736f73,
-	0x876fff72, 0x01000000,
-	0x906f986f, 0x8f6f996f,
-	0x88736f73, 0x876fff70,
-	0x00800000, 0x906f976f,
-	0xb9f3f807, 0x87fe7e7e,
-	0x87ea6a6a, 0xb9f0f802,
-	0xbf8a0000, 0xbe80226c,
-	0xbf810000, 0xbf9f0000,
+	0x01000000, 0x906f986f,
+	0x8f6f996f, 0x88736f73,
+	0x876fff70, 0x00800000,
+	0x906f976f, 0xb9f3f807,
+	0x87fe7e7e, 0x87ea6a6a,
+	0xb9f0f802, 0xbf8a0000,
+	0xbe80226c, 0xbf810000,
 	0xbf9f0000, 0xbf9f0000,
 	0xbf9f0000, 0xbf9f0000,
+	0xbf9f0000, 0x00000000,
 };
 static const uint32_t cwsr_trap_arcturus_hex[] = {
 	0xbf820001, 0xbf8202c4,
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
index be6f7d1..fafdfd2 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
@@ -132,6 +132,7 @@ var s_restore_tmp				= ttmp6
 var s_restore_mem_offset_save			= s_restore_tmp
 var s_restore_m0				= s_restore_alloc_size
 var s_restore_mode				= ttmp7
+var s_restore_flat_scratch			= ttmp2
 var s_restore_pc_lo				= ttmp0
 var s_restore_pc_hi				= ttmp1
 var s_restore_exec_lo				= ttmp14
@@ -313,6 +314,12 @@ L_SAVE_HWREG:
 	s_getreg_b32	s_save_m0, hwreg(HW_REG_MODE)
 	write_hwreg_to_mem(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset)
 
+	s_getreg_b32	s_save_m0, hwreg(HW_REG_SHADER_FLAT_SCRATCH_LO)
+	write_hwreg_to_mem(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset)
+
+	s_getreg_b32	s_save_m0, hwreg(HW_REG_SHADER_FLAT_SCRATCH_HI)
+	write_hwreg_to_mem(s_save_m0, s_save_buf_rsrc0, s_save_mem_offset)
+
 	/* the first wave in the threadgroup */
 	s_and_b32	s_save_tmp, s_save_spi_init_hi, S_SAVE_SPI_INIT_FIRST_WAVE_MASK
 	s_mov_b32	s_save_exec_hi, 0x0
@@ -824,9 +831,16 @@ L_RESTORE_HWREG:
 	read_hwreg_from_mem(s_restore_trapsts, s_restore_buf_rsrc0, s_restore_mem_offset)
 	read_hwreg_from_mem(s_restore_xnack_mask, s_restore_buf_rsrc0, s_restore_mem_offset)
 	read_hwreg_from_mem(s_restore_mode, s_restore_buf_rsrc0, s_restore_mem_offset)
+	read_hwreg_from_mem(s_restore_flat_scratch, s_restore_buf_rsrc0, s_restore_mem_offset)
+	s_waitcnt	lgkmcnt(0)
+
+	s_setreg_b32	hwreg(HW_REG_SHADER_FLAT_SCRATCH_LO), s_restore_flat_scratch
 
+	read_hwreg_from_mem(s_restore_flat_scratch, s_restore_buf_rsrc0, s_restore_mem_offset)
 	s_waitcnt	lgkmcnt(0)						//from now on, it is safe to restore STATUS and IB_STS
 
+	s_setreg_b32	hwreg(HW_REG_SHADER_FLAT_SCRATCH_HI), s_restore_flat_scratch
+
 	s_mov_b32	s_restore_tmp, s_restore_pc_hi
 	s_and_b32	s_restore_pc_hi, s_restore_tmp, 0x0000ffff		//pc[47:32] //Do it here in order not to affect STATUS
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] drm/amdkfd: Save/restore vcc on gfx10
       [not found] ` <1564414258-18161-1-git-send-email-jay.cornwall-5C7GfCeVMHo@public.gmane.org>
  2019-07-29 15:31   ` [PATCH 2/3] drm/amdkfd: Save/restore flat_scratch_lo/hi on gfx10 Cornwall, Jay
@ 2019-07-29 15:31   ` Cornwall, Jay
       [not found]     ` <1564414258-18161-3-git-send-email-jay.cornwall-5C7GfCeVMHo@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Cornwall, Jay @ 2019-07-29 15:31 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
  Cc: Cornwall, Jay, Liu, Shaoyun

VCC moved out of user SGPR allocation in gfx10. It's now stored
in SGPRs 106-107.

Also fixes incorrect SGPR read offsets.

Cc: Shaoyun Liu <shaoyun.liu@amd.com>
Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h     | 452 ++++++++++-----------
 .../gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm |  34 +-
 2 files changed, 243 insertions(+), 243 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index 8089bb3..a8cf82d 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -680,7 +680,7 @@ static const uint32_t cwsr_trap_gfx9_hex[] = {
 };
 
 static const uint32_t cwsr_trap_gfx10_hex[] = {
-	0xbf820001, 0xbf8201c0,
+	0xbf820001, 0xbf8201c1,
 	0xb0804004, 0xb978f802,
 	0x8a788678, 0xb971f803,
 	0x876eff71, 0x00000400,
@@ -804,271 +804,271 @@ static const uint32_t cwsr_trap_gfx10_hex[] = {
 	0x00000060, 0xbf85ffea,
 	0xbe802f00, 0xbe822f02,
 	0xbe842f04, 0xbe862f06,
-	0xbe882f08, 0xf469003a,
-	0xfa000000, 0xf469013a,
-	0xfa000010, 0xf465023a,
-	0xfa000020, 0x8074c074,
-	0x82758075, 0xbef40372,
-	0xbefa0380, 0xbefe03c1,
-	0x907c9973, 0x877c817c,
-	0xbf06817c, 0xbf850002,
-	0xbeff0380, 0xbf820002,
-	0xbeff03c1, 0xbf82000b,
+	0xbe882f08, 0xbe8a2f0a,
+	0xf469003a, 0xfa000000,
+	0xf469013a, 0xfa000010,
+	0xf469023a, 0xfa000020,
+	0x8074b074, 0x82758075,
+	0xbef40372, 0xbefa0380,
+	0xbefe03c1, 0x907c9973,
+	0x877c817c, 0xbf06817c,
+	0xbf850002, 0xbeff0380,
+	0xbf820002, 0xbeff03c1,
+	0xbf82000b, 0xbef603ff,
+	0x01000000, 0xe0704000,
+	0x7a5d0000, 0xe0704080,
+	0x7a5d0100, 0xe0704100,
+	0x7a5d0200, 0xe0704180,
+	0x7a5d0300, 0xbf82000a,
 	0xbef603ff, 0x01000000,
 	0xe0704000, 0x7a5d0000,
-	0xe0704080, 0x7a5d0100,
-	0xe0704100, 0x7a5d0200,
-	0xe0704180, 0x7a5d0300,
-	0xbf82000a, 0xbef603ff,
-	0x01000000, 0xe0704000,
-	0x7a5d0000, 0xe0704100,
-	0x7a5d0100, 0xe0704200,
-	0x7a5d0200, 0xe0704300,
-	0x7a5d0300, 0xbefe03c1,
+	0xe0704100, 0x7a5d0100,
+	0xe0704200, 0x7a5d0200,
+	0xe0704300, 0x7a5d0300,
+	0xbefe03c1, 0x907c9973,
+	0x877c817c, 0xbf06817c,
+	0xbf850002, 0xbeff0380,
+	0xbf820001, 0xbeff03c1,
+	0xb9714306, 0x8771c171,
+	0xbf840046, 0xbf8a0000,
+	0x8776ff6f, 0x04000000,
+	0xbf840042, 0x8f718671,
+	0x8f718271, 0xbef60371,
+	0xb97a2a05, 0x807a817a,
 	0x907c9973, 0x877c817c,
 	0xbf06817c, 0xbf850002,
-	0xbeff0380, 0xbf820001,
-	0xbeff03c1, 0xb9714306,
-	0x8771c171, 0xbf840046,
-	0xbf8a0000, 0x8776ff6f,
-	0x04000000, 0xbf840042,
-	0x8f718671, 0x8f718271,
-	0xbef60371, 0xb97a2a05,
-	0x807a817a, 0x907c9973,
+	0x8f7a897a, 0xbf820001,
+	0x8f7a8a7a, 0xb9761e06,
+	0x8f768a76, 0x807a767a,
+	0x807aff7a, 0x00000200,
+	0x807aff7a, 0x00000080,
+	0xbef603ff, 0x01000000,
+	0xd7650000, 0x000100c1,
+	0xd7660000, 0x000200c1,
+	0x16000084, 0x907c9973,
 	0x877c817c, 0xbf06817c,
-	0xbf850002, 0x8f7a897a,
-	0xbf820001, 0x8f7a8a7a,
-	0xb9761e06, 0x8f768a76,
-	0x807a767a, 0x807aff7a,
-	0x00000200, 0x807aff7a,
-	0x00000080, 0xbef603ff,
-	0x01000000, 0xd7650000,
-	0x000100c1, 0xd7660000,
-	0x000200c1, 0x16000084,
-	0x907c9973, 0x877c817c,
-	0xbf06817c, 0xbefc0380,
-	0xbf850012, 0xbe8303ff,
-	0x00000080, 0xbf800000,
+	0xbefc0380, 0xbf850012,
+	0xbe8303ff, 0x00000080,
 	0xbf800000, 0xbf800000,
-	0xd8d80000, 0x01000000,
-	0xbf8c0000, 0xe0704000,
-	0x7a5d0100, 0x807c037c,
-	0x807a037a, 0xd5250000,
-	0x0001ff00, 0x00000080,
-	0xbf0a717c, 0xbf85fff4,
-	0xbf820011, 0xbe8303ff,
-	0x00000100, 0xbf800000,
+	0xbf800000, 0xd8d80000,
+	0x01000000, 0xbf8c0000,
+	0xe0704000, 0x7a5d0100,
+	0x807c037c, 0x807a037a,
+	0xd5250000, 0x0001ff00,
+	0x00000080, 0xbf0a717c,
+	0xbf85fff4, 0xbf820011,
+	0xbe8303ff, 0x00000100,
 	0xbf800000, 0xbf800000,
-	0xd8d80000, 0x01000000,
-	0xbf8c0000, 0xe0704000,
-	0x7a5d0100, 0x807c037c,
-	0x807a037a, 0xd5250000,
-	0x0001ff00, 0x00000100,
-	0xbf0a717c, 0xbf85fff4,
-	0xbefe03c1, 0x907c9973,
-	0x877c817c, 0xbf06817c,
-	0xbf850004, 0xbefa03ff,
-	0x00000200, 0xbeff0380,
-	0xbf820003, 0xbefa03ff,
-	0x00000400, 0xbeff03c1,
-	0xb9712a05, 0x80718171,
-	0x8f718271, 0x907c9973,
-	0x877c817c, 0xbf06817c,
-	0xbf850017, 0xbef603ff,
-	0x01000000, 0xbefc0384,
-	0xbf0a717c, 0xbf840037,
-	0x7e008700, 0x7e028701,
-	0x7e048702, 0x7e068703,
-	0xe0704000, 0x7a5d0000,
-	0xe0704080, 0x7a5d0100,
-	0xe0704100, 0x7a5d0200,
-	0xe0704180, 0x7a5d0300,
-	0x807c847c, 0x807aff7a,
-	0x00000200, 0xbf0a717c,
-	0xbf85ffef, 0xbf820025,
+	0xbf800000, 0xd8d80000,
+	0x01000000, 0xbf8c0000,
+	0xe0704000, 0x7a5d0100,
+	0x807c037c, 0x807a037a,
+	0xd5250000, 0x0001ff00,
+	0x00000100, 0xbf0a717c,
+	0xbf85fff4, 0xbefe03c1,
+	0x907c9973, 0x877c817c,
+	0xbf06817c, 0xbf850004,
+	0xbefa03ff, 0x00000200,
+	0xbeff0380, 0xbf820003,
+	0xbefa03ff, 0x00000400,
+	0xbeff03c1, 0xb9712a05,
+	0x80718171, 0x8f718271,
+	0x907c9973, 0x877c817c,
+	0xbf06817c, 0xbf850017,
 	0xbef603ff, 0x01000000,
 	0xbefc0384, 0xbf0a717c,
-	0xbf840020, 0x7e008700,
+	0xbf840037, 0x7e008700,
 	0x7e028701, 0x7e048702,
 	0x7e068703, 0xe0704000,
-	0x7a5d0000, 0xe0704100,
-	0x7a5d0100, 0xe0704200,
-	0x7a5d0200, 0xe0704300,
+	0x7a5d0000, 0xe0704080,
+	0x7a5d0100, 0xe0704100,
+	0x7a5d0200, 0xe0704180,
 	0x7a5d0300, 0x807c847c,
-	0x807aff7a, 0x00000400,
+	0x807aff7a, 0x00000200,
 	0xbf0a717c, 0xbf85ffef,
-	0xb9711e06, 0x8771c171,
-	0xbf84000c, 0x8f718371,
-	0x80717c71, 0xbefe03c1,
-	0xbeff0380, 0x7e008700,
+	0xbf820025, 0xbef603ff,
+	0x01000000, 0xbefc0384,
+	0xbf0a717c, 0xbf840020,
+	0x7e008700, 0x7e028701,
+	0x7e048702, 0x7e068703,
 	0xe0704000, 0x7a5d0000,
-	0x807c817c, 0x807aff7a,
-	0x00000080, 0xbf0a717c,
-	0xbf85fff8, 0xbf820141,
-	0xbef4037e, 0x8775ff7f,
-	0x0000ffff, 0x8875ff75,
-	0x00040000, 0xbef60380,
-	0xbef703ff, 0x10807fac,
-	0x8772ff7f, 0x08000000,
-	0x90728372, 0x88777277,
-	0x8772ff7f, 0x70000000,
-	0x90728172, 0x88777277,
-	0xb97302dc, 0x8f739973,
-	0x8873737f, 0x8772ff7f,
-	0x04000000, 0xbf840036,
-	0xbefe03c1, 0x907c9973,
-	0x877c817c, 0xbf06817c,
-	0xbf850002, 0xbeff0380,
-	0xbf820001, 0xbeff03c1,
-	0xb96f4306, 0x876fc16f,
-	0xbf84002b, 0x8f6f866f,
-	0x8f6f826f, 0xbef6036f,
-	0xb9782a05, 0x80788178,
+	0xe0704100, 0x7a5d0100,
+	0xe0704200, 0x7a5d0200,
+	0xe0704300, 0x7a5d0300,
+	0x807c847c, 0x807aff7a,
+	0x00000400, 0xbf0a717c,
+	0xbf85ffef, 0xb9711e06,
+	0x8771c171, 0xbf84000c,
+	0x8f718371, 0x80717c71,
+	0xbefe03c1, 0xbeff0380,
+	0x7e008700, 0xe0704000,
+	0x7a5d0000, 0x807c817c,
+	0x807aff7a, 0x00000080,
+	0xbf0a717c, 0xbf85fff8,
+	0xbf820141, 0xbef4037e,
+	0x8775ff7f, 0x0000ffff,
+	0x8875ff75, 0x00040000,
+	0xbef60380, 0xbef703ff,
+	0x10807fac, 0x8772ff7f,
+	0x08000000, 0x90728372,
+	0x88777277, 0x8772ff7f,
+	0x70000000, 0x90728172,
+	0x88777277, 0xb97302dc,
+	0x8f739973, 0x8873737f,
+	0x8772ff7f, 0x04000000,
+	0xbf840036, 0xbefe03c1,
 	0x907c9973, 0x877c817c,
 	0xbf06817c, 0xbf850002,
-	0x8f788978, 0xbf820001,
-	0x8f788a78, 0xb9721e06,
-	0x8f728a72, 0x80787278,
-	0x8078ff78, 0x00000200,
-	0x8078ff78, 0x00000080,
-	0xbef603ff, 0x01000000,
-	0x907c9973, 0x877c817c,
-	0xbf06817c, 0xbefc0380,
-	0xbf850009, 0xe0310000,
-	0x781d0000, 0x807cff7c,
-	0x00000080, 0x8078ff78,
-	0x00000080, 0xbf0a6f7c,
-	0xbf85fff8, 0xbf820008,
+	0xbeff0380, 0xbf820001,
+	0xbeff03c1, 0xb96f4306,
+	0x876fc16f, 0xbf84002b,
+	0x8f6f866f, 0x8f6f826f,
+	0xbef6036f, 0xb9782a05,
+	0x80788178, 0x907c9973,
+	0x877c817c, 0xbf06817c,
+	0xbf850002, 0x8f788978,
+	0xbf820001, 0x8f788a78,
+	0xb9721e06, 0x8f728a72,
+	0x80787278, 0x8078ff78,
+	0x00000200, 0x8078ff78,
+	0x00000080, 0xbef603ff,
+	0x01000000, 0x907c9973,
+	0x877c817c, 0xbf06817c,
+	0xbefc0380, 0xbf850009,
 	0xe0310000, 0x781d0000,
-	0x807cff7c, 0x00000100,
-	0x8078ff78, 0x00000100,
+	0x807cff7c, 0x00000080,
+	0x8078ff78, 0x00000080,
 	0xbf0a6f7c, 0xbf85fff8,
-	0xbef80380, 0xbefe03c1,
-	0x907c9973, 0x877c817c,
-	0xbf06817c, 0xbf850002,
-	0xbeff0380, 0xbf820001,
-	0xbeff03c1, 0xb96f2a05,
-	0x806f816f, 0x8f6f826f,
-	0x907c9973, 0x877c817c,
-	0xbf06817c, 0xbf850021,
-	0xbef603ff, 0x01000000,
-	0xbef20378, 0x8078ff78,
-	0x00000200, 0xbefc0384,
-	0xe0304000, 0x785d0000,
-	0xe0304080, 0x785d0100,
-	0xe0304100, 0x785d0200,
-	0xe0304180, 0x785d0300,
-	0xbf8c3f70, 0x7e008500,
-	0x7e028501, 0x7e048502,
-	0x7e068503, 0x807c847c,
-	0x8078ff78, 0x00000200,
-	0xbf0a6f7c, 0xbf85ffee,
-	0xe0304000, 0x725d0000,
-	0xe0304080, 0x725d0100,
-	0xe0304100, 0x725d0200,
-	0xe0304180, 0x725d0300,
-	0xbf820031, 0xbef603ff,
+	0xbf820008, 0xe0310000,
+	0x781d0000, 0x807cff7c,
+	0x00000100, 0x8078ff78,
+	0x00000100, 0xbf0a6f7c,
+	0xbf85fff8, 0xbef80380,
+	0xbefe03c1, 0x907c9973,
+	0x877c817c, 0xbf06817c,
+	0xbf850002, 0xbeff0380,
+	0xbf820001, 0xbeff03c1,
+	0xb96f2a05, 0x806f816f,
+	0x8f6f826f, 0x907c9973,
+	0x877c817c, 0xbf06817c,
+	0xbf850021, 0xbef603ff,
 	0x01000000, 0xbef20378,
-	0x8078ff78, 0x00000400,
+	0x8078ff78, 0x00000200,
 	0xbefc0384, 0xe0304000,
-	0x785d0000, 0xe0304100,
-	0x785d0100, 0xe0304200,
-	0x785d0200, 0xe0304300,
+	0x785d0000, 0xe0304080,
+	0x785d0100, 0xe0304100,
+	0x785d0200, 0xe0304180,
 	0x785d0300, 0xbf8c3f70,
 	0x7e008500, 0x7e028501,
 	0x7e048502, 0x7e068503,
 	0x807c847c, 0x8078ff78,
-	0x00000400, 0xbf0a6f7c,
-	0xbf85ffee, 0xb96f1e06,
-	0x876fc16f, 0xbf84000e,
-	0x8f6f836f, 0x806f7c6f,
-	0xbefe03c1, 0xbeff0380,
+	0x00000200, 0xbf0a6f7c,
+	0xbf85ffee, 0xe0304000,
+	0x725d0000, 0xe0304080,
+	0x725d0100, 0xe0304100,
+	0x725d0200, 0xe0304180,
+	0x725d0300, 0xbf820031,
+	0xbef603ff, 0x01000000,
+	0xbef20378, 0x8078ff78,
+	0x00000400, 0xbefc0384,
 	0xe0304000, 0x785d0000,
+	0xe0304100, 0x785d0100,
+	0xe0304200, 0x785d0200,
+	0xe0304300, 0x785d0300,
 	0xbf8c3f70, 0x7e008500,
-	0x807c817c, 0x8078ff78,
-	0x00000080, 0xbf0a6f7c,
-	0xbf85fff7, 0xbeff03c1,
-	0xe0304000, 0x725d0000,
-	0xe0304100, 0x725d0100,
-	0xe0304200, 0x725d0200,
-	0xe0304300, 0x725d0300,
-	0xb9782a05, 0x80788178,
-	0x907c9973, 0x877c817c,
-	0xbf06817c, 0xbf850002,
-	0x8f788978, 0xbf820001,
-	0x8f788a78, 0xb9721e06,
-	0x8f728a72, 0x80787278,
-	0x8078ff78, 0x00000200,
-	0x80f8ff78, 0x00000058,
-	0x80f88878, 0xbef603ff,
+	0x7e028501, 0x7e048502,
+	0x7e068503, 0x807c847c,
+	0x8078ff78, 0x00000400,
+	0xbf0a6f7c, 0xbf85ffee,
+	0xb96f1e06, 0x876fc16f,
+	0xbf84000e, 0x8f6f836f,
+	0x806f7c6f, 0xbefe03c1,
+	0xbeff0380, 0xe0304000,
+	0x785d0000, 0xbf8c3f70,
+	0x7e008500, 0x807c817c,
+	0x8078ff78, 0x00000080,
+	0xbf0a6f7c, 0xbf85fff7,
+	0xbeff03c1, 0xe0304000,
+	0x725d0000, 0xe0304100,
+	0x725d0100, 0xe0304200,
+	0x725d0200, 0xe0304300,
+	0x725d0300, 0xb9782a05,
+	0x80788178, 0x907c9973,
+	0x877c817c, 0xbf06817c,
+	0xbf850002, 0x8f788978,
+	0xbf820001, 0x8f788a78,
+	0xb9721e06, 0x8f728a72,
+	0x80787278, 0x8078ff78,
+	0x00000200, 0x80f8ff78,
+	0x00000050, 0xbef603ff,
 	0x01000000, 0xbefc03ff,
-	0x0000006a, 0xf425003a,
-	0xf0000000, 0x80f8a078,
-	0xbf8cc07f, 0x80fc827c,
+	0x0000006c, 0x80f89078,
+	0xf429003a, 0xf0000000,
+	0xbf8cc07f, 0x80fc847c,
 	0xbf800000, 0xbe803100,
+	0xbe823102, 0x80f8a078,
 	0xf42d003a, 0xf0000000,
-	0x80f8c078, 0xbf8cc07f,
-	0x80fc887c, 0xbf800000,
-	0xbe803100, 0xbe823102,
-	0xbe843104, 0xbe863106,
+	0xbf8cc07f, 0x80fc887c,
+	0xbf800000, 0xbe803100,
+	0xbe823102, 0xbe843104,
+	0xbe863106, 0x80f8c078,
 	0xf431003a, 0xf0000000,
-	0x80f8c078, 0xbf8cc07f,
-	0x80fc907c, 0xbf800000,
-	0xbe803100, 0xbe823102,
-	0xbe843104, 0xbe863106,
-	0xbe883108, 0xbe8a310a,
-	0xbe8c310c, 0xbe8e310e,
-	0xbf06807c, 0xbf84fff0,
-	0xb9782a05, 0x80788178,
-	0x907c9973, 0x877c817c,
-	0xbf06817c, 0xbf850002,
-	0x8f788978, 0xbf820001,
-	0x8f788a78, 0xb9721e06,
-	0x8f728a72, 0x80787278,
-	0x8078ff78, 0x00000200,
-	0xbef603ff, 0x01000000,
-	0xf4211bfa, 0xf0000000,
-	0x80788478, 0xf4211b3a,
+	0xbf8cc07f, 0x80fc907c,
+	0xbf800000, 0xbe803100,
+	0xbe823102, 0xbe843104,
+	0xbe863106, 0xbe883108,
+	0xbe8a310a, 0xbe8c310c,
+	0xbe8e310e, 0xbf06807c,
+	0xbf84fff0, 0xb9782a05,
+	0x80788178, 0x907c9973,
+	0x877c817c, 0xbf06817c,
+	0xbf850002, 0x8f788978,
+	0xbf820001, 0x8f788a78,
+	0xb9721e06, 0x8f728a72,
+	0x80787278, 0x8078ff78,
+	0x00000200, 0xbef603ff,
+	0x01000000, 0xf4211bfa,
 	0xf0000000, 0x80788478,
-	0xf4211b7a, 0xf0000000,
-	0x80788478, 0xf4211eba,
+	0xf4211b3a, 0xf0000000,
+	0x80788478, 0xf4211b7a,
 	0xf0000000, 0x80788478,
-	0xf4211efa, 0xf0000000,
-	0x80788478, 0xf4211c3a,
+	0xf4211eba, 0xf0000000,
+	0x80788478, 0xf4211efa,
 	0xf0000000, 0x80788478,
-	0xf4211c7a, 0xf0000000,
-	0x80788478, 0xf4211e7a,
+	0xf4211c3a, 0xf0000000,
+	0x80788478, 0xf4211c7a,
 	0xf0000000, 0x80788478,
-	0xf4211cfa, 0xf0000000,
-	0x80788478, 0xf4211bba,
+	0xf4211e7a, 0xf0000000,
+	0x80788478, 0xf4211cfa,
 	0xf0000000, 0x80788478,
-	0xbf8cc07f, 0xb9eef814,
 	0xf4211bba, 0xf0000000,
 	0x80788478, 0xbf8cc07f,
-	0xb9eef815, 0xbef2036d,
-	0x876dff72, 0x0000ffff,
-	0xbefc036f, 0xbefe037a,
-	0xbeff037b, 0x876f71ff,
-	0x000003ff, 0xb9ef4803,
-	0xb9f9f816, 0x876f71ff,
-	0xfffff800, 0x906f8b6f,
-	0xb9efa2c3, 0xb9f3f801,
-	0x876fff72, 0xfc000000,
-	0x906f9a6f, 0x8f6f906f,
-	0xbef30380, 0x88736f73,
-	0x876fff72, 0x02000000,
-	0x906f996f, 0x8f6f8f6f,
+	0xb9eef814, 0xf4211bba,
+	0xf0000000, 0x80788478,
+	0xbf8cc07f, 0xb9eef815,
+	0xbef2036d, 0x876dff72,
+	0x0000ffff, 0xbefc036f,
+	0xbefe037a, 0xbeff037b,
+	0x876f71ff, 0x000003ff,
+	0xb9ef4803, 0xb9f9f816,
+	0x876f71ff, 0xfffff800,
+	0x906f8b6f, 0xb9efa2c3,
+	0xb9f3f801, 0x876fff72,
+	0xfc000000, 0x906f9a6f,
+	0x8f6f906f, 0xbef30380,
 	0x88736f73, 0x876fff72,
-	0x01000000, 0x906f986f,
-	0x8f6f996f, 0x88736f73,
-	0x876fff70, 0x00800000,
-	0x906f976f, 0xb9f3f807,
-	0x87fe7e7e, 0x87ea6a6a,
-	0xb9f0f802, 0xbf8a0000,
-	0xbe80226c, 0xbf810000,
+	0x02000000, 0x906f996f,
+	0x8f6f8f6f, 0x88736f73,
+	0x876fff72, 0x01000000,
+	0x906f986f, 0x8f6f996f,
+	0x88736f73, 0x876fff70,
+	0x00800000, 0x906f976f,
+	0xb9f3f807, 0x87fe7e7e,
+	0x87ea6a6a, 0xb9f0f802,
+	0xbf8a0000, 0xbe80226c,
+	0xbf810000, 0xbf9f0000,
 	0xbf9f0000, 0xbf9f0000,
 	0xbf9f0000, 0xbf9f0000,
-	0xbf9f0000, 0x00000000,
 };
 static const uint32_t cwsr_trap_arcturus_hex[] = {
 	0xbf820001, 0xbf8202c4,
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
index fafdfd2..3598621 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
@@ -87,7 +87,7 @@ var S_SAVE_PC_HI_FIRST_REPLAY_MASK		= 0x02000000
 var S_SAVE_PC_HI_REPLAY_W64H_SHIFT		= 24
 var S_SAVE_PC_HI_REPLAY_W64H_MASK		= 0x01000000
 
-var s_sgpr_save_num				= 106
+var s_sgpr_save_num				= 108
 
 var s_save_spi_init_lo				= exec_lo
 var s_save_spi_init_hi				= exec_hi
@@ -357,13 +357,14 @@ L_SAVE_SGPR_LOOP:
 	s_cmp_lt_u32	m0, 96							//scc = (m0 < first 96 SGPR) ? 1 : 0
 	s_cbranch_scc1	L_SAVE_SGPR_LOOP					//first 96 SGPR save is complete?
 
-	//save the rest 10 SGPR
+	//save the rest 12 SGPR
 	s_movrels_b64	s0, s0							//s0 = s[0+m0], s1 = s[1+m0]
 	s_movrels_b64	s2, s2							//s2 = s[2+m0], s3 = s[3+m0]
 	s_movrels_b64	s4, s4							//s4 = s[4+m0], s5 = s[5+m0]
 	s_movrels_b64	s6, s6							//s6 = s[6+m0], s7 = s[7+m0]
 	s_movrels_b64	s8, s8							//s8 = s[8+m0], s9 = s[9+m0]
-	write_10sgpr_to_mem(s0, s_save_buf_rsrc0, s_save_mem_offset)
+	s_movrels_b64	s10, s10						//s10 = s[10+m0], s11 = s[11+m0]
+	write_12sgpr_to_mem(s0, s_save_buf_rsrc0, s_save_mem_offset)
 
 	// restore s_save_buf_rsrc0,1
 	s_mov_b32	s_save_buf_rsrc0, s_save_xnack_mask
@@ -766,26 +767,25 @@ L_RESTORE_SGPR:
 	get_svgpr_size_bytes(s_restore_tmp)
 	s_add_u32	s_restore_mem_offset, s_restore_mem_offset, s_restore_tmp
 	s_add_u32	s_restore_mem_offset, s_restore_mem_offset, get_sgpr_size_bytes()
-	s_sub_u32	s_restore_mem_offset, s_restore_mem_offset, 22*4	//s106~s127 is not saved
-	s_sub_u32	s_restore_mem_offset, s_restore_mem_offset, 2*4		// restore SGPR from S[n] to S[0], by 2 sgprs group
+	s_sub_u32	s_restore_mem_offset, s_restore_mem_offset, 20*4	//s108~s127 is not saved
 
 	s_mov_b32	s_restore_buf_rsrc2, 0x1000000				//NUM_RECORDS in bytes
 
 	s_mov_b32	m0, s_sgpr_save_num
 
-	read_2sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
-
+	read_4sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
 	s_waitcnt	lgkmcnt(0)
 
-	s_sub_u32	m0, m0, 2						// Restore from S[n] to S[0]
+	s_sub_u32	m0, m0, 4						// Restore from S[0] to S[104]
 	s_nop		0							// hazard SALU M0=> S_MOVREL
 
 	s_movreld_b64	s0, s0							//s[0+m0] = s0
+	s_movreld_b64	s2, s2
 
 	read_8sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
 	s_waitcnt	lgkmcnt(0)
 
-	s_sub_u32	m0, m0, 8						// Restore from S[n] to S[0]
+	s_sub_u32	m0, m0, 8						// Restore from S[0] to S[96]
 	s_nop		0							// hazard SALU M0=> S_MOVREL
 
 	s_movreld_b64	s0, s0							//s[0+m0] = s0
@@ -903,11 +903,11 @@ function write_16sgpr_to_mem(s, s_rsrc, s_mem_offset)
 	s_addc_u32	s_rsrc[1], s_rsrc[1], 0x0
 end
 
-function write_10sgpr_to_mem(s, s_rsrc, s_mem_offset)
+function write_12sgpr_to_mem(s, s_rsrc, s_mem_offset)
 	s_buffer_store_dwordx4	s[0], s_rsrc, 0 glc:1
 	s_buffer_store_dwordx4	s[4], s_rsrc, 16 glc:1
-	s_buffer_store_dwordx2	s[8], s_rsrc, 32 glc:1
-	s_add_u32	s_rsrc[0], s_rsrc[0], 4*16
+	s_buffer_store_dwordx4	s[8], s_rsrc, 32 glc:1
+	s_add_u32	s_rsrc[0], s_rsrc[0], 4*12
 	s_addc_u32	s_rsrc[1], s_rsrc[1], 0x0
 end
 
@@ -918,18 +918,18 @@ function read_hwreg_from_mem(s, s_rsrc, s_mem_offset)
 end
 
 function read_16sgpr_from_mem(s, s_rsrc, s_mem_offset)
-	s_buffer_load_dwordx16	s, s_rsrc, s_mem_offset glc:1
 	s_sub_u32	s_mem_offset, s_mem_offset, 4*16
+	s_buffer_load_dwordx16	s, s_rsrc, s_mem_offset glc:1
 end
 
 function read_8sgpr_from_mem(s, s_rsrc, s_mem_offset)
+	s_sub_u32	s_mem_offset, s_mem_offset, 4*8
 	s_buffer_load_dwordx8	s, s_rsrc, s_mem_offset glc:1
-	s_sub_u32	s_mem_offset, s_mem_offset, 4*16
 end
 
-function read_2sgpr_from_mem(s, s_rsrc, s_mem_offset)
-	s_buffer_load_dwordx2 s, s_rsrc, s_mem_offset glc:1
-	s_sub_u32	s_mem_offset, s_mem_offset, 4*8
+function read_4sgpr_from_mem(s, s_rsrc, s_mem_offset)
+	s_sub_u32	s_mem_offset, s_mem_offset, 4*4
+	s_buffer_load_dwordx4	s, s_rsrc, s_mem_offset glc:1
 end
 
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] drm/amdkfd: Save/restore vcc on gfx10
       [not found]     ` <1564414258-18161-3-git-send-email-jay.cornwall-5C7GfCeVMHo@public.gmane.org>
@ 2019-07-29 16:40       ` Alex Deucher
  2019-07-29 18:13       ` Liu, Shaoyun
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2019-07-29 16:40 UTC (permalink / raw)
  To: Cornwall, Jay
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Liu, Shaoyun

On Mon, Jul 29, 2019 at 11:31 AM Cornwall, Jay <Jay.Cornwall@amd.com> wrote:
>
> VCC moved out of user SGPR allocation in gfx10. It's now stored
> in SGPRs 106-107.
>
> Also fixes incorrect SGPR read offsets.
>
> Cc: Shaoyun Liu <shaoyun.liu@amd.com>
> Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>

Series is:
Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h     | 452 ++++++++++-----------
>  .../gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm |  34 +-
>  2 files changed, 243 insertions(+), 243 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
> index 8089bb3..a8cf82d 100644
> --- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
> +++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
> @@ -680,7 +680,7 @@ static const uint32_t cwsr_trap_gfx9_hex[] = {
>  };
>
>  static const uint32_t cwsr_trap_gfx10_hex[] = {
> -       0xbf820001, 0xbf8201c0,
> +       0xbf820001, 0xbf8201c1,
>         0xb0804004, 0xb978f802,
>         0x8a788678, 0xb971f803,
>         0x876eff71, 0x00000400,
> @@ -804,271 +804,271 @@ static const uint32_t cwsr_trap_gfx10_hex[] = {
>         0x00000060, 0xbf85ffea,
>         0xbe802f00, 0xbe822f02,
>         0xbe842f04, 0xbe862f06,
> -       0xbe882f08, 0xf469003a,
> -       0xfa000000, 0xf469013a,
> -       0xfa000010, 0xf465023a,
> -       0xfa000020, 0x8074c074,
> -       0x82758075, 0xbef40372,
> -       0xbefa0380, 0xbefe03c1,
> -       0x907c9973, 0x877c817c,
> -       0xbf06817c, 0xbf850002,
> -       0xbeff0380, 0xbf820002,
> -       0xbeff03c1, 0xbf82000b,
> +       0xbe882f08, 0xbe8a2f0a,
> +       0xf469003a, 0xfa000000,
> +       0xf469013a, 0xfa000010,
> +       0xf469023a, 0xfa000020,
> +       0x8074b074, 0x82758075,
> +       0xbef40372, 0xbefa0380,
> +       0xbefe03c1, 0x907c9973,
> +       0x877c817c, 0xbf06817c,
> +       0xbf850002, 0xbeff0380,
> +       0xbf820002, 0xbeff03c1,
> +       0xbf82000b, 0xbef603ff,
> +       0x01000000, 0xe0704000,
> +       0x7a5d0000, 0xe0704080,
> +       0x7a5d0100, 0xe0704100,
> +       0x7a5d0200, 0xe0704180,
> +       0x7a5d0300, 0xbf82000a,
>         0xbef603ff, 0x01000000,
>         0xe0704000, 0x7a5d0000,
> -       0xe0704080, 0x7a5d0100,
> -       0xe0704100, 0x7a5d0200,
> -       0xe0704180, 0x7a5d0300,
> -       0xbf82000a, 0xbef603ff,
> -       0x01000000, 0xe0704000,
> -       0x7a5d0000, 0xe0704100,
> -       0x7a5d0100, 0xe0704200,
> -       0x7a5d0200, 0xe0704300,
> -       0x7a5d0300, 0xbefe03c1,
> +       0xe0704100, 0x7a5d0100,
> +       0xe0704200, 0x7a5d0200,
> +       0xe0704300, 0x7a5d0300,
> +       0xbefe03c1, 0x907c9973,
> +       0x877c817c, 0xbf06817c,
> +       0xbf850002, 0xbeff0380,
> +       0xbf820001, 0xbeff03c1,
> +       0xb9714306, 0x8771c171,
> +       0xbf840046, 0xbf8a0000,
> +       0x8776ff6f, 0x04000000,
> +       0xbf840042, 0x8f718671,
> +       0x8f718271, 0xbef60371,
> +       0xb97a2a05, 0x807a817a,
>         0x907c9973, 0x877c817c,
>         0xbf06817c, 0xbf850002,
> -       0xbeff0380, 0xbf820001,
> -       0xbeff03c1, 0xb9714306,
> -       0x8771c171, 0xbf840046,
> -       0xbf8a0000, 0x8776ff6f,
> -       0x04000000, 0xbf840042,
> -       0x8f718671, 0x8f718271,
> -       0xbef60371, 0xb97a2a05,
> -       0x807a817a, 0x907c9973,
> +       0x8f7a897a, 0xbf820001,
> +       0x8f7a8a7a, 0xb9761e06,
> +       0x8f768a76, 0x807a767a,
> +       0x807aff7a, 0x00000200,
> +       0x807aff7a, 0x00000080,
> +       0xbef603ff, 0x01000000,
> +       0xd7650000, 0x000100c1,
> +       0xd7660000, 0x000200c1,
> +       0x16000084, 0x907c9973,
>         0x877c817c, 0xbf06817c,
> -       0xbf850002, 0x8f7a897a,
> -       0xbf820001, 0x8f7a8a7a,
> -       0xb9761e06, 0x8f768a76,
> -       0x807a767a, 0x807aff7a,
> -       0x00000200, 0x807aff7a,
> -       0x00000080, 0xbef603ff,
> -       0x01000000, 0xd7650000,
> -       0x000100c1, 0xd7660000,
> -       0x000200c1, 0x16000084,
> -       0x907c9973, 0x877c817c,
> -       0xbf06817c, 0xbefc0380,
> -       0xbf850012, 0xbe8303ff,
> -       0x00000080, 0xbf800000,
> +       0xbefc0380, 0xbf850012,
> +       0xbe8303ff, 0x00000080,
>         0xbf800000, 0xbf800000,
> -       0xd8d80000, 0x01000000,
> -       0xbf8c0000, 0xe0704000,
> -       0x7a5d0100, 0x807c037c,
> -       0x807a037a, 0xd5250000,
> -       0x0001ff00, 0x00000080,
> -       0xbf0a717c, 0xbf85fff4,
> -       0xbf820011, 0xbe8303ff,
> -       0x00000100, 0xbf800000,
> +       0xbf800000, 0xd8d80000,
> +       0x01000000, 0xbf8c0000,
> +       0xe0704000, 0x7a5d0100,
> +       0x807c037c, 0x807a037a,
> +       0xd5250000, 0x0001ff00,
> +       0x00000080, 0xbf0a717c,
> +       0xbf85fff4, 0xbf820011,
> +       0xbe8303ff, 0x00000100,
>         0xbf800000, 0xbf800000,
> -       0xd8d80000, 0x01000000,
> -       0xbf8c0000, 0xe0704000,
> -       0x7a5d0100, 0x807c037c,
> -       0x807a037a, 0xd5250000,
> -       0x0001ff00, 0x00000100,
> -       0xbf0a717c, 0xbf85fff4,
> -       0xbefe03c1, 0x907c9973,
> -       0x877c817c, 0xbf06817c,
> -       0xbf850004, 0xbefa03ff,
> -       0x00000200, 0xbeff0380,
> -       0xbf820003, 0xbefa03ff,
> -       0x00000400, 0xbeff03c1,
> -       0xb9712a05, 0x80718171,
> -       0x8f718271, 0x907c9973,
> -       0x877c817c, 0xbf06817c,
> -       0xbf850017, 0xbef603ff,
> -       0x01000000, 0xbefc0384,
> -       0xbf0a717c, 0xbf840037,
> -       0x7e008700, 0x7e028701,
> -       0x7e048702, 0x7e068703,
> -       0xe0704000, 0x7a5d0000,
> -       0xe0704080, 0x7a5d0100,
> -       0xe0704100, 0x7a5d0200,
> -       0xe0704180, 0x7a5d0300,
> -       0x807c847c, 0x807aff7a,
> -       0x00000200, 0xbf0a717c,
> -       0xbf85ffef, 0xbf820025,
> +       0xbf800000, 0xd8d80000,
> +       0x01000000, 0xbf8c0000,
> +       0xe0704000, 0x7a5d0100,
> +       0x807c037c, 0x807a037a,
> +       0xd5250000, 0x0001ff00,
> +       0x00000100, 0xbf0a717c,
> +       0xbf85fff4, 0xbefe03c1,
> +       0x907c9973, 0x877c817c,
> +       0xbf06817c, 0xbf850004,
> +       0xbefa03ff, 0x00000200,
> +       0xbeff0380, 0xbf820003,
> +       0xbefa03ff, 0x00000400,
> +       0xbeff03c1, 0xb9712a05,
> +       0x80718171, 0x8f718271,
> +       0x907c9973, 0x877c817c,
> +       0xbf06817c, 0xbf850017,
>         0xbef603ff, 0x01000000,
>         0xbefc0384, 0xbf0a717c,
> -       0xbf840020, 0x7e008700,
> +       0xbf840037, 0x7e008700,
>         0x7e028701, 0x7e048702,
>         0x7e068703, 0xe0704000,
> -       0x7a5d0000, 0xe0704100,
> -       0x7a5d0100, 0xe0704200,
> -       0x7a5d0200, 0xe0704300,
> +       0x7a5d0000, 0xe0704080,
> +       0x7a5d0100, 0xe0704100,
> +       0x7a5d0200, 0xe0704180,
>         0x7a5d0300, 0x807c847c,
> -       0x807aff7a, 0x00000400,
> +       0x807aff7a, 0x00000200,
>         0xbf0a717c, 0xbf85ffef,
> -       0xb9711e06, 0x8771c171,
> -       0xbf84000c, 0x8f718371,
> -       0x80717c71, 0xbefe03c1,
> -       0xbeff0380, 0x7e008700,
> +       0xbf820025, 0xbef603ff,
> +       0x01000000, 0xbefc0384,
> +       0xbf0a717c, 0xbf840020,
> +       0x7e008700, 0x7e028701,
> +       0x7e048702, 0x7e068703,
>         0xe0704000, 0x7a5d0000,
> -       0x807c817c, 0x807aff7a,
> -       0x00000080, 0xbf0a717c,
> -       0xbf85fff8, 0xbf820141,
> -       0xbef4037e, 0x8775ff7f,
> -       0x0000ffff, 0x8875ff75,
> -       0x00040000, 0xbef60380,
> -       0xbef703ff, 0x10807fac,
> -       0x8772ff7f, 0x08000000,
> -       0x90728372, 0x88777277,
> -       0x8772ff7f, 0x70000000,
> -       0x90728172, 0x88777277,
> -       0xb97302dc, 0x8f739973,
> -       0x8873737f, 0x8772ff7f,
> -       0x04000000, 0xbf840036,
> -       0xbefe03c1, 0x907c9973,
> -       0x877c817c, 0xbf06817c,
> -       0xbf850002, 0xbeff0380,
> -       0xbf820001, 0xbeff03c1,
> -       0xb96f4306, 0x876fc16f,
> -       0xbf84002b, 0x8f6f866f,
> -       0x8f6f826f, 0xbef6036f,
> -       0xb9782a05, 0x80788178,
> +       0xe0704100, 0x7a5d0100,
> +       0xe0704200, 0x7a5d0200,
> +       0xe0704300, 0x7a5d0300,
> +       0x807c847c, 0x807aff7a,
> +       0x00000400, 0xbf0a717c,
> +       0xbf85ffef, 0xb9711e06,
> +       0x8771c171, 0xbf84000c,
> +       0x8f718371, 0x80717c71,
> +       0xbefe03c1, 0xbeff0380,
> +       0x7e008700, 0xe0704000,
> +       0x7a5d0000, 0x807c817c,
> +       0x807aff7a, 0x00000080,
> +       0xbf0a717c, 0xbf85fff8,
> +       0xbf820141, 0xbef4037e,
> +       0x8775ff7f, 0x0000ffff,
> +       0x8875ff75, 0x00040000,
> +       0xbef60380, 0xbef703ff,
> +       0x10807fac, 0x8772ff7f,
> +       0x08000000, 0x90728372,
> +       0x88777277, 0x8772ff7f,
> +       0x70000000, 0x90728172,
> +       0x88777277, 0xb97302dc,
> +       0x8f739973, 0x8873737f,
> +       0x8772ff7f, 0x04000000,
> +       0xbf840036, 0xbefe03c1,
>         0x907c9973, 0x877c817c,
>         0xbf06817c, 0xbf850002,
> -       0x8f788978, 0xbf820001,
> -       0x8f788a78, 0xb9721e06,
> -       0x8f728a72, 0x80787278,
> -       0x8078ff78, 0x00000200,
> -       0x8078ff78, 0x00000080,
> -       0xbef603ff, 0x01000000,
> -       0x907c9973, 0x877c817c,
> -       0xbf06817c, 0xbefc0380,
> -       0xbf850009, 0xe0310000,
> -       0x781d0000, 0x807cff7c,
> -       0x00000080, 0x8078ff78,
> -       0x00000080, 0xbf0a6f7c,
> -       0xbf85fff8, 0xbf820008,
> +       0xbeff0380, 0xbf820001,
> +       0xbeff03c1, 0xb96f4306,
> +       0x876fc16f, 0xbf84002b,
> +       0x8f6f866f, 0x8f6f826f,
> +       0xbef6036f, 0xb9782a05,
> +       0x80788178, 0x907c9973,
> +       0x877c817c, 0xbf06817c,
> +       0xbf850002, 0x8f788978,
> +       0xbf820001, 0x8f788a78,
> +       0xb9721e06, 0x8f728a72,
> +       0x80787278, 0x8078ff78,
> +       0x00000200, 0x8078ff78,
> +       0x00000080, 0xbef603ff,
> +       0x01000000, 0x907c9973,
> +       0x877c817c, 0xbf06817c,
> +       0xbefc0380, 0xbf850009,
>         0xe0310000, 0x781d0000,
> -       0x807cff7c, 0x00000100,
> -       0x8078ff78, 0x00000100,
> +       0x807cff7c, 0x00000080,
> +       0x8078ff78, 0x00000080,
>         0xbf0a6f7c, 0xbf85fff8,
> -       0xbef80380, 0xbefe03c1,
> -       0x907c9973, 0x877c817c,
> -       0xbf06817c, 0xbf850002,
> -       0xbeff0380, 0xbf820001,
> -       0xbeff03c1, 0xb96f2a05,
> -       0x806f816f, 0x8f6f826f,
> -       0x907c9973, 0x877c817c,
> -       0xbf06817c, 0xbf850021,
> -       0xbef603ff, 0x01000000,
> -       0xbef20378, 0x8078ff78,
> -       0x00000200, 0xbefc0384,
> -       0xe0304000, 0x785d0000,
> -       0xe0304080, 0x785d0100,
> -       0xe0304100, 0x785d0200,
> -       0xe0304180, 0x785d0300,
> -       0xbf8c3f70, 0x7e008500,
> -       0x7e028501, 0x7e048502,
> -       0x7e068503, 0x807c847c,
> -       0x8078ff78, 0x00000200,
> -       0xbf0a6f7c, 0xbf85ffee,
> -       0xe0304000, 0x725d0000,
> -       0xe0304080, 0x725d0100,
> -       0xe0304100, 0x725d0200,
> -       0xe0304180, 0x725d0300,
> -       0xbf820031, 0xbef603ff,
> +       0xbf820008, 0xe0310000,
> +       0x781d0000, 0x807cff7c,
> +       0x00000100, 0x8078ff78,
> +       0x00000100, 0xbf0a6f7c,
> +       0xbf85fff8, 0xbef80380,
> +       0xbefe03c1, 0x907c9973,
> +       0x877c817c, 0xbf06817c,
> +       0xbf850002, 0xbeff0380,
> +       0xbf820001, 0xbeff03c1,
> +       0xb96f2a05, 0x806f816f,
> +       0x8f6f826f, 0x907c9973,
> +       0x877c817c, 0xbf06817c,
> +       0xbf850021, 0xbef603ff,
>         0x01000000, 0xbef20378,
> -       0x8078ff78, 0x00000400,
> +       0x8078ff78, 0x00000200,
>         0xbefc0384, 0xe0304000,
> -       0x785d0000, 0xe0304100,
> -       0x785d0100, 0xe0304200,
> -       0x785d0200, 0xe0304300,
> +       0x785d0000, 0xe0304080,
> +       0x785d0100, 0xe0304100,
> +       0x785d0200, 0xe0304180,
>         0x785d0300, 0xbf8c3f70,
>         0x7e008500, 0x7e028501,
>         0x7e048502, 0x7e068503,
>         0x807c847c, 0x8078ff78,
> -       0x00000400, 0xbf0a6f7c,
> -       0xbf85ffee, 0xb96f1e06,
> -       0x876fc16f, 0xbf84000e,
> -       0x8f6f836f, 0x806f7c6f,
> -       0xbefe03c1, 0xbeff0380,
> +       0x00000200, 0xbf0a6f7c,
> +       0xbf85ffee, 0xe0304000,
> +       0x725d0000, 0xe0304080,
> +       0x725d0100, 0xe0304100,
> +       0x725d0200, 0xe0304180,
> +       0x725d0300, 0xbf820031,
> +       0xbef603ff, 0x01000000,
> +       0xbef20378, 0x8078ff78,
> +       0x00000400, 0xbefc0384,
>         0xe0304000, 0x785d0000,
> +       0xe0304100, 0x785d0100,
> +       0xe0304200, 0x785d0200,
> +       0xe0304300, 0x785d0300,
>         0xbf8c3f70, 0x7e008500,
> -       0x807c817c, 0x8078ff78,
> -       0x00000080, 0xbf0a6f7c,
> -       0xbf85fff7, 0xbeff03c1,
> -       0xe0304000, 0x725d0000,
> -       0xe0304100, 0x725d0100,
> -       0xe0304200, 0x725d0200,
> -       0xe0304300, 0x725d0300,
> -       0xb9782a05, 0x80788178,
> -       0x907c9973, 0x877c817c,
> -       0xbf06817c, 0xbf850002,
> -       0x8f788978, 0xbf820001,
> -       0x8f788a78, 0xb9721e06,
> -       0x8f728a72, 0x80787278,
> -       0x8078ff78, 0x00000200,
> -       0x80f8ff78, 0x00000058,
> -       0x80f88878, 0xbef603ff,
> +       0x7e028501, 0x7e048502,
> +       0x7e068503, 0x807c847c,
> +       0x8078ff78, 0x00000400,
> +       0xbf0a6f7c, 0xbf85ffee,
> +       0xb96f1e06, 0x876fc16f,
> +       0xbf84000e, 0x8f6f836f,
> +       0x806f7c6f, 0xbefe03c1,
> +       0xbeff0380, 0xe0304000,
> +       0x785d0000, 0xbf8c3f70,
> +       0x7e008500, 0x807c817c,
> +       0x8078ff78, 0x00000080,
> +       0xbf0a6f7c, 0xbf85fff7,
> +       0xbeff03c1, 0xe0304000,
> +       0x725d0000, 0xe0304100,
> +       0x725d0100, 0xe0304200,
> +       0x725d0200, 0xe0304300,
> +       0x725d0300, 0xb9782a05,
> +       0x80788178, 0x907c9973,
> +       0x877c817c, 0xbf06817c,
> +       0xbf850002, 0x8f788978,
> +       0xbf820001, 0x8f788a78,
> +       0xb9721e06, 0x8f728a72,
> +       0x80787278, 0x8078ff78,
> +       0x00000200, 0x80f8ff78,
> +       0x00000050, 0xbef603ff,
>         0x01000000, 0xbefc03ff,
> -       0x0000006a, 0xf425003a,
> -       0xf0000000, 0x80f8a078,
> -       0xbf8cc07f, 0x80fc827c,
> +       0x0000006c, 0x80f89078,
> +       0xf429003a, 0xf0000000,
> +       0xbf8cc07f, 0x80fc847c,
>         0xbf800000, 0xbe803100,
> +       0xbe823102, 0x80f8a078,
>         0xf42d003a, 0xf0000000,
> -       0x80f8c078, 0xbf8cc07f,
> -       0x80fc887c, 0xbf800000,
> -       0xbe803100, 0xbe823102,
> -       0xbe843104, 0xbe863106,
> +       0xbf8cc07f, 0x80fc887c,
> +       0xbf800000, 0xbe803100,
> +       0xbe823102, 0xbe843104,
> +       0xbe863106, 0x80f8c078,
>         0xf431003a, 0xf0000000,
> -       0x80f8c078, 0xbf8cc07f,
> -       0x80fc907c, 0xbf800000,
> -       0xbe803100, 0xbe823102,
> -       0xbe843104, 0xbe863106,
> -       0xbe883108, 0xbe8a310a,
> -       0xbe8c310c, 0xbe8e310e,
> -       0xbf06807c, 0xbf84fff0,
> -       0xb9782a05, 0x80788178,
> -       0x907c9973, 0x877c817c,
> -       0xbf06817c, 0xbf850002,
> -       0x8f788978, 0xbf820001,
> -       0x8f788a78, 0xb9721e06,
> -       0x8f728a72, 0x80787278,
> -       0x8078ff78, 0x00000200,
> -       0xbef603ff, 0x01000000,
> -       0xf4211bfa, 0xf0000000,
> -       0x80788478, 0xf4211b3a,
> +       0xbf8cc07f, 0x80fc907c,
> +       0xbf800000, 0xbe803100,
> +       0xbe823102, 0xbe843104,
> +       0xbe863106, 0xbe883108,
> +       0xbe8a310a, 0xbe8c310c,
> +       0xbe8e310e, 0xbf06807c,
> +       0xbf84fff0, 0xb9782a05,
> +       0x80788178, 0x907c9973,
> +       0x877c817c, 0xbf06817c,
> +       0xbf850002, 0x8f788978,
> +       0xbf820001, 0x8f788a78,
> +       0xb9721e06, 0x8f728a72,
> +       0x80787278, 0x8078ff78,
> +       0x00000200, 0xbef603ff,
> +       0x01000000, 0xf4211bfa,
>         0xf0000000, 0x80788478,
> -       0xf4211b7a, 0xf0000000,
> -       0x80788478, 0xf4211eba,
> +       0xf4211b3a, 0xf0000000,
> +       0x80788478, 0xf4211b7a,
>         0xf0000000, 0x80788478,
> -       0xf4211efa, 0xf0000000,
> -       0x80788478, 0xf4211c3a,
> +       0xf4211eba, 0xf0000000,
> +       0x80788478, 0xf4211efa,
>         0xf0000000, 0x80788478,
> -       0xf4211c7a, 0xf0000000,
> -       0x80788478, 0xf4211e7a,
> +       0xf4211c3a, 0xf0000000,
> +       0x80788478, 0xf4211c7a,
>         0xf0000000, 0x80788478,
> -       0xf4211cfa, 0xf0000000,
> -       0x80788478, 0xf4211bba,
> +       0xf4211e7a, 0xf0000000,
> +       0x80788478, 0xf4211cfa,
>         0xf0000000, 0x80788478,
> -       0xbf8cc07f, 0xb9eef814,
>         0xf4211bba, 0xf0000000,
>         0x80788478, 0xbf8cc07f,
> -       0xb9eef815, 0xbef2036d,
> -       0x876dff72, 0x0000ffff,
> -       0xbefc036f, 0xbefe037a,
> -       0xbeff037b, 0x876f71ff,
> -       0x000003ff, 0xb9ef4803,
> -       0xb9f9f816, 0x876f71ff,
> -       0xfffff800, 0x906f8b6f,
> -       0xb9efa2c3, 0xb9f3f801,
> -       0x876fff72, 0xfc000000,
> -       0x906f9a6f, 0x8f6f906f,
> -       0xbef30380, 0x88736f73,
> -       0x876fff72, 0x02000000,
> -       0x906f996f, 0x8f6f8f6f,
> +       0xb9eef814, 0xf4211bba,
> +       0xf0000000, 0x80788478,
> +       0xbf8cc07f, 0xb9eef815,
> +       0xbef2036d, 0x876dff72,
> +       0x0000ffff, 0xbefc036f,
> +       0xbefe037a, 0xbeff037b,
> +       0x876f71ff, 0x000003ff,
> +       0xb9ef4803, 0xb9f9f816,
> +       0x876f71ff, 0xfffff800,
> +       0x906f8b6f, 0xb9efa2c3,
> +       0xb9f3f801, 0x876fff72,
> +       0xfc000000, 0x906f9a6f,
> +       0x8f6f906f, 0xbef30380,
>         0x88736f73, 0x876fff72,
> -       0x01000000, 0x906f986f,
> -       0x8f6f996f, 0x88736f73,
> -       0x876fff70, 0x00800000,
> -       0x906f976f, 0xb9f3f807,
> -       0x87fe7e7e, 0x87ea6a6a,
> -       0xb9f0f802, 0xbf8a0000,
> -       0xbe80226c, 0xbf810000,
> +       0x02000000, 0x906f996f,
> +       0x8f6f8f6f, 0x88736f73,
> +       0x876fff72, 0x01000000,
> +       0x906f986f, 0x8f6f996f,
> +       0x88736f73, 0x876fff70,
> +       0x00800000, 0x906f976f,
> +       0xb9f3f807, 0x87fe7e7e,
> +       0x87ea6a6a, 0xb9f0f802,
> +       0xbf8a0000, 0xbe80226c,
> +       0xbf810000, 0xbf9f0000,
>         0xbf9f0000, 0xbf9f0000,
>         0xbf9f0000, 0xbf9f0000,
> -       0xbf9f0000, 0x00000000,
>  };
>  static const uint32_t cwsr_trap_arcturus_hex[] = {
>         0xbf820001, 0xbf8202c4,
> diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
> index fafdfd2..3598621 100644
> --- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
> +++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
> @@ -87,7 +87,7 @@ var S_SAVE_PC_HI_FIRST_REPLAY_MASK            = 0x02000000
>  var S_SAVE_PC_HI_REPLAY_W64H_SHIFT             = 24
>  var S_SAVE_PC_HI_REPLAY_W64H_MASK              = 0x01000000
>
> -var s_sgpr_save_num                            = 106
> +var s_sgpr_save_num                            = 108
>
>  var s_save_spi_init_lo                         = exec_lo
>  var s_save_spi_init_hi                         = exec_hi
> @@ -357,13 +357,14 @@ L_SAVE_SGPR_LOOP:
>         s_cmp_lt_u32    m0, 96                                                  //scc = (m0 < first 96 SGPR) ? 1 : 0
>         s_cbranch_scc1  L_SAVE_SGPR_LOOP                                        //first 96 SGPR save is complete?
>
> -       //save the rest 10 SGPR
> +       //save the rest 12 SGPR
>         s_movrels_b64   s0, s0                                                  //s0 = s[0+m0], s1 = s[1+m0]
>         s_movrels_b64   s2, s2                                                  //s2 = s[2+m0], s3 = s[3+m0]
>         s_movrels_b64   s4, s4                                                  //s4 = s[4+m0], s5 = s[5+m0]
>         s_movrels_b64   s6, s6                                                  //s6 = s[6+m0], s7 = s[7+m0]
>         s_movrels_b64   s8, s8                                                  //s8 = s[8+m0], s9 = s[9+m0]
> -       write_10sgpr_to_mem(s0, s_save_buf_rsrc0, s_save_mem_offset)
> +       s_movrels_b64   s10, s10                                                //s10 = s[10+m0], s11 = s[11+m0]
> +       write_12sgpr_to_mem(s0, s_save_buf_rsrc0, s_save_mem_offset)
>
>         // restore s_save_buf_rsrc0,1
>         s_mov_b32       s_save_buf_rsrc0, s_save_xnack_mask
> @@ -766,26 +767,25 @@ L_RESTORE_SGPR:
>         get_svgpr_size_bytes(s_restore_tmp)
>         s_add_u32       s_restore_mem_offset, s_restore_mem_offset, s_restore_tmp
>         s_add_u32       s_restore_mem_offset, s_restore_mem_offset, get_sgpr_size_bytes()
> -       s_sub_u32       s_restore_mem_offset, s_restore_mem_offset, 22*4        //s106~s127 is not saved
> -       s_sub_u32       s_restore_mem_offset, s_restore_mem_offset, 2*4         // restore SGPR from S[n] to S[0], by 2 sgprs group
> +       s_sub_u32       s_restore_mem_offset, s_restore_mem_offset, 20*4        //s108~s127 is not saved
>
>         s_mov_b32       s_restore_buf_rsrc2, 0x1000000                          //NUM_RECORDS in bytes
>
>         s_mov_b32       m0, s_sgpr_save_num
>
> -       read_2sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
> -
> +       read_4sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
>         s_waitcnt       lgkmcnt(0)
>
> -       s_sub_u32       m0, m0, 2                                               // Restore from S[n] to S[0]
> +       s_sub_u32       m0, m0, 4                                               // Restore from S[0] to S[104]
>         s_nop           0                                                       // hazard SALU M0=> S_MOVREL
>
>         s_movreld_b64   s0, s0                                                  //s[0+m0] = s0
> +       s_movreld_b64   s2, s2
>
>         read_8sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
>         s_waitcnt       lgkmcnt(0)
>
> -       s_sub_u32       m0, m0, 8                                               // Restore from S[n] to S[0]
> +       s_sub_u32       m0, m0, 8                                               // Restore from S[0] to S[96]
>         s_nop           0                                                       // hazard SALU M0=> S_MOVREL
>
>         s_movreld_b64   s0, s0                                                  //s[0+m0] = s0
> @@ -903,11 +903,11 @@ function write_16sgpr_to_mem(s, s_rsrc, s_mem_offset)
>         s_addc_u32      s_rsrc[1], s_rsrc[1], 0x0
>  end
>
> -function write_10sgpr_to_mem(s, s_rsrc, s_mem_offset)
> +function write_12sgpr_to_mem(s, s_rsrc, s_mem_offset)
>         s_buffer_store_dwordx4  s[0], s_rsrc, 0 glc:1
>         s_buffer_store_dwordx4  s[4], s_rsrc, 16 glc:1
> -       s_buffer_store_dwordx2  s[8], s_rsrc, 32 glc:1
> -       s_add_u32       s_rsrc[0], s_rsrc[0], 4*16
> +       s_buffer_store_dwordx4  s[8], s_rsrc, 32 glc:1
> +       s_add_u32       s_rsrc[0], s_rsrc[0], 4*12
>         s_addc_u32      s_rsrc[1], s_rsrc[1], 0x0
>  end
>
> @@ -918,18 +918,18 @@ function read_hwreg_from_mem(s, s_rsrc, s_mem_offset)
>  end
>
>  function read_16sgpr_from_mem(s, s_rsrc, s_mem_offset)
> -       s_buffer_load_dwordx16  s, s_rsrc, s_mem_offset glc:1
>         s_sub_u32       s_mem_offset, s_mem_offset, 4*16
> +       s_buffer_load_dwordx16  s, s_rsrc, s_mem_offset glc:1
>  end
>
>  function read_8sgpr_from_mem(s, s_rsrc, s_mem_offset)
> +       s_sub_u32       s_mem_offset, s_mem_offset, 4*8
>         s_buffer_load_dwordx8   s, s_rsrc, s_mem_offset glc:1
> -       s_sub_u32       s_mem_offset, s_mem_offset, 4*16
>  end
>
> -function read_2sgpr_from_mem(s, s_rsrc, s_mem_offset)
> -       s_buffer_load_dwordx2 s, s_rsrc, s_mem_offset glc:1
> -       s_sub_u32       s_mem_offset, s_mem_offset, 4*8
> +function read_4sgpr_from_mem(s, s_rsrc, s_mem_offset)
> +       s_sub_u32       s_mem_offset, s_mem_offset, 4*4
> +       s_buffer_load_dwordx4   s, s_rsrc, s_mem_offset glc:1
>  end
>
>
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] drm/amdkfd: Save/restore vcc on gfx10
       [not found]     ` <1564414258-18161-3-git-send-email-jay.cornwall-5C7GfCeVMHo@public.gmane.org>
  2019-07-29 16:40       ` Alex Deucher
@ 2019-07-29 18:13       ` Liu, Shaoyun
  1 sibling, 0 replies; 5+ messages in thread
From: Liu, Shaoyun @ 2019-07-29 18:13 UTC (permalink / raw)
  To: Cornwall, Jay,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

Series is:
reviewed-by: shaoyunl <shaoyun.liu@amd.com>

On 2019-07-29 11:31 a.m., Cornwall, Jay wrote:
> VCC moved out of user SGPR allocation in gfx10. It's now stored
> in SGPRs 106-107.
>
> Also fixes incorrect SGPR read offsets.
>
> Cc: Shaoyun Liu <shaoyun.liu@amd.com>
> Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h     | 452 ++++++++++-----------
>   .../gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm |  34 +-
>   2 files changed, 243 insertions(+), 243 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
> index 8089bb3..a8cf82d 100644
> --- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
> +++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
> @@ -680,7 +680,7 @@ static const uint32_t cwsr_trap_gfx9_hex[] = {
>   };
>   
>   static const uint32_t cwsr_trap_gfx10_hex[] = {
> -	0xbf820001, 0xbf8201c0,
> +	0xbf820001, 0xbf8201c1,
>   	0xb0804004, 0xb978f802,
>   	0x8a788678, 0xb971f803,
>   	0x876eff71, 0x00000400,
> @@ -804,271 +804,271 @@ static const uint32_t cwsr_trap_gfx10_hex[] = {
>   	0x00000060, 0xbf85ffea,
>   	0xbe802f00, 0xbe822f02,
>   	0xbe842f04, 0xbe862f06,
> -	0xbe882f08, 0xf469003a,
> -	0xfa000000, 0xf469013a,
> -	0xfa000010, 0xf465023a,
> -	0xfa000020, 0x8074c074,
> -	0x82758075, 0xbef40372,
> -	0xbefa0380, 0xbefe03c1,
> -	0x907c9973, 0x877c817c,
> -	0xbf06817c, 0xbf850002,
> -	0xbeff0380, 0xbf820002,
> -	0xbeff03c1, 0xbf82000b,
> +	0xbe882f08, 0xbe8a2f0a,
> +	0xf469003a, 0xfa000000,
> +	0xf469013a, 0xfa000010,
> +	0xf469023a, 0xfa000020,
> +	0x8074b074, 0x82758075,
> +	0xbef40372, 0xbefa0380,
> +	0xbefe03c1, 0x907c9973,
> +	0x877c817c, 0xbf06817c,
> +	0xbf850002, 0xbeff0380,
> +	0xbf820002, 0xbeff03c1,
> +	0xbf82000b, 0xbef603ff,
> +	0x01000000, 0xe0704000,
> +	0x7a5d0000, 0xe0704080,
> +	0x7a5d0100, 0xe0704100,
> +	0x7a5d0200, 0xe0704180,
> +	0x7a5d0300, 0xbf82000a,
>   	0xbef603ff, 0x01000000,
>   	0xe0704000, 0x7a5d0000,
> -	0xe0704080, 0x7a5d0100,
> -	0xe0704100, 0x7a5d0200,
> -	0xe0704180, 0x7a5d0300,
> -	0xbf82000a, 0xbef603ff,
> -	0x01000000, 0xe0704000,
> -	0x7a5d0000, 0xe0704100,
> -	0x7a5d0100, 0xe0704200,
> -	0x7a5d0200, 0xe0704300,
> -	0x7a5d0300, 0xbefe03c1,
> +	0xe0704100, 0x7a5d0100,
> +	0xe0704200, 0x7a5d0200,
> +	0xe0704300, 0x7a5d0300,
> +	0xbefe03c1, 0x907c9973,
> +	0x877c817c, 0xbf06817c,
> +	0xbf850002, 0xbeff0380,
> +	0xbf820001, 0xbeff03c1,
> +	0xb9714306, 0x8771c171,
> +	0xbf840046, 0xbf8a0000,
> +	0x8776ff6f, 0x04000000,
> +	0xbf840042, 0x8f718671,
> +	0x8f718271, 0xbef60371,
> +	0xb97a2a05, 0x807a817a,
>   	0x907c9973, 0x877c817c,
>   	0xbf06817c, 0xbf850002,
> -	0xbeff0380, 0xbf820001,
> -	0xbeff03c1, 0xb9714306,
> -	0x8771c171, 0xbf840046,
> -	0xbf8a0000, 0x8776ff6f,
> -	0x04000000, 0xbf840042,
> -	0x8f718671, 0x8f718271,
> -	0xbef60371, 0xb97a2a05,
> -	0x807a817a, 0x907c9973,
> +	0x8f7a897a, 0xbf820001,
> +	0x8f7a8a7a, 0xb9761e06,
> +	0x8f768a76, 0x807a767a,
> +	0x807aff7a, 0x00000200,
> +	0x807aff7a, 0x00000080,
> +	0xbef603ff, 0x01000000,
> +	0xd7650000, 0x000100c1,
> +	0xd7660000, 0x000200c1,
> +	0x16000084, 0x907c9973,
>   	0x877c817c, 0xbf06817c,
> -	0xbf850002, 0x8f7a897a,
> -	0xbf820001, 0x8f7a8a7a,
> -	0xb9761e06, 0x8f768a76,
> -	0x807a767a, 0x807aff7a,
> -	0x00000200, 0x807aff7a,
> -	0x00000080, 0xbef603ff,
> -	0x01000000, 0xd7650000,
> -	0x000100c1, 0xd7660000,
> -	0x000200c1, 0x16000084,
> -	0x907c9973, 0x877c817c,
> -	0xbf06817c, 0xbefc0380,
> -	0xbf850012, 0xbe8303ff,
> -	0x00000080, 0xbf800000,
> +	0xbefc0380, 0xbf850012,
> +	0xbe8303ff, 0x00000080,
>   	0xbf800000, 0xbf800000,
> -	0xd8d80000, 0x01000000,
> -	0xbf8c0000, 0xe0704000,
> -	0x7a5d0100, 0x807c037c,
> -	0x807a037a, 0xd5250000,
> -	0x0001ff00, 0x00000080,
> -	0xbf0a717c, 0xbf85fff4,
> -	0xbf820011, 0xbe8303ff,
> -	0x00000100, 0xbf800000,
> +	0xbf800000, 0xd8d80000,
> +	0x01000000, 0xbf8c0000,
> +	0xe0704000, 0x7a5d0100,
> +	0x807c037c, 0x807a037a,
> +	0xd5250000, 0x0001ff00,
> +	0x00000080, 0xbf0a717c,
> +	0xbf85fff4, 0xbf820011,
> +	0xbe8303ff, 0x00000100,
>   	0xbf800000, 0xbf800000,
> -	0xd8d80000, 0x01000000,
> -	0xbf8c0000, 0xe0704000,
> -	0x7a5d0100, 0x807c037c,
> -	0x807a037a, 0xd5250000,
> -	0x0001ff00, 0x00000100,
> -	0xbf0a717c, 0xbf85fff4,
> -	0xbefe03c1, 0x907c9973,
> -	0x877c817c, 0xbf06817c,
> -	0xbf850004, 0xbefa03ff,
> -	0x00000200, 0xbeff0380,
> -	0xbf820003, 0xbefa03ff,
> -	0x00000400, 0xbeff03c1,
> -	0xb9712a05, 0x80718171,
> -	0x8f718271, 0x907c9973,
> -	0x877c817c, 0xbf06817c,
> -	0xbf850017, 0xbef603ff,
> -	0x01000000, 0xbefc0384,
> -	0xbf0a717c, 0xbf840037,
> -	0x7e008700, 0x7e028701,
> -	0x7e048702, 0x7e068703,
> -	0xe0704000, 0x7a5d0000,
> -	0xe0704080, 0x7a5d0100,
> -	0xe0704100, 0x7a5d0200,
> -	0xe0704180, 0x7a5d0300,
> -	0x807c847c, 0x807aff7a,
> -	0x00000200, 0xbf0a717c,
> -	0xbf85ffef, 0xbf820025,
> +	0xbf800000, 0xd8d80000,
> +	0x01000000, 0xbf8c0000,
> +	0xe0704000, 0x7a5d0100,
> +	0x807c037c, 0x807a037a,
> +	0xd5250000, 0x0001ff00,
> +	0x00000100, 0xbf0a717c,
> +	0xbf85fff4, 0xbefe03c1,
> +	0x907c9973, 0x877c817c,
> +	0xbf06817c, 0xbf850004,
> +	0xbefa03ff, 0x00000200,
> +	0xbeff0380, 0xbf820003,
> +	0xbefa03ff, 0x00000400,
> +	0xbeff03c1, 0xb9712a05,
> +	0x80718171, 0x8f718271,
> +	0x907c9973, 0x877c817c,
> +	0xbf06817c, 0xbf850017,
>   	0xbef603ff, 0x01000000,
>   	0xbefc0384, 0xbf0a717c,
> -	0xbf840020, 0x7e008700,
> +	0xbf840037, 0x7e008700,
>   	0x7e028701, 0x7e048702,
>   	0x7e068703, 0xe0704000,
> -	0x7a5d0000, 0xe0704100,
> -	0x7a5d0100, 0xe0704200,
> -	0x7a5d0200, 0xe0704300,
> +	0x7a5d0000, 0xe0704080,
> +	0x7a5d0100, 0xe0704100,
> +	0x7a5d0200, 0xe0704180,
>   	0x7a5d0300, 0x807c847c,
> -	0x807aff7a, 0x00000400,
> +	0x807aff7a, 0x00000200,
>   	0xbf0a717c, 0xbf85ffef,
> -	0xb9711e06, 0x8771c171,
> -	0xbf84000c, 0x8f718371,
> -	0x80717c71, 0xbefe03c1,
> -	0xbeff0380, 0x7e008700,
> +	0xbf820025, 0xbef603ff,
> +	0x01000000, 0xbefc0384,
> +	0xbf0a717c, 0xbf840020,
> +	0x7e008700, 0x7e028701,
> +	0x7e048702, 0x7e068703,
>   	0xe0704000, 0x7a5d0000,
> -	0x807c817c, 0x807aff7a,
> -	0x00000080, 0xbf0a717c,
> -	0xbf85fff8, 0xbf820141,
> -	0xbef4037e, 0x8775ff7f,
> -	0x0000ffff, 0x8875ff75,
> -	0x00040000, 0xbef60380,
> -	0xbef703ff, 0x10807fac,
> -	0x8772ff7f, 0x08000000,
> -	0x90728372, 0x88777277,
> -	0x8772ff7f, 0x70000000,
> -	0x90728172, 0x88777277,
> -	0xb97302dc, 0x8f739973,
> -	0x8873737f, 0x8772ff7f,
> -	0x04000000, 0xbf840036,
> -	0xbefe03c1, 0x907c9973,
> -	0x877c817c, 0xbf06817c,
> -	0xbf850002, 0xbeff0380,
> -	0xbf820001, 0xbeff03c1,
> -	0xb96f4306, 0x876fc16f,
> -	0xbf84002b, 0x8f6f866f,
> -	0x8f6f826f, 0xbef6036f,
> -	0xb9782a05, 0x80788178,
> +	0xe0704100, 0x7a5d0100,
> +	0xe0704200, 0x7a5d0200,
> +	0xe0704300, 0x7a5d0300,
> +	0x807c847c, 0x807aff7a,
> +	0x00000400, 0xbf0a717c,
> +	0xbf85ffef, 0xb9711e06,
> +	0x8771c171, 0xbf84000c,
> +	0x8f718371, 0x80717c71,
> +	0xbefe03c1, 0xbeff0380,
> +	0x7e008700, 0xe0704000,
> +	0x7a5d0000, 0x807c817c,
> +	0x807aff7a, 0x00000080,
> +	0xbf0a717c, 0xbf85fff8,
> +	0xbf820141, 0xbef4037e,
> +	0x8775ff7f, 0x0000ffff,
> +	0x8875ff75, 0x00040000,
> +	0xbef60380, 0xbef703ff,
> +	0x10807fac, 0x8772ff7f,
> +	0x08000000, 0x90728372,
> +	0x88777277, 0x8772ff7f,
> +	0x70000000, 0x90728172,
> +	0x88777277, 0xb97302dc,
> +	0x8f739973, 0x8873737f,
> +	0x8772ff7f, 0x04000000,
> +	0xbf840036, 0xbefe03c1,
>   	0x907c9973, 0x877c817c,
>   	0xbf06817c, 0xbf850002,
> -	0x8f788978, 0xbf820001,
> -	0x8f788a78, 0xb9721e06,
> -	0x8f728a72, 0x80787278,
> -	0x8078ff78, 0x00000200,
> -	0x8078ff78, 0x00000080,
> -	0xbef603ff, 0x01000000,
> -	0x907c9973, 0x877c817c,
> -	0xbf06817c, 0xbefc0380,
> -	0xbf850009, 0xe0310000,
> -	0x781d0000, 0x807cff7c,
> -	0x00000080, 0x8078ff78,
> -	0x00000080, 0xbf0a6f7c,
> -	0xbf85fff8, 0xbf820008,
> +	0xbeff0380, 0xbf820001,
> +	0xbeff03c1, 0xb96f4306,
> +	0x876fc16f, 0xbf84002b,
> +	0x8f6f866f, 0x8f6f826f,
> +	0xbef6036f, 0xb9782a05,
> +	0x80788178, 0x907c9973,
> +	0x877c817c, 0xbf06817c,
> +	0xbf850002, 0x8f788978,
> +	0xbf820001, 0x8f788a78,
> +	0xb9721e06, 0x8f728a72,
> +	0x80787278, 0x8078ff78,
> +	0x00000200, 0x8078ff78,
> +	0x00000080, 0xbef603ff,
> +	0x01000000, 0x907c9973,
> +	0x877c817c, 0xbf06817c,
> +	0xbefc0380, 0xbf850009,
>   	0xe0310000, 0x781d0000,
> -	0x807cff7c, 0x00000100,
> -	0x8078ff78, 0x00000100,
> +	0x807cff7c, 0x00000080,
> +	0x8078ff78, 0x00000080,
>   	0xbf0a6f7c, 0xbf85fff8,
> -	0xbef80380, 0xbefe03c1,
> -	0x907c9973, 0x877c817c,
> -	0xbf06817c, 0xbf850002,
> -	0xbeff0380, 0xbf820001,
> -	0xbeff03c1, 0xb96f2a05,
> -	0x806f816f, 0x8f6f826f,
> -	0x907c9973, 0x877c817c,
> -	0xbf06817c, 0xbf850021,
> -	0xbef603ff, 0x01000000,
> -	0xbef20378, 0x8078ff78,
> -	0x00000200, 0xbefc0384,
> -	0xe0304000, 0x785d0000,
> -	0xe0304080, 0x785d0100,
> -	0xe0304100, 0x785d0200,
> -	0xe0304180, 0x785d0300,
> -	0xbf8c3f70, 0x7e008500,
> -	0x7e028501, 0x7e048502,
> -	0x7e068503, 0x807c847c,
> -	0x8078ff78, 0x00000200,
> -	0xbf0a6f7c, 0xbf85ffee,
> -	0xe0304000, 0x725d0000,
> -	0xe0304080, 0x725d0100,
> -	0xe0304100, 0x725d0200,
> -	0xe0304180, 0x725d0300,
> -	0xbf820031, 0xbef603ff,
> +	0xbf820008, 0xe0310000,
> +	0x781d0000, 0x807cff7c,
> +	0x00000100, 0x8078ff78,
> +	0x00000100, 0xbf0a6f7c,
> +	0xbf85fff8, 0xbef80380,
> +	0xbefe03c1, 0x907c9973,
> +	0x877c817c, 0xbf06817c,
> +	0xbf850002, 0xbeff0380,
> +	0xbf820001, 0xbeff03c1,
> +	0xb96f2a05, 0x806f816f,
> +	0x8f6f826f, 0x907c9973,
> +	0x877c817c, 0xbf06817c,
> +	0xbf850021, 0xbef603ff,
>   	0x01000000, 0xbef20378,
> -	0x8078ff78, 0x00000400,
> +	0x8078ff78, 0x00000200,
>   	0xbefc0384, 0xe0304000,
> -	0x785d0000, 0xe0304100,
> -	0x785d0100, 0xe0304200,
> -	0x785d0200, 0xe0304300,
> +	0x785d0000, 0xe0304080,
> +	0x785d0100, 0xe0304100,
> +	0x785d0200, 0xe0304180,
>   	0x785d0300, 0xbf8c3f70,
>   	0x7e008500, 0x7e028501,
>   	0x7e048502, 0x7e068503,
>   	0x807c847c, 0x8078ff78,
> -	0x00000400, 0xbf0a6f7c,
> -	0xbf85ffee, 0xb96f1e06,
> -	0x876fc16f, 0xbf84000e,
> -	0x8f6f836f, 0x806f7c6f,
> -	0xbefe03c1, 0xbeff0380,
> +	0x00000200, 0xbf0a6f7c,
> +	0xbf85ffee, 0xe0304000,
> +	0x725d0000, 0xe0304080,
> +	0x725d0100, 0xe0304100,
> +	0x725d0200, 0xe0304180,
> +	0x725d0300, 0xbf820031,
> +	0xbef603ff, 0x01000000,
> +	0xbef20378, 0x8078ff78,
> +	0x00000400, 0xbefc0384,
>   	0xe0304000, 0x785d0000,
> +	0xe0304100, 0x785d0100,
> +	0xe0304200, 0x785d0200,
> +	0xe0304300, 0x785d0300,
>   	0xbf8c3f70, 0x7e008500,
> -	0x807c817c, 0x8078ff78,
> -	0x00000080, 0xbf0a6f7c,
> -	0xbf85fff7, 0xbeff03c1,
> -	0xe0304000, 0x725d0000,
> -	0xe0304100, 0x725d0100,
> -	0xe0304200, 0x725d0200,
> -	0xe0304300, 0x725d0300,
> -	0xb9782a05, 0x80788178,
> -	0x907c9973, 0x877c817c,
> -	0xbf06817c, 0xbf850002,
> -	0x8f788978, 0xbf820001,
> -	0x8f788a78, 0xb9721e06,
> -	0x8f728a72, 0x80787278,
> -	0x8078ff78, 0x00000200,
> -	0x80f8ff78, 0x00000058,
> -	0x80f88878, 0xbef603ff,
> +	0x7e028501, 0x7e048502,
> +	0x7e068503, 0x807c847c,
> +	0x8078ff78, 0x00000400,
> +	0xbf0a6f7c, 0xbf85ffee,
> +	0xb96f1e06, 0x876fc16f,
> +	0xbf84000e, 0x8f6f836f,
> +	0x806f7c6f, 0xbefe03c1,
> +	0xbeff0380, 0xe0304000,
> +	0x785d0000, 0xbf8c3f70,
> +	0x7e008500, 0x807c817c,
> +	0x8078ff78, 0x00000080,
> +	0xbf0a6f7c, 0xbf85fff7,
> +	0xbeff03c1, 0xe0304000,
> +	0x725d0000, 0xe0304100,
> +	0x725d0100, 0xe0304200,
> +	0x725d0200, 0xe0304300,
> +	0x725d0300, 0xb9782a05,
> +	0x80788178, 0x907c9973,
> +	0x877c817c, 0xbf06817c,
> +	0xbf850002, 0x8f788978,
> +	0xbf820001, 0x8f788a78,
> +	0xb9721e06, 0x8f728a72,
> +	0x80787278, 0x8078ff78,
> +	0x00000200, 0x80f8ff78,
> +	0x00000050, 0xbef603ff,
>   	0x01000000, 0xbefc03ff,
> -	0x0000006a, 0xf425003a,
> -	0xf0000000, 0x80f8a078,
> -	0xbf8cc07f, 0x80fc827c,
> +	0x0000006c, 0x80f89078,
> +	0xf429003a, 0xf0000000,
> +	0xbf8cc07f, 0x80fc847c,
>   	0xbf800000, 0xbe803100,
> +	0xbe823102, 0x80f8a078,
>   	0xf42d003a, 0xf0000000,
> -	0x80f8c078, 0xbf8cc07f,
> -	0x80fc887c, 0xbf800000,
> -	0xbe803100, 0xbe823102,
> -	0xbe843104, 0xbe863106,
> +	0xbf8cc07f, 0x80fc887c,
> +	0xbf800000, 0xbe803100,
> +	0xbe823102, 0xbe843104,
> +	0xbe863106, 0x80f8c078,
>   	0xf431003a, 0xf0000000,
> -	0x80f8c078, 0xbf8cc07f,
> -	0x80fc907c, 0xbf800000,
> -	0xbe803100, 0xbe823102,
> -	0xbe843104, 0xbe863106,
> -	0xbe883108, 0xbe8a310a,
> -	0xbe8c310c, 0xbe8e310e,
> -	0xbf06807c, 0xbf84fff0,
> -	0xb9782a05, 0x80788178,
> -	0x907c9973, 0x877c817c,
> -	0xbf06817c, 0xbf850002,
> -	0x8f788978, 0xbf820001,
> -	0x8f788a78, 0xb9721e06,
> -	0x8f728a72, 0x80787278,
> -	0x8078ff78, 0x00000200,
> -	0xbef603ff, 0x01000000,
> -	0xf4211bfa, 0xf0000000,
> -	0x80788478, 0xf4211b3a,
> +	0xbf8cc07f, 0x80fc907c,
> +	0xbf800000, 0xbe803100,
> +	0xbe823102, 0xbe843104,
> +	0xbe863106, 0xbe883108,
> +	0xbe8a310a, 0xbe8c310c,
> +	0xbe8e310e, 0xbf06807c,
> +	0xbf84fff0, 0xb9782a05,
> +	0x80788178, 0x907c9973,
> +	0x877c817c, 0xbf06817c,
> +	0xbf850002, 0x8f788978,
> +	0xbf820001, 0x8f788a78,
> +	0xb9721e06, 0x8f728a72,
> +	0x80787278, 0x8078ff78,
> +	0x00000200, 0xbef603ff,
> +	0x01000000, 0xf4211bfa,
>   	0xf0000000, 0x80788478,
> -	0xf4211b7a, 0xf0000000,
> -	0x80788478, 0xf4211eba,
> +	0xf4211b3a, 0xf0000000,
> +	0x80788478, 0xf4211b7a,
>   	0xf0000000, 0x80788478,
> -	0xf4211efa, 0xf0000000,
> -	0x80788478, 0xf4211c3a,
> +	0xf4211eba, 0xf0000000,
> +	0x80788478, 0xf4211efa,
>   	0xf0000000, 0x80788478,
> -	0xf4211c7a, 0xf0000000,
> -	0x80788478, 0xf4211e7a,
> +	0xf4211c3a, 0xf0000000,
> +	0x80788478, 0xf4211c7a,
>   	0xf0000000, 0x80788478,
> -	0xf4211cfa, 0xf0000000,
> -	0x80788478, 0xf4211bba,
> +	0xf4211e7a, 0xf0000000,
> +	0x80788478, 0xf4211cfa,
>   	0xf0000000, 0x80788478,
> -	0xbf8cc07f, 0xb9eef814,
>   	0xf4211bba, 0xf0000000,
>   	0x80788478, 0xbf8cc07f,
> -	0xb9eef815, 0xbef2036d,
> -	0x876dff72, 0x0000ffff,
> -	0xbefc036f, 0xbefe037a,
> -	0xbeff037b, 0x876f71ff,
> -	0x000003ff, 0xb9ef4803,
> -	0xb9f9f816, 0x876f71ff,
> -	0xfffff800, 0x906f8b6f,
> -	0xb9efa2c3, 0xb9f3f801,
> -	0x876fff72, 0xfc000000,
> -	0x906f9a6f, 0x8f6f906f,
> -	0xbef30380, 0x88736f73,
> -	0x876fff72, 0x02000000,
> -	0x906f996f, 0x8f6f8f6f,
> +	0xb9eef814, 0xf4211bba,
> +	0xf0000000, 0x80788478,
> +	0xbf8cc07f, 0xb9eef815,
> +	0xbef2036d, 0x876dff72,
> +	0x0000ffff, 0xbefc036f,
> +	0xbefe037a, 0xbeff037b,
> +	0x876f71ff, 0x000003ff,
> +	0xb9ef4803, 0xb9f9f816,
> +	0x876f71ff, 0xfffff800,
> +	0x906f8b6f, 0xb9efa2c3,
> +	0xb9f3f801, 0x876fff72,
> +	0xfc000000, 0x906f9a6f,
> +	0x8f6f906f, 0xbef30380,
>   	0x88736f73, 0x876fff72,
> -	0x01000000, 0x906f986f,
> -	0x8f6f996f, 0x88736f73,
> -	0x876fff70, 0x00800000,
> -	0x906f976f, 0xb9f3f807,
> -	0x87fe7e7e, 0x87ea6a6a,
> -	0xb9f0f802, 0xbf8a0000,
> -	0xbe80226c, 0xbf810000,
> +	0x02000000, 0x906f996f,
> +	0x8f6f8f6f, 0x88736f73,
> +	0x876fff72, 0x01000000,
> +	0x906f986f, 0x8f6f996f,
> +	0x88736f73, 0x876fff70,
> +	0x00800000, 0x906f976f,
> +	0xb9f3f807, 0x87fe7e7e,
> +	0x87ea6a6a, 0xb9f0f802,
> +	0xbf8a0000, 0xbe80226c,
> +	0xbf810000, 0xbf9f0000,
>   	0xbf9f0000, 0xbf9f0000,
>   	0xbf9f0000, 0xbf9f0000,
> -	0xbf9f0000, 0x00000000,
>   };
>   static const uint32_t cwsr_trap_arcturus_hex[] = {
>   	0xbf820001, 0xbf8202c4,
> diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
> index fafdfd2..3598621 100644
> --- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
> +++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
> @@ -87,7 +87,7 @@ var S_SAVE_PC_HI_FIRST_REPLAY_MASK		= 0x02000000
>   var S_SAVE_PC_HI_REPLAY_W64H_SHIFT		= 24
>   var S_SAVE_PC_HI_REPLAY_W64H_MASK		= 0x01000000
>   
> -var s_sgpr_save_num				= 106
> +var s_sgpr_save_num				= 108
>   
>   var s_save_spi_init_lo				= exec_lo
>   var s_save_spi_init_hi				= exec_hi
> @@ -357,13 +357,14 @@ L_SAVE_SGPR_LOOP:
>   	s_cmp_lt_u32	m0, 96							//scc = (m0 < first 96 SGPR) ? 1 : 0
>   	s_cbranch_scc1	L_SAVE_SGPR_LOOP					//first 96 SGPR save is complete?
>   
> -	//save the rest 10 SGPR
> +	//save the rest 12 SGPR
>   	s_movrels_b64	s0, s0							//s0 = s[0+m0], s1 = s[1+m0]
>   	s_movrels_b64	s2, s2							//s2 = s[2+m0], s3 = s[3+m0]
>   	s_movrels_b64	s4, s4							//s4 = s[4+m0], s5 = s[5+m0]
>   	s_movrels_b64	s6, s6							//s6 = s[6+m0], s7 = s[7+m0]
>   	s_movrels_b64	s8, s8							//s8 = s[8+m0], s9 = s[9+m0]
> -	write_10sgpr_to_mem(s0, s_save_buf_rsrc0, s_save_mem_offset)
> +	s_movrels_b64	s10, s10						//s10 = s[10+m0], s11 = s[11+m0]
> +	write_12sgpr_to_mem(s0, s_save_buf_rsrc0, s_save_mem_offset)
>   
>   	// restore s_save_buf_rsrc0,1
>   	s_mov_b32	s_save_buf_rsrc0, s_save_xnack_mask
> @@ -766,26 +767,25 @@ L_RESTORE_SGPR:
>   	get_svgpr_size_bytes(s_restore_tmp)
>   	s_add_u32	s_restore_mem_offset, s_restore_mem_offset, s_restore_tmp
>   	s_add_u32	s_restore_mem_offset, s_restore_mem_offset, get_sgpr_size_bytes()
> -	s_sub_u32	s_restore_mem_offset, s_restore_mem_offset, 22*4	//s106~s127 is not saved
> -	s_sub_u32	s_restore_mem_offset, s_restore_mem_offset, 2*4		// restore SGPR from S[n] to S[0], by 2 sgprs group
> +	s_sub_u32	s_restore_mem_offset, s_restore_mem_offset, 20*4	//s108~s127 is not saved
>   
>   	s_mov_b32	s_restore_buf_rsrc2, 0x1000000				//NUM_RECORDS in bytes
>   
>   	s_mov_b32	m0, s_sgpr_save_num
>   
> -	read_2sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
> -
> +	read_4sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
>   	s_waitcnt	lgkmcnt(0)
>   
> -	s_sub_u32	m0, m0, 2						// Restore from S[n] to S[0]
> +	s_sub_u32	m0, m0, 4						// Restore from S[0] to S[104]
>   	s_nop		0							// hazard SALU M0=> S_MOVREL
>   
>   	s_movreld_b64	s0, s0							//s[0+m0] = s0
> +	s_movreld_b64	s2, s2
>   
>   	read_8sgpr_from_mem(s0, s_restore_buf_rsrc0, s_restore_mem_offset)
>   	s_waitcnt	lgkmcnt(0)
>   
> -	s_sub_u32	m0, m0, 8						// Restore from S[n] to S[0]
> +	s_sub_u32	m0, m0, 8						// Restore from S[0] to S[96]
>   	s_nop		0							// hazard SALU M0=> S_MOVREL
>   
>   	s_movreld_b64	s0, s0							//s[0+m0] = s0
> @@ -903,11 +903,11 @@ function write_16sgpr_to_mem(s, s_rsrc, s_mem_offset)
>   	s_addc_u32	s_rsrc[1], s_rsrc[1], 0x0
>   end
>   
> -function write_10sgpr_to_mem(s, s_rsrc, s_mem_offset)
> +function write_12sgpr_to_mem(s, s_rsrc, s_mem_offset)
>   	s_buffer_store_dwordx4	s[0], s_rsrc, 0 glc:1
>   	s_buffer_store_dwordx4	s[4], s_rsrc, 16 glc:1
> -	s_buffer_store_dwordx2	s[8], s_rsrc, 32 glc:1
> -	s_add_u32	s_rsrc[0], s_rsrc[0], 4*16
> +	s_buffer_store_dwordx4	s[8], s_rsrc, 32 glc:1
> +	s_add_u32	s_rsrc[0], s_rsrc[0], 4*12
>   	s_addc_u32	s_rsrc[1], s_rsrc[1], 0x0
>   end
>   
> @@ -918,18 +918,18 @@ function read_hwreg_from_mem(s, s_rsrc, s_mem_offset)
>   end
>   
>   function read_16sgpr_from_mem(s, s_rsrc, s_mem_offset)
> -	s_buffer_load_dwordx16	s, s_rsrc, s_mem_offset glc:1
>   	s_sub_u32	s_mem_offset, s_mem_offset, 4*16
> +	s_buffer_load_dwordx16	s, s_rsrc, s_mem_offset glc:1
>   end
>   
>   function read_8sgpr_from_mem(s, s_rsrc, s_mem_offset)
> +	s_sub_u32	s_mem_offset, s_mem_offset, 4*8
>   	s_buffer_load_dwordx8	s, s_rsrc, s_mem_offset glc:1
> -	s_sub_u32	s_mem_offset, s_mem_offset, 4*16
>   end
>   
> -function read_2sgpr_from_mem(s, s_rsrc, s_mem_offset)
> -	s_buffer_load_dwordx2 s, s_rsrc, s_mem_offset glc:1
> -	s_sub_u32	s_mem_offset, s_mem_offset, 4*8
> +function read_4sgpr_from_mem(s, s_rsrc, s_mem_offset)
> +	s_sub_u32	s_mem_offset, s_mem_offset, 4*4
> +	s_buffer_load_dwordx4	s, s_rsrc, s_mem_offset glc:1
>   end
>   
>   
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-29 18:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-29 15:31 [PATCH 1/3] drm/amdkfd: Fix gfx10 wave64 VGPR context restore Cornwall, Jay
     [not found] ` <1564414258-18161-1-git-send-email-jay.cornwall-5C7GfCeVMHo@public.gmane.org>
2019-07-29 15:31   ` [PATCH 2/3] drm/amdkfd: Save/restore flat_scratch_lo/hi on gfx10 Cornwall, Jay
2019-07-29 15:31   ` [PATCH 3/3] drm/amdkfd: Save/restore vcc " Cornwall, Jay
     [not found]     ` <1564414258-18161-3-git-send-email-jay.cornwall-5C7GfCeVMHo@public.gmane.org>
2019-07-29 16:40       ` Alex Deucher
2019-07-29 18:13       ` Liu, Shaoyun

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.