[PATCH 01/11] drm/amdgpu: hw ring should be empty when gpu reset
Edward O'Callaghan
funfunctor at folklore1984.net
Sat Jul 30 03:53:01 UTC 2016
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>
On 07/28/2016 08:13 PM, Chunming Zhou wrote:
> Change-Id: I08ca5a805f590cc7aad0e9ccd91bd5925bb216e2
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 11 +++++++++++
> 3 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 43beefb..ebd5565 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1247,6 +1247,7 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev);
> int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned ndw);
> void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count);
> void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib);
> +void amdgpu_ring_reset(struct amdgpu_ring *ring);
> void amdgpu_ring_commit(struct amdgpu_ring *ring);
> void amdgpu_ring_undo(struct amdgpu_ring *ring);
> int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 7e63ef9..1968251 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2102,6 +2102,7 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
> continue;
> kthread_park(ring->sched.thread);
> amd_sched_hw_job_reset(&ring->sched);
> + amdgpu_ring_reset(ring);
> }
> /* after all hw jobs are reset, hw fence is meaningless, so force_completion */
> amdgpu_fence_driver_force_completion(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index 9989e25..75e1da6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -110,6 +110,17 @@ void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib)
> ib->ptr[ib->length_dw++] = ring->nop;
> }
>
> +void amdgpu_ring_reset(struct amdgpu_ring *ring)
> +{
> + u32 rptr = amdgpu_ring_get_rptr(ring);
> +
> + ring->wptr = rptr;
> + ring->wptr &= ring->ptr_mask;
> +
> + mb();
> + amdgpu_ring_set_wptr(ring);
> +}
> +
> /**
> * amdgpu_ring_commit - tell the GPU to execute the new
> * commands on the ring buffer
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160730/4c9977ad/attachment-0001.sig>
More information about the amd-gfx
mailing list