[RFC PATCH 1/2] drm/amdgpu: Introduce ring lock

Christian König christian.koenig at amd.com
Mon Sep 13 06:25:17 UTC 2021


NAK, that is exactly what we try to avoid here.

Christian.

Am 13.09.21 um 07:55 schrieb xinhui pan:
> This is used for direct IB submission to ring.
>
> Signed-off-by: xinhui pan <xinhui.pan at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 +
>   2 files changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index ab2351ba9574..f97a28a49120 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -184,6 +184,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
>   	else if (ring == &adev->sdma.instance[0].page)
>   		sched_hw_submission = 256;
>   
> +	mutex_init(&ring->lock);
> +
>   	if (ring->adev == NULL) {
>   		if (adev->num_rings >= AMDGPU_MAX_RINGS)
>   			return -EINVAL;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> index 4d380e79752c..544766429b5c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> @@ -215,6 +215,7 @@ struct amdgpu_ring {
>   	struct amdgpu_fence_driver	fence_drv;
>   	struct drm_gpu_scheduler	sched;
>   
> +	struct mutex		lock;
>   	struct amdgpu_bo	*ring_obj;
>   	volatile uint32_t	*ring;
>   	unsigned		rptr_offs;



More information about the amd-gfx mailing list