From 86943d3d03953cc88b3e8a85aa232493b729137a Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Mon, 12 Mar 2018 10:37:38 +0200 Subject: gpu: nvgpu: decouple sema and hw sema struct nvgpu_semaphore represents (mainly) a threshold value that a sema at some index will get and struct nvgpu_semaphore_int (aka "hw_sema") represents the allocation (and write access) of a semaphore index and the next value that the sema at that index can have. The threshold object doesn't need a pointer to the sema allocation that is not even guaranteed to exist for the whole threshold lifetime, so replace the pointer by the position of the sema in the sema pool. This requires some modifications to pass a hw sema around explicitly because it now represents write access more explicitly. Delete also the index field of semaphore_int because it can be directly derived from the offset in the sema location and is thus unnecessary. Jira NVGPU-512 Change-Id: I40be523fd68327e2f9928f10de4f771fe24d49ee Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1658102 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 5cd7223f..fb7406da 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -215,7 +215,8 @@ void gk20a_channel_abort_clean_up(struct channel_gk20a *ch) job = &ch->joblist.pre_alloc.jobs[tmp_get]; if (job->post_fence->semaphore) { __nvgpu_semaphore_release( - job->post_fence->semaphore, true); + job->post_fence->semaphore, true, + ch->hw_sema); released_job_semaphore = true; } tmp_get = (tmp_get + 1) % ch->joblist.pre_alloc.length; @@ -226,7 +227,8 @@ void gk20a_channel_abort_clean_up(struct channel_gk20a *ch) channel_gk20a_job, list) { if (job->post_fence->semaphore) { __nvgpu_semaphore_release( - job->post_fence->semaphore, true); + job->post_fence->semaphore, true, + ch->hw_sema); released_job_semaphore = true; } } -- cgit v1.2.2