drm/amdgpu/gfx10: fix mqd backup/restore for gfx rings
Subsystems (2)
PATCH 1/1 drm/amdgpu/gfx10: fix mqd backup/restore for gfx rings
1. no need to allocate an extra member for 'mqd_backup' array
2. backup/restore mqd to/from the correct 'mqd_backup' array slot
Signed-off-by Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1 -1
@@ -225,7 +225,7 @@ struct amdgpu_me {uint32_t num_me;uint32_t num_pipe_per_me;uint32_t num_queue_per_pipe; -void *mqd_backup[AMDGPU_MAX_GFX_RINGS +1 ]; +void *mqd_backup[AMDGPU_MAX_GFX_RINGS ];/* These are the resources for which amdgpu takes ownership */ DECLARE_BITMAP (queue_bitmap,AMDGPU_MAX_GFX_QUEUES );
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -4
@@ -3075,6 +3075,7 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev;struct v10_gfx_mqd *mqd = ring->mqd_ptr; +int mqd_idx = ring - &adev->gfx.gfx_ring[0 ];if (!adev->in_gpu_reset && !adev->in_suspend) {memset ((void *)mqd,0 ,sizeof (*mqd));
@@ -3086,12 +3087,12 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)#endif nv_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex); -if (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ]) -memcpy (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ], mqd,sizeof (*mqd)); +if (adev->gfx.me.mqd_backup[mqd_idx]) +memcpy (adev->gfx.me.mqd_backup[mqd_idx], mqd,sizeof (*mqd)); }else if (adev->in_gpu_reset) {/* reset mqd with the backup copy */ -if (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ]) -memcpy (mqd, adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ],sizeof (*mqd)); +if (adev->gfx.me.mqd_backup[mqd_idx]) +memcpy (mqd, adev->gfx.me.mqd_backup[mqd_idx],sizeof (*mqd));/* reset the ring */ ring->wptr =0 ;amdgpu_ring_clear_ring (ring);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Alex Deucher
Acked-byQuoted 5 lines · Xiaojie
1. no need to allocate an extra member for '
mqd_backup' array
2. backup/restore mqd to/from the correct 'mqd_backup' array slotSigned-off-by Xiaojie Yuan <[email protected]>
Acked-by Alex Deucher <[email protected]>
Quoted 50 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1
-1@@ -225,7 +225,7 @@ struct amdgpu_me {uint32_t num_me;uint32_t num_pipe_per_me;uint32_t num_queue_per_pipe; -void *mqd_backup[AMDGPU_MAX_GFX_RINGS +1 ]; +void *mqd_backup[AMDGPU_MAX_GFX_RINGS ];/* These are the resources for which amdgpu takes ownership */ DECLARE_BITMAP (queue_bitmap,AMDGPU_MAX_GFX_QUEUES );drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5
-5@@ -3075,6 +3075,7 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev;struct v10_gfx_mqd *mqd = ring->mqd_ptr; +int mqd_idx = ring - &adev->gfx.gfx_ring[0 ];if (!adev->in_gpu_reset && !adev->in_suspend) {memset ((void *)mqd,0 ,sizeof (*mqd));@@ -3086,12 +3087,12 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)#endif nv_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex); -if (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ]) -memcpy (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ], mqd,sizeof (*mqd)); +if (adev->gfx.me.mqd_backup[mqd_idx]) +memcpy (adev->gfx.me.mqd_backup[mqd_idx], mqd,sizeof (*mqd)); }else if (adev->in_gpu_reset) {/* reset mqd with the backup copy */ -if (adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ]) -memcpy (mqd, adev->gfx.me.mqd_backup[AMDGPU_MAX_GFX_RINGS ],sizeof (*mqd)); +if (adev->gfx.me.mqd_backup[mqd_idx]) +memcpy (mqd, adev->gfx.me.mqd_backup[mqd_idx],sizeof (*mqd));/* reset the ring */ ring->wptr =0 ;amdgpu_ring_clear_ring (ring); --2.20.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx