[PATCH v1 2/2] drm/amdgpu: add print support for sdma_v_5_2 ip_dump

Alex Deucher alexdeucher at gmail.com
Fri Jul 12 13:49:41 UTC 2024


Series is:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

On Fri, Jul 12, 2024 at 8:23 AM Sunil Khatri <sunil.khatri at amd.com> wrote:
>
> Add support for ip dump for sdma_v_5_2 in devcoredump.
>
> Signed-off-by: Sunil Khatri <sunil.khatri at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> index 05a13086405b..dc1ca2205807 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
> @@ -1722,6 +1722,29 @@ static void sdma_v5_2_ring_end_use(struct amdgpu_ring *ring)
>         amdgpu_gfx_off_ctrl(adev, true);
>  }
>
> +static void sdma_v5_2_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_5_2);
> +       uint32_t instance_offset;
> +
> +       if (adev->sdma.ip_dump == NULL)
> +               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_5_2[j].reg_name,
> +                                  adev->sdma.ip_dump[instance_offset + j]);
> +       }
> +
> +
> +
> +}
>  static void sdma_v5_2_dump_ip_state(void *handle)
>  {
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> @@ -1760,6 +1783,7 @@ const struct amd_ip_funcs sdma_v5_2_ip_funcs = {
>         .set_powergating_state = sdma_v5_2_set_powergating_state,
>         .get_clockgating_state = sdma_v5_2_get_clockgating_state,
>         .dump_ip_state = sdma_v5_2_dump_ip_state,
> +       .print_ip_state = sdma_v5_2_print_ip_state,
>  };
>
>  static const struct amdgpu_ring_funcs sdma_v5_2_ring_funcs = {
> --
> 2.34.1
>


More information about the amd-gfx mailing list