aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>2017-05-15 15:09:15 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-06-09 11:29:46 -0400
commita6583af4ae1c4afa755d8d4a4e7768dd36176395 (patch)
tree823acf78c3721a78a31972ba8f02472f1e67171c /drivers/gpu
parent9a4b7d4c769e7513dec8f441de1f521ec4ead4b6 (diff)
drm/amdgpu: Add amdgpu_sync_wait
v2: Add intr option 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@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c19
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
index ed814e6d0207..a6899180b265 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
@@ -298,6 +298,25 @@ struct dma_fence *amdgpu_sync_get_fence(struct amdgpu_sync *sync)
298 return NULL; 298 return NULL;
299} 299}
300 300
301int amdgpu_sync_wait(struct amdgpu_sync *sync, bool intr)
302{
303 struct amdgpu_sync_entry *e;
304 struct hlist_node *tmp;
305 int i, r;
306
307 hash_for_each_safe(sync->fences, i, tmp, e, node) {
308 r = dma_fence_wait(e->fence, intr);
309 if (r)
310 return r;
311
312 hash_del(&e->node);
313 dma_fence_put(e->fence);
314 kmem_cache_free(amdgpu_sync_slab, e);
315 }
316
317 return 0;
318}
319
301/** 320/**
302 * amdgpu_sync_free - free the sync object 321 * amdgpu_sync_free - free the sync object
303 * 322 *
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h
index 605be266e07f..dc7687993317 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,
49struct dma_fence *amdgpu_sync_peek_fence(struct amdgpu_sync *sync, 49struct dma_fence *amdgpu_sync_peek_fence(struct amdgpu_sync *sync,
50 struct amdgpu_ring *ring); 50 struct amdgpu_ring *ring);
51struct dma_fence *amdgpu_sync_get_fence(struct amdgpu_sync *sync); 51struct dma_fence *amdgpu_sync_get_fence(struct amdgpu_sync *sync);
52int amdgpu_sync_wait(struct amdgpu_sync *sync, bool intr);
52void amdgpu_sync_free(struct amdgpu_sync *sync); 53void amdgpu_sync_free(struct amdgpu_sync *sync);
53int amdgpu_sync_init(void); 54int amdgpu_sync_init(void);
54void amdgpu_sync_fini(void); 55void amdgpu_sync_fini(void);