[PATCH 2/2] drm/amdgpu: export test ring debugfs interface
Deucher, Alexander
Alexander.Deucher at amd.com
Thu May 11 02:38:16 UTC 2017
> -----Original Message-----
> From: Huang Rui [mailto:ray.huang at amd.com]
> Sent: Wednesday, May 10, 2017 10:29 PM
> To: amd-gfx at lists.freedesktop.org; Deucher, Alexander; Koenig, Christian
> Cc: Zhou, David(ChunMing); Wang, Ken; Huan, Alvin; Huang, Ray
> Subject: [PATCH 2/2] drm/amdgpu: export test ring debugfs interface
>
> Signed-off-by: Huang Rui <ray.huang at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 44
> ++++++++++++++++++++++++++++--
> 1 file changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 7becf11..3637396 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3625,14 +3625,54 @@ static int amdgpu_debugfs_test_ib(struct
> seq_file *m, void *data)
> return 0;
> }
>
> +static int amdgpu_ring_tests(struct amdgpu_device *adev)
> +{
> + unsigned i;
> + int r = 0;
> +
> + for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
> + struct amdgpu_ring *ring = adev->rings[i];
> +
> + if (!ring || !ring->ready)
> + continue;
> +
> + r = amdgpu_ring_test_ring(ring);
> + if (r) {
> + ring->ready = false;
> + DRM_ERROR("amdgpu: failed to test ring %d
> (%d).\n",
> + i, r);
> + }
> + }
> +
> + return r;
> +}
> +
> +static int amdgpu_debugfs_test_ring(struct seq_file *m, void *data)
> +{
> + struct drm_info_node *node = (struct drm_info_node *) m-
> >private;
> + struct drm_device *dev = node->minor->dev;
> + struct amdgpu_device *adev = dev->dev_private;
> + int r = 0;
> +
> + seq_printf(m, "run ring test:\n");
> + r = amdgpu_ring_tests(adev);
> + if (r)
> + seq_printf(m, "ring tests failed (%d).\n", r);
> + else
> + seq_printf(m, "ring tests passed.\n");
> +
> + return 0;
> +}
> +
> static const struct drm_info_list amdgpu_debugfs_test_ib_ring_list[] = {
> - {"amdgpu_test_ib", &amdgpu_debugfs_test_ib}
> + {"amdgpu_test_ib", &amdgpu_debugfs_test_ib},
> + {"amdgpu_test_ring", &amdgpu_debugfs_test_ring}
> };
>
> static int amdgpu_debugfs_test_ib_ring_init(struct amdgpu_device *adev)
> {
> return amdgpu_debugfs_add_files(adev,
> - amdgpu_debugfs_test_ib_ring_list,
> 1);
> + amdgpu_debugfs_test_ib_ring_list,
> 2);
> }
>
> int amdgpu_debugfs_init(struct drm_minor *minor)
> --
> 2.7.4
More information about the amd-gfx
mailing list