drm/amdgpu: add print support for sdma_v_7_0 ip_dump
authorSunil Khatri <sunil.khatri@amd.com>
Wed, 17 Jul 2024 06:33:33 +0000 (12:03 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 23 Jul 2024 21:33:45 +0000 (17:33 -0400)
Add print support for ip dump for sdma_v_7_0 in
devcoredump.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c

index 327b5387949ab2c80c3da7da338f6c4d5158198c..62ef4a737a56e3e8fb04b45d1b513ca5776aec41 100644 (file)
@@ -1535,6 +1535,27 @@ static void sdma_v7_0_get_clockgating_state(void *handle, u64 *flags)
 {
 }
 
+static void sdma_v7_0_print_ip_state(void *handle, struct drm_printer *p)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       int i, j;
+       uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_7_0);
+       uint32_t instance_offset;
+
+       if (!adev->sdma.ip_dump)
+               return;
+
+       drm_printf(p, "num_instances:%d\n", adev->sdma.num_instances);
+       for (i = 0; i < adev->sdma.num_instances; i++) {
+               instance_offset = i * reg_count;
+               drm_printf(p, "\nInstance:%d\n", i);
+
+               for (j = 0; j < reg_count; j++)
+                       drm_printf(p, "%-50s \t 0x%08x\n", sdma_reg_list_7_0[j].reg_name,
+                                  adev->sdma.ip_dump[instance_offset + j]);
+       }
+}
+
 static void sdma_v7_0_dump_ip_state(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1574,6 +1595,7 @@ const struct amd_ip_funcs sdma_v7_0_ip_funcs = {
        .set_powergating_state = sdma_v7_0_set_powergating_state,
        .get_clockgating_state = sdma_v7_0_get_clockgating_state,
        .dump_ip_state = sdma_v7_0_dump_ip_state,
+       .print_ip_state = sdma_v7_0_print_ip_state,
 };
 
 static const struct amdgpu_ring_funcs sdma_v7_0_ring_funcs = {