[PATCH 3/5] drm/amdgpu: Add amdgpu_sync_wait
Christian König
deathsimple at vodafone.de
Tue May 16 12:49:37 UTC 2017
Am 15.05.2017 um 23:32 schrieb Harish Kasiviswanathan:
> Helper function useful for CPU update of VM page tables. Also useful if
> kernel have to synchronously wait till VM page tables are updated.
>
> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 19 +++++++++++++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h | 1 +
> 2 files changed, 20 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
> index 5c8d302..e5b202e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
> @@ -296,6 +296,25 @@ struct fence *amdgpu_sync_get_fence(struct amdgpu_sync *sync)
> return NULL;
> }
>
> +int amdgpu_sync_wait(struct amdgpu_sync *sync)
> +{
> + struct amdgpu_sync_entry *e;
> + struct hlist_node *tmp;
> + int i, r;
> +
> + hash_for_each_safe(sync->fences, i, tmp, e, node) {
> + r = fence_wait(e->fence, false);
Depending on how you gonna use this you might want to wait interruptible
here.
Apart from that the patch is Reviewed-by: Christian König
<christian.koenig at amd.com>.
Regards,
Christian.
> + if (r)
> + return r;
> +
> + hash_del(&e->node);
> + fence_put(e->fence);
> + kmem_cache_free(amdgpu_sync_slab, e);
> + }
> +
> + return 0;
> +}
> +
> /**
> * amdgpu_sync_free - free the sync object
> *
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h
> index 405f379..6c9c489 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h
> @@ -49,6 +49,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
> struct fence *amdgpu_sync_peek_fence(struct amdgpu_sync *sync,
> struct amdgpu_ring *ring);
> struct fence *amdgpu_sync_get_fence(struct amdgpu_sync *sync);
> +int amdgpu_sync_wait(struct amdgpu_sync *sync);
> void amdgpu_sync_free(struct amdgpu_sync *sync);
> int amdgpu_sync_init(void);
> void amdgpu_sync_fini(void);
More information about the amd-gfx
mailing list