Skip to contentSkip to conversation

drm/amdgpu: add prototype to dump ip state

PATCH Superseded Sunil Khatri 3 participants 11 messages Apr 12, 2024 – Apr 13, 2024

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 drm/amdgpu: add prototype to dump ip state

Add the prototype for all the ips of different
asics and set them to NULL for now and based on
the need will keep adding the function for each
ip eventually.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c           | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c      | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c          | 1 +
 drivers/gpu/drm/amd/amdgpu/cik.c                  | 1 +
 drivers/gpu/drm/amd/amdgpu/cik_ih.c               | 1 +
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/cz_ih.c                | 1 +
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c           | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c           | 1 +
 drivers/gpu/drm/amd/amdgpu/ih_v6_0.c              | 1 +
 drivers/gpu/drm/amd/amdgpu/ih_v6_1.c              | 1 +
 drivers/gpu/drm/amd/amdgpu/ih_v7_0.c              | 1 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c            | 2 ++
 drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c          | 1 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c          | 1 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c          | 1 +
 drivers/gpu/drm/amd/amdgpu/mes_v10_1.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/nv.c                   | 1 +
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c            | 1 +
 drivers/gpu/drm/amd/amdgpu/si.c                   | 1 +
 drivers/gpu/drm/amd/amdgpu/si_dma.c               | 1 +
 drivers/gpu/drm/amd/amdgpu/si_ih.c                | 1 +
 drivers/gpu/drm/amd/amdgpu/soc15.c                | 1 +
 drivers/gpu/drm/amd/amdgpu/soc21.c                | 1 +
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c             | 2 ++
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c             | 1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c           | 1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c           | 1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c           | 1 +
 drivers/gpu/drm/amd/amdgpu/vi.c                   | 1 +
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
 drivers/gpu/drm/amd/include/amd_shared.h          | 1 +
 drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c        | 1 +
 drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c        | 1 +
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c  | 1 +
 64 files changed, 66 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +1 -0
index 6d72355ac492..34a62033a388 100644
@@ -637,6 +637,7 @@ static const struct amd_ip_funcs acp_ip_funcs = {
 	.soft_reset = acp_soft_reset,
 	.set_clockgating_state = acp_set_clockgating_state,
 	.set_powergating_state = acp_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version acp_ip_block = {
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c +1 -0
index 95f80b9131a8..5bb9e0dacbf3 100644
@@ -875,6 +875,7 @@ static const struct amd_ip_funcs umsch_mm_v4_0_ip_funcs = {
 	.hw_fini = umsch_mm_hw_fini,
 	.suspend = umsch_mm_suspend,
 	.resume = umsch_mm_resume,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version umsch_mm_v4_0_ip_block = {
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +1 -0
index 8baa2e0935cc..d1dc91009c0e 100644
@@ -658,6 +658,7 @@ static const struct amd_ip_funcs amdgpu_vkms_ip_funcs = {
 	.soft_reset = amdgpu_vkms_soft_reset,
 	.set_clockgating_state = amdgpu_vkms_set_clockgating_state,
 	.set_powergating_state = amdgpu_vkms_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version amdgpu_vkms_ip_block = {
drivers/gpu/drm/amd/amdgpu/cik.c +1 -0
index fdbc26346b54..884de42553a6 100644
@@ -2210,6 +2210,7 @@ static const struct amd_ip_funcs cik_common_ip_funcs = {
 	.soft_reset = cik_common_soft_reset,
 	.set_clockgating_state = cik_common_set_clockgating_state,
 	.set_powergating_state = cik_common_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ip_block_version cik_common_ip_block =
drivers/gpu/drm/amd/amdgpu/cik_ih.c +1 -0
index f24e34dc33d1..676f3f612fde 100644
@@ -435,6 +435,7 @@ static const struct amd_ip_funcs cik_ih_ip_funcs = {
 	.soft_reset = cik_ih_soft_reset,
 	.set_clockgating_state = cik_ih_set_clockgating_state,
 	.set_powergating_state = cik_ih_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs cik_ih_funcs = {
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +1 -0
index a3fccc4c1f43..d797b1fbbffc 100644
@@ -1228,6 +1228,7 @@ static const struct amd_ip_funcs cik_sdma_ip_funcs = {
 	.soft_reset = cik_sdma_soft_reset,
 	.set_clockgating_state = cik_sdma_set_clockgating_state,
 	.set_powergating_state = cik_sdma_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/cz_ih.c +1 -0
index c19681492efa..958c84a6af7e 100644
@@ -433,6 +433,7 @@ static const struct amd_ip_funcs cz_ih_ip_funcs = {
 	.soft_reset = cz_ih_soft_reset,
 	.set_clockgating_state = cz_ih_set_clockgating_state,
 	.set_powergating_state = cz_ih_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs cz_ih_funcs = {
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +1 -0
index 221af054d874..7a32ca7d6fc4 100644
@@ -3333,6 +3333,7 @@ static const struct amd_ip_funcs dce_v10_0_ip_funcs = {
 	.soft_reset = dce_v10_0_soft_reset,
 	.set_clockgating_state = dce_v10_0_set_clockgating_state,
 	.set_powergating_state = dce_v10_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static void
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +1 -0
index 69e8b0db6cf7..67c01e137fac 100644
@@ -3464,6 +3464,7 @@ static const struct amd_ip_funcs dce_v11_0_ip_funcs = {
 	.soft_reset = dce_v11_0_soft_reset,
 	.set_clockgating_state = dce_v11_0_set_clockgating_state,
 	.set_powergating_state = dce_v11_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static void
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +1 -0
index 60d40201fdd1..209cd44bbcec 100644
@@ -3154,6 +3154,7 @@ static const struct amd_ip_funcs dce_v6_0_ip_funcs = {
 	.soft_reset = dce_v6_0_soft_reset,
 	.set_clockgating_state = dce_v6_0_set_clockgating_state,
 	.set_powergating_state = dce_v6_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static void
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +1 -0
index 5a5fcc45e452..fff7f4f766b2 100644
@@ -3242,6 +3242,7 @@ static const struct amd_ip_funcs dce_v8_0_ip_funcs = {
 	.soft_reset = dce_v8_0_soft_reset,
 	.set_clockgating_state = dce_v8_0_set_clockgating_state,
 	.set_powergating_state = dce_v8_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static void
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -0
index d5b924222903..a0bc4196ff8b 100644
@@ -9170,6 +9170,7 @@ static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
 	.set_clockgating_state = gfx_v10_0_set_clockgating_state,
 	.set_powergating_state = gfx_v10_0_set_powergating_state,
 	.get_clockgating_state = gfx_v10_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -0
index ae6a0d19e247..58022dbe4e05 100644
@@ -6174,6 +6174,7 @@ static const struct amd_ip_funcs gfx_v11_0_ip_funcs = {
 	.set_clockgating_state = gfx_v11_0_set_clockgating_state,
 	.set_powergating_state = gfx_v11_0_set_powergating_state,
 	.get_clockgating_state = gfx_v11_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs gfx_v11_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -0
index 34f9211b2679..559250c8a147 100644
@@ -3457,6 +3457,7 @@ static const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
 	.soft_reset = gfx_v6_0_soft_reset,
 	.set_clockgating_state = gfx_v6_0_set_clockgating_state,
 	.set_powergating_state = gfx_v6_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -0
index 86a4865b1ae5..81f7ab0dc135 100644
@@ -4977,6 +4977,7 @@ static const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
 	.soft_reset = gfx_v7_0_soft_reset,
 	.set_clockgating_state = gfx_v7_0_set_clockgating_state,
 	.set_powergating_state = gfx_v7_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
index 202ddda57f98..522cbd45dd46 100644
@@ -6878,6 +6878,7 @@ static const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
 	.set_clockgating_state = gfx_v8_0_set_clockgating_state,
 	.set_powergating_state = gfx_v8_0_set_powergating_state,
 	.get_clockgating_state = gfx_v8_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
index 71b555993b7a..ff4229b005dc 100644
@@ -6856,6 +6856,7 @@ static const struct amd_ip_funcs gfx_v9_0_ip_funcs = {
 	.set_clockgating_state = gfx_v9_0_set_clockgating_state,
 	.set_powergating_state = gfx_v9_0_set_powergating_state,
 	.get_clockgating_state = gfx_v9_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +1 -0
index fc33354f1d3d..16881e9345c8 100644
@@ -4016,6 +4016,7 @@ static const struct amd_ip_funcs gfx_v9_4_3_ip_funcs = {
 	.set_clockgating_state = gfx_v9_4_3_set_clockgating_state,
 	.set_powergating_state = gfx_v9_4_3_set_powergating_state,
 	.get_clockgating_state = gfx_v9_4_3_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs gfx_v9_4_3_ring_funcs_compute = {
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -0
index 23b478639921..060e54b8ffff 100644
@@ -1115,6 +1115,7 @@ static const struct amd_ip_funcs gmc_v6_0_ip_funcs = {
 	.soft_reset = gmc_v6_0_soft_reset,
 	.set_clockgating_state = gmc_v6_0_set_clockgating_state,
 	.set_powergating_state = gmc_v6_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_gmc_funcs gmc_v6_0_gmc_funcs = {
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -0
index 3da7b6a2b00d..534825022ddd 100644
@@ -1354,6 +1354,7 @@ static const struct amd_ip_funcs gmc_v7_0_ip_funcs = {
 	.soft_reset = gmc_v7_0_soft_reset,
 	.set_clockgating_state = gmc_v7_0_set_clockgating_state,
 	.set_powergating_state = gmc_v7_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_gmc_funcs gmc_v7_0_gmc_funcs = {
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -0
index d20e5f20ee31..aba787e1386a 100644
@@ -1717,6 +1717,7 @@ static const struct amd_ip_funcs gmc_v8_0_ip_funcs = {
 	.set_clockgating_state = gmc_v8_0_set_clockgating_state,
 	.set_powergating_state = gmc_v8_0_set_powergating_state,
 	.get_clockgating_state = gmc_v8_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_gmc_funcs gmc_v8_0_gmc_funcs = {
drivers/gpu/drm/amd/amdgpu/iceland_ih.c +1 -0
index 2c02ae69883d..2d6f969266b8 100644
@@ -425,6 +425,7 @@ static const struct amd_ip_funcs iceland_ih_ip_funcs = {
 	.soft_reset = iceland_ih_soft_reset,
 	.set_clockgating_state = iceland_ih_set_clockgating_state,
 	.set_powergating_state = iceland_ih_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs iceland_ih_funcs = {
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +1 -0
index ad4ad39f128f..e0756b954cf5 100644
@@ -748,6 +748,7 @@ static const struct amd_ip_funcs ih_v6_0_ip_funcs = {
 	.set_clockgating_state = ih_v6_0_set_clockgating_state,
 	.set_powergating_state = ih_v6_0_set_powergating_state,
 	.get_clockgating_state = ih_v6_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs ih_v6_0_funcs = {
drivers/gpu/drm/amd/amdgpu/ih_v6_1.c +1 -0
index b8da0fc29378..e9da3ac79321 100644
@@ -753,6 +753,7 @@ static const struct amd_ip_funcs ih_v6_1_ip_funcs = {
 	.set_clockgating_state = ih_v6_1_set_clockgating_state,
 	.set_powergating_state = ih_v6_1_set_powergating_state,
 	.get_clockgating_state = ih_v6_1_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs ih_v6_1_funcs = {
drivers/gpu/drm/amd/amdgpu/ih_v7_0.c +1 -0
index 7aed96fa10a9..31ed5030169b 100644
@@ -749,6 +749,7 @@ static const struct amd_ip_funcs ih_v7_0_ip_funcs = {
 	.set_clockgating_state = ih_v7_0_set_clockgating_state,
 	.set_powergating_state = ih_v7_0_set_powergating_state,
 	.get_clockgating_state = ih_v7_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs ih_v7_0_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c +1 -0
index 1c8116d75f63..698c5d4b7484 100644
@@ -759,6 +759,7 @@ static const struct amd_ip_funcs jpeg_v2_0_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = jpeg_v2_0_set_clockgating_state,
 	.set_powergating_state = jpeg_v2_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs jpeg_v2_0_dec_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +2 -0
index 99cd49ee8ef6..0a9a2d58e3ee 100644
@@ -632,6 +632,7 @@ static const struct amd_ip_funcs jpeg_v2_5_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = jpeg_v2_5_set_clockgating_state,
 	.set_powergating_state = jpeg_v2_5_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amd_ip_funcs jpeg_v2_6_ip_funcs = {
@@ -652,6 +653,7 @@ static const struct amd_ip_funcs jpeg_v2_6_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = jpeg_v2_5_set_clockgating_state,
 	.set_powergating_state = jpeg_v2_5_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs jpeg_v2_5_dec_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c +1 -0
index a92481da60cd..e03d46151ae3 100644
@@ -557,6 +557,7 @@ static const struct amd_ip_funcs jpeg_v3_0_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = jpeg_v3_0_set_clockgating_state,
 	.set_powergating_state = jpeg_v3_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs jpeg_v3_0_dec_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +1 -0
index 88ea58d5c4ab..f142cb200552 100644
@@ -719,6 +719,7 @@ static const struct amd_ip_funcs jpeg_v4_0_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = jpeg_v4_0_set_clockgating_state,
 	.set_powergating_state = jpeg_v4_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs jpeg_v4_0_dec_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c +1 -0
index 32caeb37cef9..bc3a6f16f4bf 100644
@@ -1053,6 +1053,7 @@ static const struct amd_ip_funcs jpeg_v4_0_3_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = jpeg_v4_0_3_set_clockgating_state,
 	.set_powergating_state = jpeg_v4_0_3_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs jpeg_v4_0_3_dec_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c +1 -0
index edf5bcdd2bc9..ee29c97721ec 100644
@@ -762,6 +762,7 @@ static const struct amd_ip_funcs jpeg_v4_0_5_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = jpeg_v4_0_5_set_clockgating_state,
 	.set_powergating_state = jpeg_v4_0_5_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs jpeg_v4_0_5_dec_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c +1 -0
index e70200f97555..f5664c92d10d 100644
@@ -513,6 +513,7 @@ static const struct amd_ip_funcs jpeg_v5_0_0_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = jpeg_v5_0_0_set_clockgating_state,
 	.set_powergating_state = jpeg_v5_0_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs jpeg_v5_0_0_dec_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +1 -0
index 1e5ad1e08d2a..4ed0429cf4f7 100644
@@ -1176,6 +1176,7 @@ static const struct amd_ip_funcs mes_v10_1_ip_funcs = {
 	.hw_fini = mes_v10_1_hw_fini,
 	.suspend = mes_v10_1_suspend,
 	.resume = mes_v10_1_resume,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version mes_v10_1_ip_block = {
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1 -0
index e5230078a4cd..e12284d57fd7 100644
@@ -1334,6 +1334,7 @@ static const struct amd_ip_funcs mes_v11_0_ip_funcs = {
 	.hw_fini = mes_v11_0_hw_fini,
 	.suspend = mes_v11_0_suspend,
 	.resume = mes_v11_0_resume,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version mes_v11_0_ip_block = {
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +1 -0
index 4178f4e5dad7..550c5ca4ea03 100644
@@ -713,6 +713,7 @@ static const struct amd_ip_funcs navi10_ih_ip_funcs = {
 	.set_clockgating_state = navi10_ih_set_clockgating_state,
 	.set_powergating_state = navi10_ih_set_powergating_state,
 	.get_clockgating_state = navi10_ih_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs navi10_ih_funcs = {
drivers/gpu/drm/amd/amdgpu/nv.c +1 -0
index 4d7976b77767..d7d3b972392b 100644
@@ -1131,4 +1131,5 @@ static const struct amd_ip_funcs nv_common_ip_funcs = {
 	.set_clockgating_state = nv_common_set_clockgating_state,
 	.set_powergating_state = nv_common_set_powergating_state,
 	.get_clockgating_state = nv_common_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -0
index 07e19caf2bc1..5c67c8a5c35f 100644
@@ -1113,6 +1113,7 @@ static const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
 	.soft_reset = sdma_v2_4_soft_reset,
 	.set_clockgating_state = sdma_v2_4_set_clockgating_state,
 	.set_powergating_state = sdma_v2_4_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -0
index 2ad615be4bb3..4fad06daa9c9 100644
@@ -1553,6 +1553,7 @@ static const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
 	.set_clockgating_state = sdma_v3_0_set_clockgating_state,
 	.set_powergating_state = sdma_v3_0_set_powergating_state,
 	.get_clockgating_state = sdma_v3_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/si.c +1 -0
index 67e179c7e347..b5b15dba9a76 100644
@@ -2706,6 +2706,7 @@ static const struct amd_ip_funcs si_common_ip_funcs = {
 	.soft_reset = si_common_soft_reset,
 	.set_clockgating_state = si_common_set_clockgating_state,
 	.set_powergating_state = si_common_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ip_block_version si_common_ip_block =
drivers/gpu/drm/amd/amdgpu/si_dma.c +1 -0
index 9aa0e11ee673..f969e5cc2a5e 100644
@@ -708,6 +708,7 @@ static const struct amd_ip_funcs si_dma_ip_funcs = {
 	.soft_reset = si_dma_soft_reset,
 	.set_clockgating_state = si_dma_set_clockgating_state,
 	.set_powergating_state = si_dma_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/si_ih.c +1 -0
index cada9f300a7f..3b7427f5a6c9 100644
@@ -296,6 +296,7 @@ static const struct amd_ip_funcs si_ih_ip_funcs = {
 	.soft_reset = si_ih_soft_reset,
 	.set_clockgating_state = si_ih_set_clockgating_state,
 	.set_powergating_state = si_ih_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs si_ih_funcs = {
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -0
index c8abbf5da736..6ba6c96c91c8 100644
@@ -1501,4 +1501,5 @@ static const struct amd_ip_funcs soc15_common_ip_funcs = {
 	.set_clockgating_state = soc15_common_set_clockgating_state,
 	.set_powergating_state = soc15_common_set_powergating_state,
 	.get_clockgating_state= soc15_common_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -0
index 43ca63fe85ac..40e7ab0716cd 100644
@@ -985,4 +985,5 @@ static const struct amd_ip_funcs soc21_common_ip_funcs = {
 	.set_clockgating_state = soc21_common_set_clockgating_state,
 	.set_powergating_state = soc21_common_set_powergating_state,
 	.get_clockgating_state = soc21_common_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
drivers/gpu/drm/amd/amdgpu/tonga_ih.c +1 -0
index 450b6e831509..794a1f7bc2ca 100644
@@ -486,6 +486,7 @@ static const struct amd_ip_funcs tonga_ih_ip_funcs = {
 	.post_soft_reset = tonga_ih_post_soft_reset,
 	.set_clockgating_state = tonga_ih_set_clockgating_state,
 	.set_powergating_state = tonga_ih_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ih_funcs tonga_ih_funcs = {
drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c +1 -0
index a6006f231c65..1e232ed23102 100644
@@ -819,6 +819,7 @@ static const struct amd_ip_funcs uvd_v3_1_ip_funcs = {
 	.soft_reset = uvd_v3_1_soft_reset,
 	.set_clockgating_state = uvd_v3_1_set_clockgating_state,
 	.set_powergating_state = uvd_v3_1_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version uvd_v3_1_ip_block = {
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -0
index 1aa09ad7bbe3..48bcf41e5558 100644
@@ -769,6 +769,7 @@ static const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
 	.soft_reset = uvd_v4_2_soft_reset,
 	.set_clockgating_state = uvd_v4_2_set_clockgating_state,
 	.set_powergating_state = uvd_v4_2_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -0
index f8b229b75435..838b7d720c52 100644
@@ -877,6 +877,7 @@ static const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
 	.set_clockgating_state = uvd_v5_0_set_clockgating_state,
 	.set_powergating_state = uvd_v5_0_set_powergating_state,
 	.get_clockgating_state = uvd_v5_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -0
index a9a6880f44e3..036378f5f53f 100644
@@ -1545,6 +1545,7 @@ static const struct amd_ip_funcs uvd_v6_0_ip_funcs = {
 	.set_clockgating_state = uvd_v6_0_set_clockgating_state,
 	.set_powergating_state = uvd_v6_0_set_powergating_state,
 	.get_clockgating_state = uvd_v6_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs uvd_v6_0_ring_phys_funcs = {
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1 -0
index a08e7abca423..2178cf5a27b7 100644
@@ -626,6 +626,7 @@ static const struct amd_ip_funcs vce_v2_0_ip_funcs = {
 	.soft_reset = vce_v2_0_soft_reset,
 	.set_clockgating_state = vce_v2_0_set_clockgating_state,
 	.set_powergating_state = vce_v2_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1 -0
index f4760748d349..0f0d4b0d50cb 100644
@@ -913,6 +913,7 @@ static const struct amd_ip_funcs vce_v3_0_ip_funcs = {
 	.set_clockgating_state = vce_v3_0_set_clockgating_state,
 	.set_powergating_state = vce_v3_0_set_powergating_state,
 	.get_clockgating_state = vce_v3_0_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs vce_v3_0_ring_phys_funcs = {
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1 -0
index aaceecd558cf..7ff5d0574454 100644
@@ -1902,6 +1902,7 @@ static const struct amd_ip_funcs vcn_v1_0_ip_funcs = {
 	.post_soft_reset = NULL /* vcn_v1_0_post_soft_reset */,
 	.set_clockgating_state = vcn_v1_0_set_clockgating_state,
 	.set_powergating_state = vcn_v1_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 /*
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -0
index e357d8cf0c01..4df1b75f971a 100644
@@ -2008,6 +2008,7 @@ static const struct amd_ip_funcs vcn_v2_0_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = vcn_v2_0_set_clockgating_state,
 	.set_powergating_state = vcn_v2_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ring_funcs vcn_v2_0_dec_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +2 -0
index 1cd8a94b0fbc..d91c3154641b 100644
@@ -1901,6 +1901,7 @@ static const struct amd_ip_funcs vcn_v2_5_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = vcn_v2_5_set_clockgating_state,
 	.set_powergating_state = vcn_v2_5_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amd_ip_funcs vcn_v2_6_ip_funcs = {
@@ -1921,6 +1922,7 @@ static const struct amd_ip_funcs vcn_v2_6_ip_funcs = {
         .post_soft_reset = NULL,
         .set_clockgating_state = vcn_v2_5_set_clockgating_state,
         .set_powergating_state = vcn_v2_5_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version vcn_v2_5_ip_block =
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +1 -0
index 8f82fb887e9c..e64af339e924 100644
@@ -2230,6 +2230,7 @@ static const struct amd_ip_funcs vcn_v3_0_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = vcn_v3_0_set_clockgating_state,
 	.set_powergating_state = vcn_v3_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version vcn_v3_0_ip_block = {
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +1 -0
index 832d15f7b5f6..efaad53e2ffe 100644
@@ -2130,6 +2130,7 @@ static const struct amd_ip_funcs vcn_v4_0_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = vcn_v4_0_set_clockgating_state,
 	.set_powergating_state = vcn_v4_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version vcn_v4_0_ip_block = {
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +1 -0
index 203fa988322b..599b6466183e 100644
@@ -1660,6 +1660,7 @@ static const struct amd_ip_funcs vcn_v4_0_3_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = vcn_v4_0_3_set_clockgating_state,
 	.set_powergating_state = vcn_v4_0_3_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version vcn_v4_0_3_ip_block = {
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +1 -0
index 501e53e69f2a..c649fa2c19e8 100644
@@ -1752,6 +1752,7 @@ static const struct amd_ip_funcs vcn_v4_0_5_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = vcn_v4_0_5_set_clockgating_state,
 	.set_powergating_state = vcn_v4_0_5_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version vcn_v4_0_5_ip_block = {
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +1 -0
index bc60c554eb32..9d0d1efd1acc 100644
@@ -1328,6 +1328,7 @@ static const struct amd_ip_funcs vcn_v5_0_0_ip_funcs = {
 	.post_soft_reset = NULL,
 	.set_clockgating_state = vcn_v5_0_0_set_clockgating_state,
 	.set_powergating_state = vcn_v5_0_0_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version vcn_v5_0_0_ip_block = {
drivers/gpu/drm/amd/amdgpu/vi.c +1 -0
index 2415355b037c..a04aa6833fc5 100644
@@ -2058,6 +2058,7 @@ static const struct amd_ip_funcs vi_common_ip_funcs = {
 	.set_clockgating_state = vi_common_set_clockgating_state,
 	.set_powergating_state = vi_common_set_powergating_state,
 	.get_clockgating_state = vi_common_get_clockgating_state,
+	.dump_ip_state = NULL,
 };
 
 static const struct amdgpu_ip_block_version vi_common_ip_block =
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
index d52701f6d1d0..15c0de0e5af5 100644
@@ -3111,6 +3111,7 @@ static const struct amd_ip_funcs amdgpu_dm_funcs = {
 	.soft_reset = dm_soft_reset,
 	.set_clockgating_state = dm_set_clockgating_state,
 	.set_powergating_state = dm_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version dm_ip_block = {
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
index b0a6256e89f4..9884f6c48a7d 100644
@@ -321,6 +321,7 @@ struct amd_ip_funcs {
 	int (*set_powergating_state)(void *handle,
 				     enum amd_powergating_state state);
 	void (*get_clockgating_state)(void *handle, u64 *flags);
+	void (*dump_ip_state)(void *handle);
 };
 
 
drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c +1 -0
index 5cb4725c773f..8c07f8c7f3ab 100644
@@ -3316,6 +3316,7 @@ static const struct amd_ip_funcs kv_dpm_ip_funcs = {
 	.soft_reset = kv_dpm_soft_reset,
 	.set_clockgating_state = kv_dpm_set_clockgating_state,
 	.set_powergating_state = kv_dpm_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version kv_smu_ip_block = {
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +1 -0
index eb4da3666e05..c312b9332326 100644
@@ -8060,6 +8060,7 @@ static const struct amd_ip_funcs si_dpm_ip_funcs = {
 	.soft_reset = si_dpm_soft_reset,
 	.set_clockgating_state = si_dpm_set_clockgating_state,
 	.set_powergating_state = si_dpm_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version si_smu_ip_block =
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +1 -0
index 133d1ee6e67c..c63474ee17a7 100644
@@ -302,6 +302,7 @@ static const struct amd_ip_funcs pp_ip_funcs = {
 	.soft_reset = pp_sw_reset,
 	.set_clockgating_state = pp_set_clockgating_state,
 	.set_powergating_state = pp_set_powergating_state,
+	.dump_ip_state = NULL,
 };
 
 const struct amdgpu_ip_block_version pp_smu_ip_block =
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/2 drm/amdgpu: Add support of gfx10 register dump

Adding initial set of registers for ipdump during devcoredump starting with gfx10 gc registers.

ip dump is triggered when gpu reset happens via devcoredump and the memory is allocated by each ip and is freed once the dump is complete by devcoredump.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  16 +++
 .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  |  22 +++
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 127 +++++++++++++++++-
 .../include/asic_reg/gc/gc_10_1_0_offset.h    |  12 ++
 4 files changed, 176 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +16 -0
index 65c17c59c152..e173ad86a241 100644
@@ -139,6 +139,18 @@ enum amdgpu_ss {
 	AMDGPU_SS_DRV_UNLOAD
 };
 
+struct hwip_reg_entry {
+	u32	hwip;
+	u32	inst;
+	u32	seg;
+	u32	reg_offset;
+};
+
+struct reg_pair {
+	u32	offset;
+	u32	value;
+};
+
 struct amdgpu_watchdog_timer {
 	bool timeout_fatal_disable;
 	uint32_t period; /* maxCycles = (1 << period), the number of cycles before a timeout */
@@ -1152,6 +1164,10 @@ struct amdgpu_device {
 	bool                            debug_largebar;
 	bool                            debug_disable_soft_recovery;
 	bool                            debug_use_vram_fw_buf;
+
+	/* IP register dump */
+	struct reg_pair			*ip_dump;
+	uint32_t			num_regs;
 };
 
 static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +22 -0
index 1129e5e5fb42..2079f67c9fac 100644
@@ -261,6 +261,18 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 	drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
 	drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
 
+	/* Add IP dump for each ip */
+	if (coredump->adev->ip_dump != NULL) {
+		struct reg_pair *pair;
+
+		pair = (struct reg_pair *)coredump->adev->ip_dump;
+		drm_printf(&p, "IP register dump\n");
+		drm_printf(&p, "Offset \t Value\n");
+		for (int i = 0; i < coredump->adev->num_regs; i++)
+			drm_printf(&p, "0x%04x \t 0x%08x\n", pair[i].offset, pair[i].value);
+		drm_printf(&p, "\n");
+	}
+
 	/* Add ring buffer information */
 	drm_printf(&p, "Ring buffer information\n");
 	for (int i = 0; i < coredump->adev->num_rings; i++) {
@@ -299,6 +311,11 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 
 static void amdgpu_devcoredump_free(void *data)
 {
+	struct amdgpu_coredump_info *temp = data;
+
+	kfree(temp->adev->ip_dump);
+	temp->adev->ip_dump = NULL;
+	temp->adev->num_regs = 0;
 	kfree(data);
 }
 
@@ -337,6 +354,11 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost,
 
 	coredump->adev = adev;
 
+	/* Trigger ip dump here to capture the value of registers */
+	for (int i = 0; i < adev->num_ip_blocks; i++)
+		if (adev->ip_blocks[i].version->funcs->dump_ip_state)
+			adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev);
+
 	ktime_get_ts64(&coredump->reset_time);
 
 	dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +126 -1

145 lines not on this page · raw message

drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h +12 -0
index 4908044f7409..4c8e7fdb6976 100644
@@ -4830,6 +4830,8 @@
 #define mmCP_ECC_FIRSTOCCURRENCE_RING2_BASE_IDX                                                        0
 #define mmGB_EDC_MODE                                                                                  0x1e1e
 #define mmGB_EDC_MODE_BASE_IDX                                                                         0
+#define mmCP_DEBUG                                                                                     0x1e1f
+#define mmCP_DEBUG_BASE_IDX                                                                            0
 #define mmCP_FETCHER_SOURCE                                                                            0x1e22
 #define mmCP_FETCHER_SOURCE_BASE_IDX                                                                   0
 #define mmCP_PQ_WPTR_POLL_CNTL                                                                         0x1e23
@@ -7778,6 +7780,8 @@
 #define mmCP_MES_DOORBELL_CONTROL5_BASE_IDX                                                            1
 #define mmCP_MES_DOORBELL_CONTROL6                                                                     0x2841
 #define mmCP_MES_DOORBELL_CONTROL6_BASE_IDX                                                            1
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR                                                            0x2842
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR_BASE_IDX                                                   1
 #define mmCP_MES_GP0_LO                                                                                0x2843
 #define mmCP_MES_GP0_LO_BASE_IDX                                                                       1
 #define mmCP_MES_GP0_HI                                                                                0x2844
@@ -9332,10 +9336,16 @@
 #define mmRLC_LB_CNTR_INIT_1_BASE_IDX                                                                  1
 #define mmRLC_LB_CNTR_1                                                                                0x4c1c
 #define mmRLC_LB_CNTR_1_BASE_IDX                                                                       1
+#define mmRLC_GPM_DEBUG_INST_ADDR                                                                      0x4c1d
+#define mmRLC_GPM_DEBUG_INST_ADDR_BASE_IDX                                                             1
 #define mmRLC_JUMP_TABLE_RESTORE                                                                       0x4c1e
 #define mmRLC_JUMP_TABLE_RESTORE_BASE_IDX                                                              1
 #define mmRLC_PG_DELAY_2                                                                               0x4c1f
 #define mmRLC_PG_DELAY_2_BASE_IDX                                                                      1
+#define mmRLC_GPM_DEBUG_INST_A                                                                         0x4c22
+#define mmRLC_GPM_DEBUG_INST_A_BASE_IDX                                                                1
+#define mmRLC_GPM_DEBUG_INST_B                                                                         0x4c23
+#define mmRLC_GPM_DEBUG_INST_B_BASE_IDX                                                                1
 #define mmRLC_GPU_CLOCK_COUNT_LSB                                                                      0x4c24
 #define mmRLC_GPU_CLOCK_COUNT_LSB_BASE_IDX                                                             1
 #define mmRLC_GPU_CLOCK_COUNT_MSB                                                                      0x4c25
@@ -9720,6 +9730,8 @@
 #define mmRLC_SPM_THREAD_TRACE_CTRL_BASE_IDX                                                           1
 #define mmRLC_LB_CNTR_2                                                                                0x4de7
 #define mmRLC_LB_CNTR_2_BASE_IDX                                                                       1
+#define mmRLC_LX6_CORE_PDEBUG_INST                                                                     0x4deb
+#define mmRLC_LX6_CORE_PDEBUG_INST_BASE_IDX                                                            1
 #define mmRLC_CPAXI_DOORBELL_MON_CTRL                                                                  0x4df1
 #define mmRLC_CPAXI_DOORBELL_MON_CTRL_BASE_IDX                                                         1
 #define mmRLC_CPAXI_DOORBELL_MON_STAT                                                                  0x4df2
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 9 lines · Sunil Khatri

Adding initial set of registers for ipdump during devcoredump starting with gfx10 gc registers.

ip dump is triggered when gpu reset happens via devcoredump and the memory is allocated by each ip and is freed once the dump is complete by devcoredump.

Quoted 4 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  16 +++
 .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  |  22 +++

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Quoted 74 lines
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 127 +++++++++++++++++-
 .../include/asic_reg/gc/gc_10_1_0_offset.h    |  12 ++
 4 files changed, 176 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +16 -0
index 65c17c59c152..e173ad86a241 100644
@@ -139,6 +139,18 @@ enum amdgpu_ss {
        AMDGPU_SS_DRV_UNLOAD
 };
 
+struct hwip_reg_entry {
+       u32     hwip;
+       u32     inst;
+       u32     seg;
+       u32     reg_offset;
+};
+
+struct reg_pair {
+       u32     offset;
+       u32     value;
+};
+
 struct amdgpu_watchdog_timer {
        bool timeout_fatal_disable;
        uint32_t period; /* maxCycles = (1 << period), the number of cycles before a timeout */
@@ -1152,6 +1164,10 @@ struct amdgpu_device {
        bool                            debug_largebar;
        bool                            debug_disable_soft_recovery;
        bool                            debug_use_vram_fw_buf;
+
+       /* IP register dump */
+       struct reg_pair                 *ip_dump;
+       uint32_t                        num_regs;
 };
 
 static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +17 -0
index 1129e5e5fb42..2079f67c9fac 100644
@@ -261,6 +261,18 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
        drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
        drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
 
+       /* Add IP dump for each ip */
+       if (coredump->adev->ip_dump != NULL) {
+               struct reg_pair *pair;
+
+               pair = (struct reg_pair *)coredump->adev->ip_dump;
+               drm_printf(&p, "IP register dump\n");
+               drm_printf(&p, "Offset \t Value\n");
+               for (int i = 0; i < coredump->adev->num_regs; i++)
+                       drm_printf(&p, "0x%04x \t 0x%08x\n", pair[i].offset, pair[i].value);
+               drm_printf(&p, "\n");
+       }
+
        /* Add ring buffer information */
        drm_printf(&p, "Ring buffer information\n");
        for (int i = 0; i < coredump->adev->num_rings; i++) {
@@ -299,6 +311,11 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 
 static void amdgpu_devcoredump_free(void *data)
 {
+       struct amdgpu_coredump_info *temp = data;
+
+       kfree(temp->adev->ip_dump);
+       temp->adev->ip_dump = NULL;
+       temp->adev->num_regs = 0;
        kfree(data);
 }
 

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost, · line 361

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +5 -0
@@ -337,6 +354,11 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost,
 
        coredump->adev = adev;
 
+       /* Trigger ip dump here to capture the value of registers */
+       for (int i = 0; i < adev->num_ip_blocks; i++)
+               if (adev->ip_blocks[i].version->funcs->dump_ip_state)
+                       adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev);
+

This seems too complicated. I think it would be easier to

Quoted 128 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +0 -0
        ktime_get_ts64(&coredump->reset_time);
 
        dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +110 -0
index a0bc4196ff8b..66e2915a8b4d 100644
@@ -276,6 +276,99 @@ MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
 MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
 MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
 
+static const struct hwip_reg_entry gc_reg_list_10_1[] = {
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS3) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_ERROR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_HPD_STATUS0) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPF_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPG_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_VM_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmPA_CL_CNTL_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRMI_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_DCACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_ICACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQG_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmTCP_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmWD_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_DEBUG) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC1_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC2_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_ME_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_PFP_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_COMMAND) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_MESSAGE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_1) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_3) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_4) },
+       { SOC15_REG_ENTRY(GC, 0, mmSMU_RLC_RESPONSE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_GPM_STAT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SPP_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_BOOTLOAD_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_INT_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_GENERAL_6) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_A) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_B) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_ADDR) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_LX6_CORE_PDEBUG_INST) }
+};
+
 static const struct soc15_reg_golden golden_settings_gc_10_1[] = {
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),
@@ -9154,6 +9247,38 @@ static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring)
        amdgpu_ring_write(ring, gcr_cntl); /* GCR_CNTL */
 }
 
+static void gfx_v10_ip_dump(void *handle)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
+       struct reg_pair *ptr, *gfx10_pair;
+       uint32_t new_count;
+
+       /*
+        * Allocate memory based on the no of registers for each block.
+        * Since adev->ip_dump is common pointer and we add more
+        * memory to it as we move through different IP's of the ASIC.
+        *
+        * This memory needs to be freed after gpu reset once the ip
+        * dump is done in the devcoredump.
+        */
+       new_count = adev->num_regs + reg_count;
+       ptr = krealloc_array(adev->ip_dump, new_count, sizeof(struct reg_pair), GFP_KERNEL);

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring) · line 9276

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -0
+       if (ptr) {
+               adev->ip_dump = ptr;
+               gfx10_pair = &ptr[adev->num_regs];
+               adev->num_regs = new_count;
+       } else {
+               DRM_ERROR("Failed to allocate memory for IP Dump\n");
+               return;
+       }
+
+       for (uint32_t i = 0; i < reg_count; i++) {

Some compilers don't like variables defined within code.

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring) · line 9280

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -0
+               gfx10_pair[i].offset = gc_reg_list_10_1[i].reg_offset;
+               gfx10_pair[i].value = RREG32(SOC15_REG_ENTRY_OFFSET(gc_reg_list_10_1[i]));
+       }
+}

This seems too complicated. Just pass drm_printer to the ip_dump callbacks and let each IP dump their state directly. E.g.,

       for (i = 0; i < adev->num_ip_blocks; i++) {
               if (adev->ip_blocks[i].version->funcs->dump_ip_state) {
                       drm_printf(&p, "$s IP state\n",

adev->ip_blocks[i].version->funcs->name);

adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev, &p);
              }
       }

Alex

Quoted 64 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -1
+
 static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
        .name = "gfx_v10_0",
        .early_init = gfx_v10_0_early_init,
@@ -9170,7 +9295,7 @@ static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
        .set_clockgating_state = gfx_v10_0_set_clockgating_state,
        .set_powergating_state = gfx_v10_0_set_powergating_state,
        .get_clockgating_state = gfx_v10_0_get_clockgating_state,
-       .dump_ip_state = NULL,
+       .dump_ip_state = gfx_v10_ip_dump,
 };
 
 static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h +12 -1
index 4908044f7409..4c8e7fdb6976 100644
@@ -4830,6 +4830,8 @@
 #define mmCP_ECC_FIRSTOCCURRENCE_RING2_BASE_IDX                                                        0
 #define mmGB_EDC_MODE                                                                                  0x1e1e
 #define mmGB_EDC_MODE_BASE_IDX                                                                         0
+#define mmCP_DEBUG                                                                                     0x1e1f
+#define mmCP_DEBUG_BASE_IDX                                                                            0
 #define mmCP_FETCHER_SOURCE                                                                            0x1e22
 #define mmCP_FETCHER_SOURCE_BASE_IDX                                                                   0
 #define mmCP_PQ_WPTR_POLL_CNTL                                                                         0x1e23
@@ -7778,6 +7780,8 @@
 #define mmCP_MES_DOORBELL_CONTROL5_BASE_IDX                                                            1
 #define mmCP_MES_DOORBELL_CONTROL6                                                                     0x2841
 #define mmCP_MES_DOORBELL_CONTROL6_BASE_IDX                                                            1
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR                                                            0x2842
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR_BASE_IDX                                                   1
 #define mmCP_MES_GP0_LO                                                                                0x2843
 #define mmCP_MES_GP0_LO_BASE_IDX                                                                       1
 #define mmCP_MES_GP0_HI                                                                                0x2844
@@ -9332,10 +9336,16 @@
 #define mmRLC_LB_CNTR_INIT_1_BASE_IDX                                                                  1
 #define mmRLC_LB_CNTR_1                                                                                0x4c1c
 #define mmRLC_LB_CNTR_1_BASE_IDX                                                                       1
+#define mmRLC_GPM_DEBUG_INST_ADDR                                                                      0x4c1d
+#define mmRLC_GPM_DEBUG_INST_ADDR_BASE_IDX                                                             1
 #define mmRLC_JUMP_TABLE_RESTORE                                                                       0x4c1e
 #define mmRLC_JUMP_TABLE_RESTORE_BASE_IDX                                                              1
 #define mmRLC_PG_DELAY_2                                                                               0x4c1f
 #define mmRLC_PG_DELAY_2_BASE_IDX                                                                      1
+#define mmRLC_GPM_DEBUG_INST_A                                                                         0x4c22
+#define mmRLC_GPM_DEBUG_INST_A_BASE_IDX                                                                1
+#define mmRLC_GPM_DEBUG_INST_B                                                                         0x4c23
+#define mmRLC_GPM_DEBUG_INST_B_BASE_IDX                                                                1
 #define mmRLC_GPU_CLOCK_COUNT_LSB                                                                      0x4c24
 #define mmRLC_GPU_CLOCK_COUNT_LSB_BASE_IDX                                                             1
 #define mmRLC_GPU_CLOCK_COUNT_MSB                                                                      0x4c25
@@ -9720,6 +9730,8 @@
 #define mmRLC_SPM_THREAD_TRACE_CTRL_BASE_IDX                                                           1
 #define mmRLC_LB_CNTR_2                                                                                0x4de7
 #define mmRLC_LB_CNTR_2_BASE_IDX                                                                       1
+#define mmRLC_LX6_CORE_PDEBUG_INST                                                                     0x4deb
+#define mmRLC_LX6_CORE_PDEBUG_INST_BASE_IDX                                                            1
 #define mmRLC_CPAXI_DOORBELL_MON_CTRL                                                                  0x4df1
 #define mmRLC_CPAXI_DOORBELL_MON_CTRL_BASE_IDX                                                         1
 #define mmRLC_CPAXI_DOORBELL_MON_STAT                                                                  0x4df2
--

2.34.1

#3 lore raw

Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 3 lines · Alex Deucher

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Sure would push the v3 with the changes.

Regards

Sunil

#4 lore raw

Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 10 lines · Sunil

On 4/12/2024 8:50 PM, Alex Deucher wrote:

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Sure would push the v3 with the changes.

note my other comments further down as well.

Alex

Quoted 4 lines

Regards

Sunil

#5 lore raw

Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

In reply to Alex Deucher
Quoted 9 lines · Alex Deucher
Quoted 8 lines · Sunil Khatri

Adding initial set of registers for ipdump during devcoredump starting with gfx10 gc registers.

ip dump is triggered when gpu reset happens via devcoredump and the memory is allocated by each ip and is freed once the dump is complete by devcoredump.

Quoted 7 lines
Quoted 4 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  16 +++
  .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  |  22 +++

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Sure

Quoted 77 lines
Quoted 77 lines

  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 127 +++++++++++++++++-
  .../include/asic_reg/gc/gc_10_1_0_offset.h    |  12 ++
  4 files changed, 176 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +16 -0
index 65c17c59c152..e173ad86a241 100644
@@ -139,6 +139,18 @@ enum amdgpu_ss {
         AMDGPU_SS_DRV_UNLOAD
  };
 
+struct hwip_reg_entry {
+       u32     hwip;
+       u32     inst;
+       u32     seg;
+       u32     reg_offset;
+};
+
+struct reg_pair {
+       u32     offset;
+       u32     value;
+};
+
  struct amdgpu_watchdog_timer {
         bool timeout_fatal_disable;
         uint32_t period; /* maxCycles = (1 << period), the number of cycles before a timeout */
@@ -1152,6 +1164,10 @@ struct amdgpu_device {
         bool                            debug_largebar;
         bool                            debug_disable_soft_recovery;
         bool                            debug_use_vram_fw_buf;
+
+       /* IP register dump */
+       struct reg_pair                 *ip_dump;
+       uint32_t                        num_regs;
  };
 
  static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +17 -0
index 1129e5e5fb42..2079f67c9fac 100644
@@ -261,6 +261,18 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
         drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
         drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
 
+       /* Add IP dump for each ip */
+       if (coredump->adev->ip_dump != NULL) {
+               struct reg_pair *pair;
+
+               pair = (struct reg_pair *)coredump->adev->ip_dump;
+               drm_printf(&p, "IP register dump\n");
+               drm_printf(&p, "Offset \t Value\n");
+               for (int i = 0; i < coredump->adev->num_regs; i++)
+                       drm_printf(&p, "0x%04x \t 0x%08x\n", pair[i].offset, pair[i].value);
+               drm_printf(&p, "\n");
+       }
+
         /* Add ring buffer information */
         drm_printf(&p, "Ring buffer information\n");
         for (int i = 0; i < coredump->adev->num_rings; i++) {
@@ -299,6 +311,11 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 
  static void amdgpu_devcoredump_free(void *data)
  {
+       struct amdgpu_coredump_info *temp = data;
+
+       kfree(temp->adev->ip_dump);
+       temp->adev->ip_dump = NULL;
+       temp->adev->num_regs = 0;
         kfree(data);
  }
 
@@ -337,6 +354,11 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost,
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost, · line 361

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +5 -0
         coredump->adev = adev;
 
+       /* Trigger ip dump here to capture the value of registers */
+       for (int i = 0; i < adev->num_ip_blocks; i++)
+               if (adev->ip_blocks[i].version->funcs->dump_ip_state)
+                       adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev);
+

This seems too complicated. I think it would be easier to

This is how all other per IP functions are called. What do you suggest ?

Quoted 132 lines
Quoted 132 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +0 -0
         ktime_get_ts64(&coredump->reset_time);
 
         dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +113 -0
index a0bc4196ff8b..66e2915a8b4d 100644
@@ -276,6 +276,99 @@ MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
 
+static const struct hwip_reg_entry gc_reg_list_10_1[] = {
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS3) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_ERROR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_HPD_STATUS0) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPF_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPG_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_VM_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmPA_CL_CNTL_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRMI_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_DCACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_ICACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQG_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmTCP_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmWD_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_DEBUG) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC1_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC2_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_ME_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_PFP_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_COMMAND) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_MESSAGE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_1) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_3) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_4) },
+       { SOC15_REG_ENTRY(GC, 0, mmSMU_RLC_RESPONSE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_GPM_STAT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SPP_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_BOOTLOAD_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_INT_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_GENERAL_6) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_A) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_B) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_ADDR) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_LX6_CORE_PDEBUG_INST) }
+};
+
  static const struct soc15_reg_golden golden_settings_gc_10_1[] = {
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),
@@ -9154,6 +9247,38 @@ static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring)
         amdgpu_ring_write(ring, gcr_cntl); /* GCR_CNTL */
  }
 
+static void gfx_v10_ip_dump(void *handle)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
+       struct reg_pair *ptr, *gfx10_pair;
+       uint32_t new_count;
+
+       /*
+        * Allocate memory based on the no of registers for each block.
+        * Since adev->ip_dump is common pointer and we add more
+        * memory to it as we move through different IP's of the ASIC.
+        *
+        * This memory needs to be freed after gpu reset once the ip
+        * dump is done in the devcoredump.
+        */
+       new_count = adev->num_regs + reg_count;
+       ptr = krealloc_array(adev->ip_dump, new_count, sizeof(struct reg_pair), GFP_KERNEL);
+       if (ptr) {
+               adev->ip_dump = ptr;
+               gfx10_pair = &ptr[adev->num_regs];
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring) · line 9276

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -0
+               adev->num_regs = new_count;
+       } else {
+               DRM_ERROR("Failed to allocate memory for IP Dump\n");
+               return;
+       }
+
+       for (uint32_t i = 0; i < reg_count; i++) {

Some compilers don't like variables defined within code.

Sure

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring) · line 9280

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -0
+               gfx10_pair[i].offset = gc_reg_list_10_1[i].reg_offset;
+               gfx10_pair[i].value = RREG32(SOC15_REG_ENTRY_OFFSET(gc_reg_list_10_1[i]));
+       }
+}

This seems too complicated. Just pass drm_printer to the ip_dump callbacks and let each IP dump their state directly. E.g.,

Quoted 8 lines
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (adev->ip_blocks[i].version->funcs->dump_ip_state) {
                        drm_printf(&p, "$s IP state\n",

adev->ip_blocks[i].version->funcs->name);

adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev, &p);
               }
        }

I did try this but there is a problem in that approach. drm_printer is created on the buffer which is provided by "amdgpu_devcoredump_read" and "amdgpu_devcoredump_read" is only called when the user opens the file

cat /sys/class/devcoredump/devcd1/data and by that time gpu is reset and registers dont hold the value of interest. I tried this approach first and got all FFFF or reset values of the registers. We need to capture the values in "amdgpu_coredump" which is immediately called after GPU reset and values are what we need for debugging.

Crux is we need to capture data after gpu reset but read depends on when user open the file which is too late and hence we need to capture all the data in advance immediately after reset before recovery.

Regards

Sunil Khatri

Quoted 67 lines

Alex

Quoted 64 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -1
+
  static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
         .name = "gfx_v10_0",
         .early_init = gfx_v10_0_early_init,
@@ -9170,7 +9295,7 @@ static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
         .set_clockgating_state = gfx_v10_0_set_clockgating_state,
         .set_powergating_state = gfx_v10_0_set_powergating_state,
         .get_clockgating_state = gfx_v10_0_get_clockgating_state,
-       .dump_ip_state = NULL,
+       .dump_ip_state = gfx_v10_ip_dump,
  };
 
  static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h +12 -1
index 4908044f7409..4c8e7fdb6976 100644
@@ -4830,6 +4830,8 @@
  #define mmCP_ECC_FIRSTOCCURRENCE_RING2_BASE_IDX                                                        0
  #define mmGB_EDC_MODE                                                                                  0x1e1e
  #define mmGB_EDC_MODE_BASE_IDX                                                                         0
+#define mmCP_DEBUG                                                                                     0x1e1f
+#define mmCP_DEBUG_BASE_IDX                                                                            0
  #define mmCP_FETCHER_SOURCE                                                                            0x1e22
  #define mmCP_FETCHER_SOURCE_BASE_IDX                                                                   0
  #define mmCP_PQ_WPTR_POLL_CNTL                                                                         0x1e23
@@ -7778,6 +7780,8 @@
  #define mmCP_MES_DOORBELL_CONTROL5_BASE_IDX                                                            1
  #define mmCP_MES_DOORBELL_CONTROL6                                                                     0x2841
  #define mmCP_MES_DOORBELL_CONTROL6_BASE_IDX                                                            1
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR                                                            0x2842
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR_BASE_IDX                                                   1
  #define mmCP_MES_GP0_LO                                                                                0x2843
  #define mmCP_MES_GP0_LO_BASE_IDX                                                                       1
  #define mmCP_MES_GP0_HI                                                                                0x2844
@@ -9332,10 +9336,16 @@
  #define mmRLC_LB_CNTR_INIT_1_BASE_IDX                                                                  1
  #define mmRLC_LB_CNTR_1                                                                                0x4c1c
  #define mmRLC_LB_CNTR_1_BASE_IDX                                                                       1
+#define mmRLC_GPM_DEBUG_INST_ADDR                                                                      0x4c1d
+#define mmRLC_GPM_DEBUG_INST_ADDR_BASE_IDX                                                             1
  #define mmRLC_JUMP_TABLE_RESTORE                                                                       0x4c1e
  #define mmRLC_JUMP_TABLE_RESTORE_BASE_IDX                                                              1
  #define mmRLC_PG_DELAY_2                                                                               0x4c1f
  #define mmRLC_PG_DELAY_2_BASE_IDX                                                                      1
+#define mmRLC_GPM_DEBUG_INST_A                                                                         0x4c22
+#define mmRLC_GPM_DEBUG_INST_A_BASE_IDX                                                                1
+#define mmRLC_GPM_DEBUG_INST_B                                                                         0x4c23
+#define mmRLC_GPM_DEBUG_INST_B_BASE_IDX                                                                1
  #define mmRLC_GPU_CLOCK_COUNT_LSB                                                                      0x4c24
  #define mmRLC_GPU_CLOCK_COUNT_LSB_BASE_IDX                                                             1
  #define mmRLC_GPU_CLOCK_COUNT_MSB                                                                      0x4c25
@@ -9720,6 +9730,8 @@
  #define mmRLC_SPM_THREAD_TRACE_CTRL_BASE_IDX                                                           1
  #define mmRLC_LB_CNTR_2                                                                                0x4de7
  #define mmRLC_LB_CNTR_2_BASE_IDX                                                                       1
+#define mmRLC_LX6_CORE_PDEBUG_INST                                                                     0x4deb
+#define mmRLC_LX6_CORE_PDEBUG_INST_BASE_IDX                                                            1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL                                                                  0x4df1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL_BASE_IDX                                                         1
  #define mmRLC_CPAXI_DOORBELL_MON_STAT                                                                  0x4df2
--

2.34.1

#6 lore raw

Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 277 lines · Sunil
Quoted 9 lines · Alex Deucher
Quoted 8 lines · Sunil Khatri

Adding initial set of registers for ipdump during devcoredump starting with gfx10 gc registers.

ip dump is triggered when gpu reset happens via devcoredump and the memory is allocated by each ip and is freed once the dump is complete by devcoredump.

Quoted 7 lines
Quoted 4 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  16 +++
  .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  |  22 +++

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Sure

Quoted 77 lines
Quoted 77 lines

  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 127 +++++++++++++++++-
  .../include/asic_reg/gc/gc_10_1_0_offset.h    |  12 ++
  4 files changed, 176 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +16 -0
index 65c17c59c152..e173ad86a241 100644
@@ -139,6 +139,18 @@ enum amdgpu_ss {
         AMDGPU_SS_DRV_UNLOAD
  };
 
+struct hwip_reg_entry {
+       u32     hwip;
+       u32     inst;
+       u32     seg;
+       u32     reg_offset;
+};
+
+struct reg_pair {
+       u32     offset;
+       u32     value;
+};
+
  struct amdgpu_watchdog_timer {
         bool timeout_fatal_disable;
         uint32_t period; /* maxCycles = (1 << period), the number of cycles before a timeout */
@@ -1152,6 +1164,10 @@ struct amdgpu_device {
         bool                            debug_largebar;
         bool                            debug_disable_soft_recovery;
         bool                            debug_use_vram_fw_buf;
+
+       /* IP register dump */
+       struct reg_pair                 *ip_dump;
+       uint32_t                        num_regs;
  };
 
  static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +17 -0
index 1129e5e5fb42..2079f67c9fac 100644
@@ -261,6 +261,18 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
         drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
         drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
 
+       /* Add IP dump for each ip */
+       if (coredump->adev->ip_dump != NULL) {
+               struct reg_pair *pair;
+
+               pair = (struct reg_pair *)coredump->adev->ip_dump;
+               drm_printf(&p, "IP register dump\n");
+               drm_printf(&p, "Offset \t Value\n");
+               for (int i = 0; i < coredump->adev->num_regs; i++)
+                       drm_printf(&p, "0x%04x \t 0x%08x\n", pair[i].offset, pair[i].value);
+               drm_printf(&p, "\n");
+       }
+
         /* Add ring buffer information */
         drm_printf(&p, "Ring buffer information\n");
         for (int i = 0; i < coredump->adev->num_rings; i++) {
@@ -299,6 +311,11 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 
  static void amdgpu_devcoredump_free(void *data)
  {
+       struct amdgpu_coredump_info *temp = data;
+
+       kfree(temp->adev->ip_dump);
+       temp->adev->ip_dump = NULL;
+       temp->adev->num_regs = 0;
         kfree(data);
  }
 
@@ -337,6 +354,11 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost,
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost, · line 361

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +5 -0
         coredump->adev = adev;
 
+       /* Trigger ip dump here to capture the value of registers */
+       for (int i = 0; i < adev->num_ip_blocks; i++)
+               if (adev->ip_blocks[i].version->funcs->dump_ip_state)
+                       adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev);
+

This seems too complicated. I think it would be easier to

This is how all other per IP functions are called. What do you suggest ?

Quoted 132 lines
Quoted 132 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +0 -0
         ktime_get_ts64(&coredump->reset_time);
 
         dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +113 -0
index a0bc4196ff8b..66e2915a8b4d 100644
@@ -276,6 +276,99 @@ MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
 
+static const struct hwip_reg_entry gc_reg_list_10_1[] = {
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS3) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_ERROR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_HPD_STATUS0) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPF_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPG_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_VM_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmPA_CL_CNTL_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRMI_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_DCACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_ICACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQG_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmTCP_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmWD_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_DEBUG) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC1_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC2_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_ME_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_PFP_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_COMMAND) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_MESSAGE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_1) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_3) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_4) },
+       { SOC15_REG_ENTRY(GC, 0, mmSMU_RLC_RESPONSE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_GPM_STAT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SPP_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_BOOTLOAD_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_INT_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_GENERAL_6) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_A) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_B) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_ADDR) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_LX6_CORE_PDEBUG_INST) }
+};
+
  static const struct soc15_reg_golden golden_settings_gc_10_1[] = {
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),
@@ -9154,6 +9247,38 @@ static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring)
         amdgpu_ring_write(ring, gcr_cntl); /* GCR_CNTL */
  }
 
+static void gfx_v10_ip_dump(void *handle)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
+       struct reg_pair *ptr, *gfx10_pair;
+       uint32_t new_count;
+
+       /*
+        * Allocate memory based on the no of registers for each block.
+        * Since adev->ip_dump is common pointer and we add more
+        * memory to it as we move through different IP's of the ASIC.
+        *
+        * This memory needs to be freed after gpu reset once the ip
+        * dump is done in the devcoredump.
+        */
+       new_count = adev->num_regs + reg_count;
+       ptr = krealloc_array(adev->ip_dump, new_count, sizeof(struct reg_pair), GFP_KERNEL);
+       if (ptr) {
+               adev->ip_dump = ptr;
+               gfx10_pair = &ptr[adev->num_regs];
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring) · line 9276

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -0
+               adev->num_regs = new_count;
+       } else {
+               DRM_ERROR("Failed to allocate memory for IP Dump\n");
+               return;
+       }
+
+       for (uint32_t i = 0; i < reg_count; i++) {

Some compilers don't like variables defined within code.

Sure

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring) · line 9280

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -0
+               gfx10_pair[i].offset = gc_reg_list_10_1[i].reg_offset;
+               gfx10_pair[i].value = RREG32(SOC15_REG_ENTRY_OFFSET(gc_reg_list_10_1[i]));
+       }
+}

This seems too complicated. Just pass drm_printer to the ip_dump callbacks and let each IP dump their state directly. E.g.,

Quoted 8 lines
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (adev->ip_blocks[i].version->funcs->dump_ip_state) {
                        drm_printf(&p, "$s IP state\n",

adev->ip_blocks[i].version->funcs->name);

adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev, &p);
               }
        }

I did try this but there is a problem in that approach. drm_printer is created on the buffer which is provided by "amdgpu_devcoredump_read" and "amdgpu_devcoredump_read" is only called when the user opens the file

cat /sys/class/devcoredump/devcd1/data and by that time gpu is reset and registers dont hold the value of interest. I tried this approach first and got all FFFF or reset values of the registers.
We need to capture the values in "amdgpu_coredump" which is immediately called after GPU reset and values are what we need for debugging.

Quoted 3 lines

Crux is we need to capture data after gpu reset but read depends on when user open the file which is too late and hence we need to capture all the data in advance immediately after reset before recovery.

Ah, ok. I would suggest pre-allocating the memory to store the dump state in each IP block in sw_init(). I guess we'd probably need two IP callbacks, dump_state() and print_state(). Then call the ip->dump_state() in the GPU recovery sequence before we try soft resets, then in devcore dump you can call the ip->print_state() callback to print the state to the devcore dump output.

Alex

Quoted 72 lines

Regards

Sunil Khatri

Quoted 67 lines

Alex

Quoted 64 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -1
+
  static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
         .name = "gfx_v10_0",
         .early_init = gfx_v10_0_early_init,
@@ -9170,7 +9295,7 @@ static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
         .set_clockgating_state = gfx_v10_0_set_clockgating_state,
         .set_powergating_state = gfx_v10_0_set_powergating_state,
         .get_clockgating_state = gfx_v10_0_get_clockgating_state,
-       .dump_ip_state = NULL,
+       .dump_ip_state = gfx_v10_ip_dump,
  };
 
  static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h +12 -1
index 4908044f7409..4c8e7fdb6976 100644
@@ -4830,6 +4830,8 @@
  #define mmCP_ECC_FIRSTOCCURRENCE_RING2_BASE_IDX                                                        0
  #define mmGB_EDC_MODE                                                                                  0x1e1e
  #define mmGB_EDC_MODE_BASE_IDX                                                                         0
+#define mmCP_DEBUG                                                                                     0x1e1f
+#define mmCP_DEBUG_BASE_IDX                                                                            0
  #define mmCP_FETCHER_SOURCE                                                                            0x1e22
  #define mmCP_FETCHER_SOURCE_BASE_IDX                                                                   0
  #define mmCP_PQ_WPTR_POLL_CNTL                                                                         0x1e23
@@ -7778,6 +7780,8 @@
  #define mmCP_MES_DOORBELL_CONTROL5_BASE_IDX                                                            1
  #define mmCP_MES_DOORBELL_CONTROL6                                                                     0x2841
  #define mmCP_MES_DOORBELL_CONTROL6_BASE_IDX                                                            1
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR                                                            0x2842
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR_BASE_IDX                                                   1
  #define mmCP_MES_GP0_LO                                                                                0x2843
  #define mmCP_MES_GP0_LO_BASE_IDX                                                                       1
  #define mmCP_MES_GP0_HI                                                                                0x2844
@@ -9332,10 +9336,16 @@
  #define mmRLC_LB_CNTR_INIT_1_BASE_IDX                                                                  1
  #define mmRLC_LB_CNTR_1                                                                                0x4c1c
  #define mmRLC_LB_CNTR_1_BASE_IDX                                                                       1
+#define mmRLC_GPM_DEBUG_INST_ADDR                                                                      0x4c1d
+#define mmRLC_GPM_DEBUG_INST_ADDR_BASE_IDX                                                             1
  #define mmRLC_JUMP_TABLE_RESTORE                                                                       0x4c1e
  #define mmRLC_JUMP_TABLE_RESTORE_BASE_IDX                                                              1
  #define mmRLC_PG_DELAY_2                                                                               0x4c1f
  #define mmRLC_PG_DELAY_2_BASE_IDX                                                                      1
+#define mmRLC_GPM_DEBUG_INST_A                                                                         0x4c22
+#define mmRLC_GPM_DEBUG_INST_A_BASE_IDX                                                                1
+#define mmRLC_GPM_DEBUG_INST_B                                                                         0x4c23
+#define mmRLC_GPM_DEBUG_INST_B_BASE_IDX                                                                1
  #define mmRLC_GPU_CLOCK_COUNT_LSB                                                                      0x4c24
  #define mmRLC_GPU_CLOCK_COUNT_LSB_BASE_IDX                                                             1
  #define mmRLC_GPU_CLOCK_COUNT_MSB                                                                      0x4c25
@@ -9720,6 +9730,8 @@
  #define mmRLC_SPM_THREAD_TRACE_CTRL_BASE_IDX                                                           1
  #define mmRLC_LB_CNTR_2                                                                                0x4de7
  #define mmRLC_LB_CNTR_2_BASE_IDX                                                                       1
+#define mmRLC_LX6_CORE_PDEBUG_INST                                                                     0x4deb
+#define mmRLC_LX6_CORE_PDEBUG_INST_BASE_IDX                                                            1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL                                                                  0x4df1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL_BASE_IDX                                                         1
  #define mmRLC_CPAXI_DOORBELL_MON_STAT                                                                  0x4df2
--

2.34.1

#7 lore raw

Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 275 lines · Alex Deucher
Quoted 271 lines · Sunil
Quoted 9 lines · Alex Deucher
Quoted 8 lines · Sunil Khatri

Adding initial set of registers for ipdump during devcoredump starting with gfx10 gc registers.

ip dump is triggered when gpu reset happens via devcoredump and the memory is allocated by each ip and is freed once the dump is complete by devcoredump.

Quoted 7 lines
Quoted 4 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  16 +++
   .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  |  22 +++

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Sure

Quoted 76 lines
Quoted 76 lines
   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 127 +++++++++++++++++-
   .../include/asic_reg/gc/gc_10_1_0_offset.h    |  12 ++
   4 files changed, 176 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +16 -0
index 65c17c59c152..e173ad86a241 100644
@@ -139,6 +139,18 @@ enum amdgpu_ss {
          AMDGPU_SS_DRV_UNLOAD
   };
 
+struct hwip_reg_entry {
+       u32     hwip;
+       u32     inst;
+       u32     seg;
+       u32     reg_offset;
+};
+
+struct reg_pair {
+       u32     offset;
+       u32     value;
+};
+
   struct amdgpu_watchdog_timer {
          bool timeout_fatal_disable;
          uint32_t period; /* maxCycles = (1 << period), the number of cycles before a timeout */
@@ -1152,6 +1164,10 @@ struct amdgpu_device {
          bool                            debug_largebar;
          bool                            debug_disable_soft_recovery;
          bool                            debug_use_vram_fw_buf;
+
+       /* IP register dump */
+       struct reg_pair                 *ip_dump;
+       uint32_t                        num_regs;
   };
 
   static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +17 -0
index 1129e5e5fb42..2079f67c9fac 100644
@@ -261,6 +261,18 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
          drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
          drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
 
+       /* Add IP dump for each ip */
+       if (coredump->adev->ip_dump != NULL) {
+               struct reg_pair *pair;
+
+               pair = (struct reg_pair *)coredump->adev->ip_dump;
+               drm_printf(&p, "IP register dump\n");
+               drm_printf(&p, "Offset \t Value\n");
+               for (int i = 0; i < coredump->adev->num_regs; i++)
+                       drm_printf(&p, "0x%04x \t 0x%08x\n", pair[i].offset, pair[i].value);
+               drm_printf(&p, "\n");
+       }
+
          /* Add ring buffer information */
          drm_printf(&p, "Ring buffer information\n");
          for (int i = 0; i < coredump->adev->num_rings; i++) {
@@ -299,6 +311,11 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 
   static void amdgpu_devcoredump_free(void *data)
   {
+       struct amdgpu_coredump_info *temp = data;
+
+       kfree(temp->adev->ip_dump);
+       temp->adev->ip_dump = NULL;
+       temp->adev->num_regs = 0;
          kfree(data);
   }
 
@@ -337,6 +354,11 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost,
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost, · line 361

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +5 -0
          coredump->adev = adev;
 
+       /* Trigger ip dump here to capture the value of registers */
+       for (int i = 0; i < adev->num_ip_blocks; i++)
+               if (adev->ip_blocks[i].version->funcs->dump_ip_state)
+                       adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev);
+

This seems too complicated. I think it would be easier to

This is how all other per IP functions are called. What do you suggest ?

Quoted 131 lines
Quoted 131 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +0 -0
          ktime_get_ts64(&coredump->reset_time);
 
          dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +113 -0
index a0bc4196ff8b..66e2915a8b4d 100644
@@ -276,6 +276,99 @@ MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
   MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
   MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
 
+static const struct hwip_reg_entry gc_reg_list_10_1[] = {
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS3) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_ERROR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_HPD_STATUS0) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPF_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPG_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_VM_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmPA_CL_CNTL_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRMI_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_DCACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_ICACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQG_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmTCP_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmWD_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_DEBUG) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC1_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC2_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_ME_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_PFP_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_COMMAND) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_MESSAGE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_1) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_3) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_4) },
+       { SOC15_REG_ENTRY(GC, 0, mmSMU_RLC_RESPONSE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_GPM_STAT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SPP_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_BOOTLOAD_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_INT_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_GENERAL_6) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_A) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_B) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_ADDR) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_LX6_CORE_PDEBUG_INST) }
+};
+
   static const struct soc15_reg_golden golden_settings_gc_10_1[] = {
          SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
          SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),
@@ -9154,6 +9247,38 @@ static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring)
          amdgpu_ring_write(ring, gcr_cntl); /* GCR_CNTL */
   }
 
+static void gfx_v10_ip_dump(void *handle)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
+       struct reg_pair *ptr, *gfx10_pair;
+       uint32_t new_count;
+
+       /*
+        * Allocate memory based on the no of registers for each block.
+        * Since adev->ip_dump is common pointer and we add more
+        * memory to it as we move through different IP's of the ASIC.
+        *
+        * This memory needs to be freed after gpu reset once the ip
+        * dump is done in the devcoredump.
+        */
+       new_count = adev->num_regs + reg_count;
+       ptr = krealloc_array(adev->ip_dump, new_count, sizeof(struct reg_pair), GFP_KERNEL);
+       if (ptr) {
+               adev->ip_dump = ptr;
+               gfx10_pair = &ptr[adev->num_regs];
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring) · line 9276

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -0
+               adev->num_regs = new_count;
+       } else {
+               DRM_ERROR("Failed to allocate memory for IP Dump\n");
+               return;
+       }
+
+       for (uint32_t i = 0; i < reg_count; i++) {

Some compilers don't like variables defined within code.

Sure

Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring) · line 9280

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -0
+               gfx10_pair[i].offset = gc_reg_list_10_1[i].reg_offset;
+               gfx10_pair[i].value = RREG32(SOC15_REG_ENTRY_OFFSET(gc_reg_list_10_1[i]));
+       }
+}

This seems too complicated. Just pass drm_printer to the ip_dump callbacks and let each IP dump their state directly. E.g.,

Quoted 8 lines
         for (i = 0; i < adev->num_ip_blocks; i++) {
                 if (adev->ip_blocks[i].version->funcs->dump_ip_state) {
                         drm_printf(&p, "$s IP state\n",

adev->ip_blocks[i].version->funcs->name);

adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev, &p);
                }
         }

I did try this but there is a problem in that approach. drm_printer is created on the buffer which is provided by "amdgpu_devcoredump_read" and "amdgpu_devcoredump_read" is only called when the user opens the file

cat /sys/class/devcoredump/devcd1/data and by that time gpu is reset and registers dont hold the value of interest. I tried this approach first and got all FFFF or reset values of the registers.
We need to capture the values in "amdgpu_coredump" which is immediately called after GPU reset and values are what we need for debugging.

Quoted 3 lines

Crux is we need to capture data after gpu reset but read depends on when user open the file which is too late and hence we need to capture all the data in advance immediately after reset before recovery.

Quoted 6 lines

Ah, ok. I would suggest pre-allocating the memory to store the dump state in each IP block in sw_init(). I guess we'd probably need two IP callbacks, dump_state() and print_state(). Then call the ip->dump_state() in the GPU recovery sequence before we try soft resets, then in devcore dump you can call the ip->print_state() callback to print the state to the devcore dump output.

The problem is there is no standard size to proallocate memory statically. Each IP hold different set of registers and every time i add a new register set i have to update the memory size and allocate dynamically but this can be handled. Another problem i see with this approach is where to store the memory ptr of each IP. One way is to Directly have ptrs for each IP in amdgpu_device global struct or other way is to add ptr in IP specific struct withing amdgpu_device which are to be traversed in a hardcode way as they arent in an array or list.

For eg: we have to access each of these in a hardcode way in code as these structures arent in a list/array form to traverse for each ip.

/* nbio */
structamdgpu_nbionbio;
        /* hdp */
structamdgpu_hdphdp;
        /* smuio */
structamdgpu_smuiosmuio;
        /* mmhub */
structamdgpu_mmhubmmhub;
        /* gfxhub */
structamdgpu_gfxhubgfxhub;
        /* gfx */
structamdgpu_gfxgfx;
        /* sdma */
structamdgpu_sdmasdma;
        /* lsdma */
structamdgpu_lsdmalsdma;
        /* uvd */
structamdgpu_uvduvd;
        /* vce */
structamdgpu_vcevce;

In current code the approach is to add memory based on need for each IP in the same ptr and keep adding registers to it and we can search with offset value in the devcoredump to debug.

Regards
Sunil

Quoted 73 lines

Alex

Quoted 70 lines

Regards

Sunil Khatri

Quoted 66 lines

Alex

Quoted 64 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -1
+
   static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
          .name = "gfx_v10_0",
          .early_init = gfx_v10_0_early_init,
@@ -9170,7 +9295,7 @@ static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
          .set_clockgating_state = gfx_v10_0_set_clockgating_state,
          .set_powergating_state = gfx_v10_0_set_powergating_state,
          .get_clockgating_state = gfx_v10_0_get_clockgating_state,
-       .dump_ip_state = NULL,
+       .dump_ip_state = gfx_v10_ip_dump,
   };
 
   static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h +12 -1
index 4908044f7409..4c8e7fdb6976 100644
@@ -4830,6 +4830,8 @@
   #define mmCP_ECC_FIRSTOCCURRENCE_RING2_BASE_IDX                                                        0
   #define mmGB_EDC_MODE                                                                                  0x1e1e
   #define mmGB_EDC_MODE_BASE_IDX                                                                         0
+#define mmCP_DEBUG                                                                                     0x1e1f
+#define mmCP_DEBUG_BASE_IDX                                                                            0
   #define mmCP_FETCHER_SOURCE                                                                            0x1e22
   #define mmCP_FETCHER_SOURCE_BASE_IDX                                                                   0
   #define mmCP_PQ_WPTR_POLL_CNTL                                                                         0x1e23
@@ -7778,6 +7780,8 @@
   #define mmCP_MES_DOORBELL_CONTROL5_BASE_IDX                                                            1
   #define mmCP_MES_DOORBELL_CONTROL6                                                                     0x2841
   #define mmCP_MES_DOORBELL_CONTROL6_BASE_IDX                                                            1
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR                                                            0x2842
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR_BASE_IDX                                                   1
   #define mmCP_MES_GP0_LO                                                                                0x2843
   #define mmCP_MES_GP0_LO_BASE_IDX                                                                       1
   #define mmCP_MES_GP0_HI                                                                                0x2844
@@ -9332,10 +9336,16 @@
   #define mmRLC_LB_CNTR_INIT_1_BASE_IDX                                                                  1
   #define mmRLC_LB_CNTR_1                                                                                0x4c1c
   #define mmRLC_LB_CNTR_1_BASE_IDX                                                                       1
+#define mmRLC_GPM_DEBUG_INST_ADDR                                                                      0x4c1d
+#define mmRLC_GPM_DEBUG_INST_ADDR_BASE_IDX                                                             1
   #define mmRLC_JUMP_TABLE_RESTORE                                                                       0x4c1e
   #define mmRLC_JUMP_TABLE_RESTORE_BASE_IDX                                                              1
   #define mmRLC_PG_DELAY_2                                                                               0x4c1f
   #define mmRLC_PG_DELAY_2_BASE_IDX                                                                      1
+#define mmRLC_GPM_DEBUG_INST_A                                                                         0x4c22
+#define mmRLC_GPM_DEBUG_INST_A_BASE_IDX                                                                1
+#define mmRLC_GPM_DEBUG_INST_B                                                                         0x4c23
+#define mmRLC_GPM_DEBUG_INST_B_BASE_IDX                                                                1
   #define mmRLC_GPU_CLOCK_COUNT_LSB                                                                      0x4c24
   #define mmRLC_GPU_CLOCK_COUNT_LSB_BASE_IDX                                                             1
   #define mmRLC_GPU_CLOCK_COUNT_MSB                                                                      0x4c25
@@ -9720,6 +9730,8 @@
   #define mmRLC_SPM_THREAD_TRACE_CTRL_BASE_IDX                                                           1
   #define mmRLC_LB_CNTR_2                                                                                0x4de7
   #define mmRLC_LB_CNTR_2_BASE_IDX                                                                       1
+#define mmRLC_LX6_CORE_PDEBUG_INST                                                                     0x4deb
+#define mmRLC_LX6_CORE_PDEBUG_INST_BASE_IDX                                                            1
   #define mmRLC_CPAXI_DOORBELL_MON_CTRL                                                                  0x4df1
   #define mmRLC_CPAXI_DOORBELL_MON_CTRL_BASE_IDX                                                         1
   #define mmRLC_CPAXI_DOORBELL_MON_STAT                                                                  0x4df2
--

2.34.1

#8 lore raw

Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 323 lines · Sunil

On 4/12/2024 10:42 PM, Alex Deucher wrote:

On Fri, Apr 12, 2024 at 1:05 PM Khatri, Sunil <[email protected]> wrote:

On 4/12/2024 8:50 PM, Alex Deucher wrote:

On Fri, Apr 12, 2024 at 10:00 AM Sunil Khatri <[email protected]> wrote:

Adding initial set of registers for ipdump during
devcoredump starting with gfx10 gc registers.

ip dump is triggered when gpu reset happens via
devcoredump and the memory is allocated by each
ip and is freed once the dump is complete by
devcoredump.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  16 +++
  .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  |  22 +++

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Sure

  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 127 +++++++++++++++++-
  .../include/asic_reg/gc/gc_10_1_0_offset.h    |  12 ++
  4 files changed, 176 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +16 -0
index 65c17c59c152..e173ad86a241 100644
@@ -139,6 +139,18 @@ enum amdgpu_ss {
         AMDGPU_SS_DRV_UNLOAD
  };
 
+struct hwip_reg_entry {
+       u32     hwip;
+       u32     inst;
+       u32     seg;
+       u32     reg_offset;
+};
+
+struct reg_pair {
+       u32     offset;
+       u32     value;
+};
+
  struct amdgpu_watchdog_timer {
         bool timeout_fatal_disable;
         uint32_t period; /* maxCycles = (1 << period), the number of cycles before a timeout */
@@ -1152,6 +1164,10 @@ struct amdgpu_device {
         bool                            debug_largebar;
         bool                            debug_disable_soft_recovery;
         bool                            debug_use_vram_fw_buf;
+
+       /* IP register dump */
+       struct reg_pair                 *ip_dump;
+       uint32_t                        num_regs;
  };
 
  static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +22 -0
index 1129e5e5fb42..2079f67c9fac 100644
@@ -261,6 +261,18 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
         drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
         drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
 
+       /* Add IP dump for each ip */
+       if (coredump->adev->ip_dump != NULL) {
+               struct reg_pair *pair;
+
+               pair = (struct reg_pair *)coredump->adev->ip_dump;
+               drm_printf(&p, "IP register dump\n");
+               drm_printf(&p, "Offset \t Value\n");
+               for (int i = 0; i < coredump->adev->num_regs; i++)
+                       drm_printf(&p, "0x%04x \t 0x%08x\n", pair[i].offset, pair[i].value);
+               drm_printf(&p, "\n");
+       }
+
         /* Add ring buffer information */
         drm_printf(&p, "Ring buffer information\n");
         for (int i = 0; i < coredump->adev->num_rings; i++) {
@@ -299,6 +311,11 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 
  static void amdgpu_devcoredump_free(void *data)
  {
+       struct amdgpu_coredump_info *temp = data;
+
+       kfree(temp->adev->ip_dump);
+       temp->adev->ip_dump = NULL;
+       temp->adev->num_regs = 0;
         kfree(data);
  }
 
@@ -337,6 +354,11 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost,
 
         coredump->adev = adev;
 
+       /* Trigger ip dump here to capture the value of registers */
+       for (int i = 0; i < adev->num_ip_blocks; i++)
+               if (adev->ip_blocks[i].version->funcs->dump_ip_state)
+                       adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev);
+
 

This seems too complicated. I think it would be easier to

This is how all other per IP functions are called. What do you suggest ?

         ktime_get_ts64(&coredump->reset_time);

         dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +120 -0
index a0bc4196ff8b..66e2915a8b4d 100644
@@ -276,6 +276,99 @@ MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
 
+static const struct hwip_reg_entry gc_reg_list_10_1[] = {
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS3) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_ERROR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_HPD_STATUS0) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPF_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPG_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_VM_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmPA_CL_CNTL_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRMI_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_DCACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_ICACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQG_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmTCP_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmWD_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_DEBUG) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC1_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC2_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_ME_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_PFP_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_COMMAND) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_MESSAGE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_1) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_3) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_4) },
+       { SOC15_REG_ENTRY(GC, 0, mmSMU_RLC_RESPONSE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_GPM_STAT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SPP_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_BOOTLOAD_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_INT_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_GENERAL_6) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_A) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_B) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_ADDR) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_LX6_CORE_PDEBUG_INST) }
+};
+
  static const struct soc15_reg_golden golden_settings_gc_10_1[] = {
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),
@@ -9154,6 +9247,38 @@ static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring)
         amdgpu_ring_write(ring, gcr_cntl); /* GCR_CNTL */
  }
 
+static void gfx_v10_ip_dump(void *handle)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
+       struct reg_pair *ptr, *gfx10_pair;
+       uint32_t new_count;
+
+       /*
+        * Allocate memory based on the no of registers for each block.
+        * Since adev->ip_dump is common pointer and we add more
+        * memory to it as we move through different IP's of the ASIC.
+        *
+        * This memory needs to be freed after gpu reset once the ip
+        * dump is done in the devcoredump.
+        */
+       new_count = adev->num_regs + reg_count;
+       ptr = krealloc_array(adev->ip_dump, new_count, sizeof(struct reg_pair), GFP_KERNEL);
+       if (ptr) {
+               adev->ip_dump = ptr;
+               gfx10_pair = &ptr[adev->num_regs];
+               adev->num_regs = new_count;
+       } else {
+               DRM_ERROR("Failed to allocate memory for IP Dump\n");
+               return;
+       }
+
+       for (uint32_t i = 0; i < reg_count; i++) {
 

Some compilers don't like variables defined within code.

Sure

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -0
+               gfx10_pair[i].offset = gc_reg_list_10_1[i].reg_offset;
+               gfx10_pair[i].value = RREG32(SOC15_REG_ENTRY_OFFSET(gc_reg_list_10_1[i]));
+       }
+}

This seems too complicated. Just pass drm_printer to the ip_dump callbacks and let each IP dump their state directly. E.g.,

        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (adev->ip_blocks[i].version->funcs->dump_ip_state) {
                        drm_printf(&p, "$s IP state\n",

adev->ip_blocks[i].version->funcs->name);

adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev, &p);
               }
        }

I did try this but there is a problem in that approach. drm_printer is created on the buffer which is provided by "amdgpu_devcoredump_read" and "amdgpu_devcoredump_read" is only called when the user opens the file

cat /sys/class/devcoredump/devcd1/data and by that time gpu is reset and registers dont hold the value of interest. I tried this approach first and got all FFFF or reset values of the registers.
We need to capture the values in "amdgpu_coredump" which is immediately called after GPU reset and values are what we need for debugging.

Crux is we need to capture data after gpu reset but read depends on when user open the file which is too late and hence we need to capture all the data in advance immediately after reset before recovery.

Ah, ok. I would suggest pre-allocating the memory to store the dump state in each IP block in sw_init(). I guess we'd probably need two IP callbacks, dump_state() and print_state(). Then call the ip->dump_state() in the GPU recovery sequence before we try soft resets, then in devcore dump you can call the ip->print_state() callback to print the state to the devcore dump output.

The problem is there is no standard size to proallocate memory statically. Each IP hold different set of registers and every time i add a new register set i have to update the memory size and allocate dynamically but this can be handled. Another problem i see with this approach is where to store the memory ptr of each IP. One way is to Directly have ptrs for each IP in amdgpu_device global struct or other way is to add ptr in IP specific struct withing amdgpu_device which are to be traversed in a hardcode way as they arent in an array or list.

For eg: we have to access each of these in a hardcode way in code as these structures arent in a list/array form to traverse for each ip.

/* nbio */

        struct amdgpu_nbio              nbio;
        /* hdp */
        struct amdgpu_hdp               hdp;
        /* smuio */
        struct amdgpu_smuio             smuio;
        /* mmhub */
        struct amdgpu_mmhub             mmhub;
        /* gfxhub */
        struct amdgpu_gfxhub            gfxhub;
        /* gfx */
        struct amdgpu_gfx               gfx;
        /* sdma */
        struct amdgpu_sdma              sdma;
        /* lsdma */
        struct amdgpu_lsdma             lsdma;
        /* uvd */
        struct amdgpu_uvd               uvd;
        /* vce */
        struct amdgpu_vce               vce;
Quoted 2 lines

In current code the approach is to add memory based on need for each IP in the same ptr and keep adding registers to it and we can search with offset value in the devcoredump to debug.

Each IP can store the data however they want. E.g., in the gfx code, we can do:

gfx_v10_0_sw_init()
{
...
adev->gfx.ip_state = kcalloc(2, gc_reg_list_10_1, GFP_KERNEL);
...
}

gfx_v10_0_dump_state()
{
for (i = 0; i < ARRAY_SIZE(gc_reg_list_10_1); i += 2)

    adev->gfx.ip_state[i] = gc_reg_list_10_1[i];
    adev->gfx.ip_state[i+1] = RREG32(gc_reg_list_10_1[i]);
}

}

gfx_v10_0_print_state()
{
for (i = 0; i < ARRAY_SIZE(gc_reg_list_10_1); i += 2)

          drm_printf(&p, "0x%08x \t 0x%08x\n", adev->gfx.ip_state[i],

adev->gfx.ip_state[i+1]);
}

gfx_v10_0_sw_fini()
{
...
kfree(adev->gfx.ip_state);
...
}

Then call dumps_state() in gpu_recover() before we actually reset the GPU. The driver will then have the state cached and then you call print_state() in amdgpu_devcoredump_read() to read out the cached state.

Alex

Quoted 75 lines

Regards
Sunil

Alex

Regards

Sunil Khatri

Alex

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -1
+
  static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
         .name = "gfx_v10_0",
         .early_init = gfx_v10_0_early_init,
@@ -9170,7 +9295,7 @@ static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
         .set_clockgating_state = gfx_v10_0_set_clockgating_state,
         .set_powergating_state = gfx_v10_0_set_powergating_state,
         .get_clockgating_state = gfx_v10_0_get_clockgating_state,
-       .dump_ip_state = NULL,
+       .dump_ip_state = gfx_v10_ip_dump,
  };
 
  static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h +12 -1
index 4908044f7409..4c8e7fdb6976 100644
@@ -4830,6 +4830,8 @@
  #define mmCP_ECC_FIRSTOCCURRENCE_RING2_BASE_IDX                                                        0
  #define mmGB_EDC_MODE                                                                                  0x1e1e
  #define mmGB_EDC_MODE_BASE_IDX                                                                         0
+#define mmCP_DEBUG                                                                                     0x1e1f
+#define mmCP_DEBUG_BASE_IDX                                                                            0
  #define mmCP_FETCHER_SOURCE                                                                            0x1e22
  #define mmCP_FETCHER_SOURCE_BASE_IDX                                                                   0
  #define mmCP_PQ_WPTR_POLL_CNTL                                                                         0x1e23
@@ -7778,6 +7780,8 @@
  #define mmCP_MES_DOORBELL_CONTROL5_BASE_IDX                                                            1
  #define mmCP_MES_DOORBELL_CONTROL6                                                                     0x2841
  #define mmCP_MES_DOORBELL_CONTROL6_BASE_IDX                                                            1
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR                                                            0x2842
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR_BASE_IDX                                                   1
  #define mmCP_MES_GP0_LO                                                                                0x2843
  #define mmCP_MES_GP0_LO_BASE_IDX                                                                       1
  #define mmCP_MES_GP0_HI                                                                                0x2844
@@ -9332,10 +9336,16 @@
  #define mmRLC_LB_CNTR_INIT_1_BASE_IDX                                                                  1
  #define mmRLC_LB_CNTR_1                                                                                0x4c1c
  #define mmRLC_LB_CNTR_1_BASE_IDX                                                                       1
+#define mmRLC_GPM_DEBUG_INST_ADDR                                                                      0x4c1d
+#define mmRLC_GPM_DEBUG_INST_ADDR_BASE_IDX                                                             1
  #define mmRLC_JUMP_TABLE_RESTORE                                                                       0x4c1e
  #define mmRLC_JUMP_TABLE_RESTORE_BASE_IDX                                                              1
  #define mmRLC_PG_DELAY_2                                                                               0x4c1f
  #define mmRLC_PG_DELAY_2_BASE_IDX                                                                      1
+#define mmRLC_GPM_DEBUG_INST_A                                                                         0x4c22
+#define mmRLC_GPM_DEBUG_INST_A_BASE_IDX                                                                1
+#define mmRLC_GPM_DEBUG_INST_B                                                                         0x4c23
+#define mmRLC_GPM_DEBUG_INST_B_BASE_IDX                                                                1
  #define mmRLC_GPU_CLOCK_COUNT_LSB                                                                      0x4c24
  #define mmRLC_GPU_CLOCK_COUNT_LSB_BASE_IDX                                                             1
  #define mmRLC_GPU_CLOCK_COUNT_MSB                                                                      0x4c25
@@ -9720,6 +9730,8 @@
  #define mmRLC_SPM_THREAD_TRACE_CTRL_BASE_IDX                                                           1
  #define mmRLC_LB_CNTR_2                                                                                0x4de7
  #define mmRLC_LB_CNTR_2_BASE_IDX                                                                       1
+#define mmRLC_LX6_CORE_PDEBUG_INST                                                                     0x4deb
+#define mmRLC_LX6_CORE_PDEBUG_INST_BASE_IDX                                                            1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL                                                                  0x4df1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL_BASE_IDX                                                         1
  #define mmRLC_CPAXI_DOORBELL_MON_STAT                                                                  0x4df2
--

2.34.1

#9 lore raw

RE: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

[AMD Official Use Only - General]

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Saturday, April 13, 2024 1:56 AM
To: Khatri, Sunil <[email protected]>
Cc: Khatri, Sunil <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 328 lines · Sunil

On 4/12/2024 10:42 PM, Alex Deucher wrote:

On Fri, Apr 12, 2024 at 1:05 PM Khatri, Sunil <[email protected]> wrote:

On 4/12/2024 8:50 PM, Alex Deucher wrote:

On Fri, Apr 12, 2024 at 10:00 AM Sunil Khatri <[email protected]> wrote:

Adding initial set of registers for ipdump during devcoredump starting with gfx10 gc registers.

ip dump is triggered when gpu reset happens via devcoredump and the memory is allocated by each ip and is freed once the dump is complete by devcoredump.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  16 +++
  .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  |  22 +++

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Sure

  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 127 +++++++++++++++++-
  .../include/asic_reg/gc/gc_10_1_0_offset.h    |  12 ++
  4 files changed, 176 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +12 -0
index 65c17c59c152..e173ad86a241 100644
@@ -139,6 +139,18 @@ enum amdgpu_ss {
         AMDGPU_SS_DRV_UNLOAD
  };
 
+struct hwip_reg_entry {
+       u32     hwip;
+       u32     inst;
+       u32     seg;
+       u32     reg_offset;
+};
+
+struct reg_pair {
+       u32     offset;
+       u32     value;
+};
+
  struct amdgpu_watchdog_timer {
         bool timeout_fatal_disable;
         uint32_t period; /* maxCycles = (1 << period), the number of
cycles before a timeout */ @@ -1152,6 +1164,10 @@ struct amdgpu_device {
         bool                            debug_largebar;
         bool                            debug_disable_soft_recovery;
         bool                            debug_use_vram_fw_buf;
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
+
+       /* IP register dump */
+       struct reg_pair                 *ip_dump;
+       uint32_t                        num_regs;
  };
 
  static inline uint32_t amdgpu_ip_version(const struct amdgpu_device

*adev, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
index 1129e5e5fb42..2079f67c9fac 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +12 -0
@@ -261,6 +261,18 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
         drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
         drm_printf(&p, "Protection fault status register: 0x%x\n\n",
 fault_info->status);
 
+       /* Add IP dump for each ip */
+       if (coredump->adev->ip_dump != NULL) {
+               struct reg_pair *pair;
+
+               pair = (struct reg_pair *)coredump->adev->ip_dump;
+               drm_printf(&p, "IP register dump\n");
+               drm_printf(&p, "Offset \t Value\n");
+               for (int i = 0; i < coredump->adev->num_regs; i++)
+                       drm_printf(&p, "0x%04x \t 0x%08x\n", pair[i].offset, pair[i].value);
+               drm_printf(&p, "\n");
+       }
+
         /* Add ring buffer information */
         drm_printf(&p, "Ring buffer information\n");
         for (int i = 0; i < coredump->adev->num_rings; i++) { @@

-299,6 +311,11 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,

  static void amdgpu_devcoredump_free(void *data)
  {
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +11 -0
+       struct amdgpu_coredump_info *temp = data;
+
+       kfree(temp->adev->ip_dump);
+       temp->adev->ip_dump = NULL;
+       temp->adev->num_regs = 0;
         kfree(data);
  }
@@ -337,6 +354,11 @@ void amdgpu_coredump(struct amdgpu_device *adev,
 bool vram_lost,
 
         coredump->adev = adev;
 
+       /* Trigger ip dump here to capture the value of registers */
+       for (int i = 0; i < adev->num_ip_blocks; i++)
+               if (adev->ip_blocks[i].version->funcs->dump_ip_state)
+
+ adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev);
+
 

This seems too complicated. I think it would be easier to

This is how all other per IP functions are called. What do you suggest ?

         ktime_get_ts64(&coredump->reset_time);

         dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +92 -0
index a0bc4196ff8b..66e2915a8b4d 100644
@@ -276,6 +276,99 @@ MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
 
+static const struct hwip_reg_entry gc_reg_list_10_1[] = {
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS3) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_ERROR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_HPD_STATUS0) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPF_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPG_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_VM_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmPA_CL_CNTL_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRMI_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_DCACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_ICACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQG_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmTCP_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmWD_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_DEBUG) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC1_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC2_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_ME_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_PFP_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_COMMAND) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_MESSAGE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_1) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_3) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_4) },
+       { SOC15_REG_ENTRY(GC, 0, mmSMU_RLC_RESPONSE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_GPM_STAT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SPP_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_BOOTLOAD_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_INT_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_GENERAL_6) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_A) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_B) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_ADDR) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_LX6_CORE_PDEBUG_INST) } };
+
  static const struct soc15_reg_golden golden_settings_gc_10_1[] = {
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL,

0xfcff8fff, 0xf8000100), @@ -9154,6 +9247,38 @@ static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring)
amdgpu_ring_write(ring, gcr_cntl); /* GCR_CNTL */
}

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +26 -0
+static void gfx_v10_ip_dump(void *handle) {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
+       struct reg_pair *ptr, *gfx10_pair;
+       uint32_t new_count;
+
+       /*
+        * Allocate memory based on the no of registers for each block.
+        * Since adev->ip_dump is common pointer and we add more
+        * memory to it as we move through different IP's of the ASIC.
+        *
+        * This memory needs to be freed after gpu reset once the ip
+        * dump is done in the devcoredump.
+        */
+       new_count = adev->num_regs + reg_count;
+       ptr = krealloc_array(adev->ip_dump, new_count, sizeof(struct reg_pair), GFP_KERNEL);
+       if (ptr) {
+               adev->ip_dump = ptr;
+               gfx10_pair = &ptr[adev->num_regs];
+               adev->num_regs = new_count;
+       } else {
+               DRM_ERROR("Failed to allocate memory for IP Dump\n");
+               return;
+       }
+
+       for (uint32_t i = 0; i < reg_count; i++) {

Some compilers don't like variables defined within code.

Sure

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -0
+               gfx10_pair[i].offset = gc_reg_list_10_1[i].reg_offset;
+               gfx10_pair[i].value = RREG32(SOC15_REG_ENTRY_OFFSET(gc_reg_list_10_1[i]));
+       }
+}

This seems too complicated. Just pass drm_printer to the ip_dump callbacks and let each IP dump their state directly. E.g.,

        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (adev->ip_blocks[i].version->funcs->dump_ip_state) {
                        drm_printf(&p, "$s IP state\n",

adev->ip_blocks[i].version->funcs->name);

adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev, &p);
               }
        }

I did try this but there is a problem in that approach. drm_printer is created on the buffer which is provided by "amdgpu_devcoredump_read" and "amdgpu_devcoredump_read" is only called when the user opens the file

cat /sys/class/devcoredump/devcd1/data and by that time gpu is reset and registers dont hold the value of interest. I tried this approach first and got all FFFF or reset values of the registers.
We need to capture the values in "amdgpu_coredump" which is immediately called after GPU reset and values are what we need for debugging.

Crux is we need to capture data after gpu reset but read depends on when user open the file which is too late and hence we need to capture all the data in advance immediately after reset before recovery.

Ah, ok. I would suggest pre-allocating the memory to store the dump state in each IP block in sw_init(). I guess we'd probably need two IP callbacks, dump_state() and print_state(). Then call the ip->dump_state() in the GPU recovery sequence before we try soft resets, then in devcore dump you can call the ip->print_state() callback to print the state to the devcore dump output.

The problem is there is no standard size to proallocate memory statically. Each IP hold different set of registers and every time i add a new register set i have to update the memory size and allocate dynamically but this can be handled. Another problem i see with this approach is where to store the memory ptr of each IP. One way is to Directly have ptrs for each IP in amdgpu_device global struct or other way is to add ptr in IP specific struct withing amdgpu_device which are to be traversed in a hardcode way as they arent in an array or list.

For eg: we have to access each of these in a hardcode way in code as these structures arent in a list/array form to traverse for each ip.

/* nbio */

        struct amdgpu_nbio              nbio;
        /* hdp */
        struct amdgpu_hdp               hdp;
        /* smuio */
        struct amdgpu_smuio             smuio;
        /* mmhub */
        struct amdgpu_mmhub             mmhub;
        /* gfxhub */
        struct amdgpu_gfxhub            gfxhub;
        /* gfx */
        struct amdgpu_gfx               gfx;
        /* sdma */
        struct amdgpu_sdma              sdma;
        /* lsdma */
        struct amdgpu_lsdma             lsdma;
        /* uvd */
        struct amdgpu_uvd               uvd;
        /* vce */
        struct amdgpu_vce               vce;
Quoted 2 lines

In current code the approach is to add memory based on need for each IP in the same ptr and keep adding registers to it and we can search with offset value in the devcoredump to debug.

Each IP can store the data however they want. E.g., in the gfx code, we can do:

gfx_v10_0_sw_init()
{
...
adev->gfx.ip_state = kcalloc(2, gc_reg_list_10_1, GFP_KERNEL);
...
}

gfx_v10_0_dump_state()
{
for (i = 0; i < ARRAY_SIZE(gc_reg_list_10_1); i += 2)

    adev->gfx.ip_state[i] = gc_reg_list_10_1[i];
    adev->gfx.ip_state[i+1] = RREG32(gc_reg_list_10_1[i]); } }

gfx_v10_0_print_state()
{
for (i = 0; i < ARRAY_SIZE(gc_reg_list_10_1); i += 2)

          drm_printf(&p, "0x%08x \t 0x%08x\n", adev->gfx.ip_state[i],

adev->gfx.ip_state[i+1]);
}

gfx_v10_0_sw_fini()
{
...
kfree(adev->gfx.ip_state);
...
}

Then call dumps_state() in gpu_recover() before we actually reset the GPU. The driver will then have the state cached and then you call print_state() in amdgpu_devcoredump_read() to read out the cached state.

Sure Alex. Will update the patches as per this approach.

Regards
Sunil Khatri
Alex

Quoted 77 lines

Regards
Sunil

Alex

Regards

Sunil Khatri

Alex

+

  static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
         .name = "gfx_v10_0",
         .early_init = gfx_v10_0_early_init, @@ -9170,7 +9295,7 @@

static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
.set_clockgating_state = gfx_v10_0_set_clockgating_state, .set_powergating_state = gfx_v10_0_set_powergating_state, .get_clockgating_state = gfx_v10_0_get_clockgating_state,

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -1
-       .dump_ip_state = NULL,
+       .dump_ip_state = gfx_v10_ip_dump,
  };
 
  static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {

diff --git a/drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h b/drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h index 4908044f7409..4c8e7fdb6976 100644

drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h +12 -1
@@ -4830,6 +4830,8 @@
  #define mmCP_ECC_FIRSTOCCURRENCE_RING2_BASE_IDX                                                        0
  #define mmGB_EDC_MODE                                                                                  0x1e1e
  #define mmGB_EDC_MODE_BASE_IDX                                                                         0
+#define mmCP_DEBUG                                                                                     0x1e1f
+#define mmCP_DEBUG_BASE_IDX                                                                            0
  #define mmCP_FETCHER_SOURCE                                                                            0x1e22
  #define mmCP_FETCHER_SOURCE_BASE_IDX                                                                   0
  #define mmCP_PQ_WPTR_POLL_CNTL                                                                         0x1e23
@@ -7778,6 +7780,8 @@
  #define mmCP_MES_DOORBELL_CONTROL5_BASE_IDX                                                            1
  #define mmCP_MES_DOORBELL_CONTROL6                                                                     0x2841
  #define mmCP_MES_DOORBELL_CONTROL6_BASE_IDX                                                            1
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR                                                            0x2842
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR_BASE_IDX                                                   1
  #define mmCP_MES_GP0_LO                                                                                0x2843
  #define mmCP_MES_GP0_LO_BASE_IDX                                                                       1
  #define mmCP_MES_GP0_HI                                                                                0x2844
@@ -9332,10 +9336,16 @@
  #define mmRLC_LB_CNTR_INIT_1_BASE_IDX                                                                  1
  #define mmRLC_LB_CNTR_1                                                                                0x4c1c
  #define mmRLC_LB_CNTR_1_BASE_IDX                                                                       1
+#define mmRLC_GPM_DEBUG_INST_ADDR                                                                      0x4c1d
+#define mmRLC_GPM_DEBUG_INST_ADDR_BASE_IDX                                                             1
  #define mmRLC_JUMP_TABLE_RESTORE                                                                       0x4c1e
  #define mmRLC_JUMP_TABLE_RESTORE_BASE_IDX                                                              1
  #define mmRLC_PG_DELAY_2                                                                               0x4c1f
  #define mmRLC_PG_DELAY_2_BASE_IDX                                                                      1
+#define mmRLC_GPM_DEBUG_INST_A                                                                         0x4c22
+#define mmRLC_GPM_DEBUG_INST_A_BASE_IDX                                                                1
+#define mmRLC_GPM_DEBUG_INST_B                                                                         0x4c23
+#define mmRLC_GPM_DEBUG_INST_B_BASE_IDX                                                                1
  #define mmRLC_GPU_CLOCK_COUNT_LSB                                                                      0x4c24
  #define mmRLC_GPU_CLOCK_COUNT_LSB_BASE_IDX                                                             1
  #define mmRLC_GPU_CLOCK_COUNT_MSB                                                                      0x4c25
@@ -9720,6 +9730,8 @@
  #define mmRLC_SPM_THREAD_TRACE_CTRL_BASE_IDX                                                           1
  #define mmRLC_LB_CNTR_2                                                                                0x4de7
  #define mmRLC_LB_CNTR_2_BASE_IDX                                                                       1
+#define mmRLC_LX6_CORE_PDEBUG_INST                                                                     0x4deb
+#define mmRLC_LX6_CORE_PDEBUG_INST_BASE_IDX                                                            1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL                                                                  0x4df1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL_BASE_IDX                                                         1
  #define mmRLC_CPAXI_DOORBELL_MON_STAT                                                                  0x4df2
--

2.34.1

#10 lore raw

Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 227 lines · Sunil

[AMD Official Use Only - General]

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Saturday, April 13, 2024 1:56 AM
To: Khatri, Sunil <[email protected]>
Cc: Khatri, Sunil <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] drm/amdgpu: Add support of gfx10 register dump

Quoted 216 lines · Sunil

On 4/12/2024 10:42 PM, Alex Deucher wrote:

On Fri, Apr 12, 2024 at 1:05 PM Khatri, Sunil <[email protected]> wrote:

On 4/12/2024 8:50 PM, Alex Deucher wrote:

On Fri, Apr 12, 2024 at 10:00 AM Sunil Khatri <[email protected]> wrote:

Adding initial set of registers for ipdump during devcoredump starting with gfx10 gc registers.

ip dump is triggered when gpu reset happens via devcoredump and the memory is allocated by each ip and is freed once the dump is complete by devcoredump.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  16 +++
  .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  |  22 +++

I would split this into two patches, one to add the core infrastructure in devcoredump and one to add gfx10 support. The core support could be squashed into patch 1 as well.

Sure

  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c        | 127 +++++++++++++++++-
  .../include/asic_reg/gc/gc_10_1_0_offset.h    |  12 ++
  4 files changed, 176 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +12 -0
index 65c17c59c152..e173ad86a241 100644
@@ -139,6 +139,18 @@ enum amdgpu_ss {
         AMDGPU_SS_DRV_UNLOAD
  };
 
+struct hwip_reg_entry {
+       u32     hwip;
+       u32     inst;
+       u32     seg;
+       u32     reg_offset;
+};
+
+struct reg_pair {
+       u32     offset;
+       u32     value;
+};
+
  struct amdgpu_watchdog_timer {
         bool timeout_fatal_disable;
         uint32_t period; /* maxCycles = (1 << period), the number of
cycles before a timeout */ @@ -1152,6 +1164,10 @@ struct amdgpu_device {
         bool                            debug_largebar;
         bool                            debug_disable_soft_recovery;
         bool                            debug_use_vram_fw_buf;
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
+
+       /* IP register dump */
+       struct reg_pair                 *ip_dump;
+       uint32_t                        num_regs;
  };
 
  static inline uint32_t amdgpu_ip_version(const struct amdgpu_device

*adev, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
index 1129e5e5fb42..2079f67c9fac 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +12 -0
@@ -261,6 +261,18 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
         drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
         drm_printf(&p, "Protection fault status register: 0x%x\n\n",
 fault_info->status);
 
+       /* Add IP dump for each ip */
+       if (coredump->adev->ip_dump != NULL) {
+               struct reg_pair *pair;
+
+               pair = (struct reg_pair *)coredump->adev->ip_dump;
+               drm_printf(&p, "IP register dump\n");
+               drm_printf(&p, "Offset \t Value\n");
+               for (int i = 0; i < coredump->adev->num_regs; i++)
+                       drm_printf(&p, "0x%04x \t 0x%08x\n", pair[i].offset, pair[i].value);
+               drm_printf(&p, "\n");
+       }
+
         /* Add ring buffer information */
         drm_printf(&p, "Ring buffer information\n");
         for (int i = 0; i < coredump->adev->num_rings; i++) { @@

-299,6 +311,11 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,

  static void amdgpu_devcoredump_free(void *data)
  {
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +11 -0
+       struct amdgpu_coredump_info *temp = data;
+
+       kfree(temp->adev->ip_dump);
+       temp->adev->ip_dump = NULL;
+       temp->adev->num_regs = 0;
         kfree(data);
  }
@@ -337,6 +354,11 @@ void amdgpu_coredump(struct amdgpu_device *adev,
 bool vram_lost,
 
         coredump->adev = adev;
 
+       /* Trigger ip dump here to capture the value of registers */
+       for (int i = 0; i < adev->num_ip_blocks; i++)
+               if (adev->ip_blocks[i].version->funcs->dump_ip_state)
+
+ adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev);
+
 

This seems too complicated. I think it would be easier to

This is how all other per IP functions are called. What do you suggest ?

         ktime_get_ts64(&coredump->reset_time);

         dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +83 -0
index a0bc4196ff8b..66e2915a8b4d 100644
@@ -276,6 +276,99 @@ MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
  MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
 
+static const struct hwip_reg_entry gc_reg_list_10_1[] = {
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2) },
+       { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS3) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STALLED_STAT1) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT2) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_ERROR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_GFX_HPD_STATUS0) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB0_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_RPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB1_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_BASE) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_RB2_WPTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_CMD_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB1_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_LO) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BASE_HI) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_IB2_BUFSZ) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPF_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCPG_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmGDS_VM_PROTECTION_FAULT) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmIA_UTCL1_STATUS_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmPA_CL_CNTL_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRMI_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_DCACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQC_ICACHE_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmSQG_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmTCP_UTCL0_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmWD_UTCL1_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmGCVM_L2_PROTECTION_FAULT_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_DEBUG) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_CNTL) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CE_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC1_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MEC2_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_MES_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_ME_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_PFP_INSTR_PNTR) },
+       { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_COMMAND) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_MESSAGE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_1) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_2) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_3) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_ARGUMENT_4) },
+       { SOC15_REG_ENTRY(GC, 0, mmSMU_RLC_RESPONSE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SMU_SAFE_MODE) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_GPM_STAT_2) },
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin"); · line 369

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +8 -0
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_SPP_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_RLCS_BOOTLOAD_STATUS) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_INT_STAT) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_GENERAL_6) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_A) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_B) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_GPM_DEBUG_INST_ADDR) },
+       { SOC15_REG_ENTRY(GC, 0, mmRLC_LX6_CORE_PDEBUG_INST) } };

Might also be nice to store a string with the register name so we can print the names rather than the offsets in the devcoredump. Would be easier to read.

Alex

Quoted 222 lines
Quoted 104 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -0
+
  static const struct soc15_reg_golden golden_settings_gc_10_1[] = {
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
         SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL,

0xfcff8fff, 0xf8000100), @@ -9154,6 +9247,38 @@ static void gfx_v10_0_emit_mem_sync(struct amdgpu_ring *ring)
amdgpu_ring_write(ring, gcr_cntl); /* GCR_CNTL */
}

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +26 -0
+static void gfx_v10_ip_dump(void *handle) {
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
+       struct reg_pair *ptr, *gfx10_pair;
+       uint32_t new_count;
+
+       /*
+        * Allocate memory based on the no of registers for each block.
+        * Since adev->ip_dump is common pointer and we add more
+        * memory to it as we move through different IP's of the ASIC.
+        *
+        * This memory needs to be freed after gpu reset once the ip
+        * dump is done in the devcoredump.
+        */
+       new_count = adev->num_regs + reg_count;
+       ptr = krealloc_array(adev->ip_dump, new_count, sizeof(struct reg_pair), GFP_KERNEL);
+       if (ptr) {
+               adev->ip_dump = ptr;
+               gfx10_pair = &ptr[adev->num_regs];
+               adev->num_regs = new_count;
+       } else {
+               DRM_ERROR("Failed to allocate memory for IP Dump\n");
+               return;
+       }
+
+       for (uint32_t i = 0; i < reg_count; i++) {

Some compilers don't like variables defined within code.

Sure

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -0
+               gfx10_pair[i].offset = gc_reg_list_10_1[i].reg_offset;
+               gfx10_pair[i].value = RREG32(SOC15_REG_ENTRY_OFFSET(gc_reg_list_10_1[i]));
+       }
+}

This seems too complicated. Just pass drm_printer to the ip_dump callbacks and let each IP dump their state directly. E.g.,

        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (adev->ip_blocks[i].version->funcs->dump_ip_state) {
                        drm_printf(&p, "$s IP state\n",

adev->ip_blocks[i].version->funcs->name);

adev->ip_blocks[i].version->funcs->dump_ip_state((void *)adev, &p);
               }
        }

I did try this but there is a problem in that approach. drm_printer is created on the buffer which is provided by "amdgpu_devcoredump_read" and "amdgpu_devcoredump_read" is only called when the user opens the file

cat /sys/class/devcoredump/devcd1/data and by that time gpu is reset and registers dont hold the value of interest. I tried this approach first and got all FFFF or reset values of the registers.
We need to capture the values in "amdgpu_coredump" which is immediately called after GPU reset and values are what we need for debugging.

Crux is we need to capture data after gpu reset but read depends on when user open the file which is too late and hence we need to capture all the data in advance immediately after reset before recovery.

Ah, ok. I would suggest pre-allocating the memory to store the dump state in each IP block in sw_init(). I guess we'd probably need two IP callbacks, dump_state() and print_state(). Then call the ip->dump_state() in the GPU recovery sequence before we try soft resets, then in devcore dump you can call the ip->print_state() callback to print the state to the devcore dump output.

The problem is there is no standard size to proallocate memory statically. Each IP hold different set of registers and every time i add a new register set i have to update the memory size and allocate dynamically but this can be handled. Another problem i see with this approach is where to store the memory ptr of each IP. One way is to Directly have ptrs for each IP in amdgpu_device global struct or other way is to add ptr in IP specific struct withing amdgpu_device which are to be traversed in a hardcode way as they arent in an array or list.

For eg: we have to access each of these in a hardcode way in code as these structures arent in a list/array form to traverse for each ip.

/* nbio */

        struct amdgpu_nbio              nbio;
        /* hdp */
        struct amdgpu_hdp               hdp;
        /* smuio */
        struct amdgpu_smuio             smuio;
        /* mmhub */
        struct amdgpu_mmhub             mmhub;
        /* gfxhub */
        struct amdgpu_gfxhub            gfxhub;
        /* gfx */
        struct amdgpu_gfx               gfx;
        /* sdma */
        struct amdgpu_sdma              sdma;
        /* lsdma */
        struct amdgpu_lsdma             lsdma;
        /* uvd */
        struct amdgpu_uvd               uvd;
        /* vce */
        struct amdgpu_vce               vce;
Quoted 2 lines

In current code the approach is to add memory based on need for each IP in the same ptr and keep adding registers to it and we can search with offset value in the devcoredump to debug.

Each IP can store the data however they want. E.g., in the gfx code, we can do:

gfx_v10_0_sw_init()
{
...
adev->gfx.ip_state = kcalloc(2, gc_reg_list_10_1, GFP_KERNEL);
...
}

gfx_v10_0_dump_state()
{
for (i = 0; i < ARRAY_SIZE(gc_reg_list_10_1); i += 2)

    adev->gfx.ip_state[i] = gc_reg_list_10_1[i];
    adev->gfx.ip_state[i+1] = RREG32(gc_reg_list_10_1[i]); } }

gfx_v10_0_print_state()
{
for (i = 0; i < ARRAY_SIZE(gc_reg_list_10_1); i += 2)

          drm_printf(&p, "0x%08x \t 0x%08x\n", adev->gfx.ip_state[i],

adev->gfx.ip_state[i+1]);
}

gfx_v10_0_sw_fini()
{
...
kfree(adev->gfx.ip_state);
...
}

Then call dumps_state() in gpu_recover() before we actually reset the GPU. The driver will then have the state cached and then you call print_state() in amdgpu_devcoredump_read() to read out the cached state.

Sure Alex. Will update the patches as per this approach.

Regards
Sunil Khatri
Alex

Quoted 77 lines

Regards
Sunil

Alex

Regards

Sunil Khatri

Alex

+

  static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
         .name = "gfx_v10_0",
         .early_init = gfx_v10_0_early_init, @@ -9170,7 +9295,7 @@

static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
.set_clockgating_state = gfx_v10_0_set_clockgating_state, .set_powergating_state = gfx_v10_0_set_powergating_state, .get_clockgating_state = gfx_v10_0_get_clockgating_state,

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -1
-       .dump_ip_state = NULL,
+       .dump_ip_state = gfx_v10_ip_dump,
  };
 
  static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {

diff --git a/drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h b/drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h index 4908044f7409..4c8e7fdb6976 100644

drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_1_0_offset.h +12 -1
@@ -4830,6 +4830,8 @@
  #define mmCP_ECC_FIRSTOCCURRENCE_RING2_BASE_IDX                                                        0
  #define mmGB_EDC_MODE                                                                                  0x1e1e
  #define mmGB_EDC_MODE_BASE_IDX                                                                         0
+#define mmCP_DEBUG                                                                                     0x1e1f
+#define mmCP_DEBUG_BASE_IDX                                                                            0
  #define mmCP_FETCHER_SOURCE                                                                            0x1e22
  #define mmCP_FETCHER_SOURCE_BASE_IDX                                                                   0
  #define mmCP_PQ_WPTR_POLL_CNTL                                                                         0x1e23
@@ -7778,6 +7780,8 @@
  #define mmCP_MES_DOORBELL_CONTROL5_BASE_IDX                                                            1
  #define mmCP_MES_DOORBELL_CONTROL6                                                                     0x2841
  #define mmCP_MES_DOORBELL_CONTROL6_BASE_IDX                                                            1
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR                                                            0x2842
+#define mmCP_MES_DEBUG_INTERRUPT_INSTR_PNTR_BASE_IDX                                                   1
  #define mmCP_MES_GP0_LO                                                                                0x2843
  #define mmCP_MES_GP0_LO_BASE_IDX                                                                       1
  #define mmCP_MES_GP0_HI                                                                                0x2844
@@ -9332,10 +9336,16 @@
  #define mmRLC_LB_CNTR_INIT_1_BASE_IDX                                                                  1
  #define mmRLC_LB_CNTR_1                                                                                0x4c1c
  #define mmRLC_LB_CNTR_1_BASE_IDX                                                                       1
+#define mmRLC_GPM_DEBUG_INST_ADDR                                                                      0x4c1d
+#define mmRLC_GPM_DEBUG_INST_ADDR_BASE_IDX                                                             1
  #define mmRLC_JUMP_TABLE_RESTORE                                                                       0x4c1e
  #define mmRLC_JUMP_TABLE_RESTORE_BASE_IDX                                                              1
  #define mmRLC_PG_DELAY_2                                                                               0x4c1f
  #define mmRLC_PG_DELAY_2_BASE_IDX                                                                      1
+#define mmRLC_GPM_DEBUG_INST_A                                                                         0x4c22
+#define mmRLC_GPM_DEBUG_INST_A_BASE_IDX                                                                1
+#define mmRLC_GPM_DEBUG_INST_B                                                                         0x4c23
+#define mmRLC_GPM_DEBUG_INST_B_BASE_IDX                                                                1
  #define mmRLC_GPU_CLOCK_COUNT_LSB                                                                      0x4c24
  #define mmRLC_GPU_CLOCK_COUNT_LSB_BASE_IDX                                                             1
  #define mmRLC_GPU_CLOCK_COUNT_MSB                                                                      0x4c25
@@ -9720,6 +9730,8 @@
  #define mmRLC_SPM_THREAD_TRACE_CTRL_BASE_IDX                                                           1
  #define mmRLC_LB_CNTR_2                                                                                0x4de7
  #define mmRLC_LB_CNTR_2_BASE_IDX                                                                       1
+#define mmRLC_LX6_CORE_PDEBUG_INST                                                                     0x4deb
+#define mmRLC_LX6_CORE_PDEBUG_INST_BASE_IDX                                                            1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL                                                                  0x4df1
  #define mmRLC_CPAXI_DOORBELL_MON_CTRL_BASE_IDX                                                         1
  #define mmRLC_CPAXI_DOORBELL_MON_STAT                                                                  0x4df2
--

2.34.1