Add CP_STAT to the GC IP dump, for which CP blocks are busy when the
hang is detected.

How far the CP has fetched into an IB is already in the dump, as
CP_IB1_CMD_BUFSZ minus CP_IB1_BUFSZ (and the same for IB2), but the per
gfx queue lists on gfx11 and gfx12 only have the IB1 state. Add the IB2
base and sizes there too, so the fetch point can be found for IB2 as
well. GC 12.1 has no gfx queues, so it only gets CP_STAT.

CP_IB1_OFFSET and CP_IB2_OFFSET are not added: on gfx1151 they read 0
even when the CP is part way through the IB, so they are not the fetch
point.

Suggested-by: Gregoire Pean <[email protected]>
Signed-off-by: Matt Turner <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 5 +++++
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 5 +++++
 drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 1 +
 4 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index b28dd5eaf1bb..61accb360589 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -320,6 +320,7 @@ static const struct amdgpu_hwip_reg_entry 
gc_reg_list_10_1[] = {
        SOC15_REG_ENTRY_STR(GC, 0, mmCP_IB2_BASE_LO),
        SOC15_REG_ENTRY_STR(GC, 0, mmCP_IB2_BASE_HI),
        SOC15_REG_ENTRY_STR(GC, 0, mmCP_IB2_BUFSZ),
+       SOC15_REG_ENTRY_STR(GC, 0, mmCP_STAT),
        SOC15_REG_ENTRY_STR(GC, 0, mmCPF_UTCL1_STATUS),
        SOC15_REG_ENTRY_STR(GC, 0, mmCPC_UTCL1_STATUS),
        SOC15_REG_ENTRY_STR(GC, 0, mmCPG_UTCL1_STATUS),
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 570f0f3a2ea5..76b80f243dd2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -192,6 +192,7 @@ static const struct amdgpu_hwip_reg_entry 
gc_reg_list_11_0[] = {
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_LO),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_HI),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BUFSZ),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_STAT),
        SOC15_REG_ENTRY_STR(GC, 0, regCPF_UTCL1_STATUS),
        SOC15_REG_ENTRY_STR(GC, 0, regCPC_UTCL1_STATUS),
        SOC15_REG_ENTRY_STR(GC, 0, regCPG_UTCL1_STATUS),
@@ -313,6 +314,10 @@ static const struct amdgpu_hwip_reg_entry 
gc_gfx_queue_reg_list_11[] = {
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB1_BASE_HI),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB1_CMD_BUFSZ),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB1_BUFSZ),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_LO),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_HI),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_CMD_BUFSZ),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BUFSZ),
        /* cp header registers */
        SOC15_REG_ENTRY_STR(GC, 0, regCP_PFP_HEADER_DUMP),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_PFP_HEADER_DUMP),
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index 09a27c3f6921..b31b1778b918 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -113,6 +113,7 @@ static const struct amdgpu_hwip_reg_entry 
gc_reg_list_12_0[] = {
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_LO),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_HI),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BUFSZ),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_STAT),
        SOC15_REG_ENTRY_STR(GC, 0, regCPF_UTCL1_STATUS),
        SOC15_REG_ENTRY_STR(GC, 0, regCPC_UTCL1_STATUS),
        SOC15_REG_ENTRY_STR(GC, 0, regCPG_UTCL1_STATUS),
@@ -231,6 +232,10 @@ static const struct amdgpu_hwip_reg_entry 
gc_gfx_queue_reg_list_12[] = {
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB1_BASE_HI),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB1_CMD_BUFSZ),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB1_BUFSZ),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_LO),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_HI),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_CMD_BUFSZ),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BUFSZ),
        /* cp header registers */
        SOC15_REG_ENTRY_STR(GC, 0, regCP_PFP_HEADER_DUMP),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_PFP_HEADER_DUMP),
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
index c5d9d0dea4da..284258e56de4 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
@@ -104,6 +104,7 @@ static const struct amdgpu_hwip_reg_entry 
gc_reg_list_12_1[] = {
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_LO),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BASE_HI),
        SOC15_REG_ENTRY_STR(GC, 0, regCP_IB2_BUFSZ),
+       SOC15_REG_ENTRY_STR(GC, 0, regCP_STAT),
        SOC15_REG_ENTRY_STR(GC, 0, regCPF_UTCL1_STATUS),
        SOC15_REG_ENTRY_STR(GC, 0, regCPC_UTCL1_STATUS),
        SOC15_REG_ENTRY_STR(GC, 0, regCPG_UTCL1_STATUS),

-- 
2.56.1

Reply via email to