gpu: nvgpu: create a wrapper over sync_fences

This patch constructs an abstraction to hide the sync_fence
functionality from the common code. struct nvgpu_os_fence acts as an
abstraction for struct sync_fence.

struct nvgpu_os_fence consists of an ops structure named nvgpu_os_fence_ops
which contains an API to do pushbuffer programming to generate wait
commands for the fence.

The current implementation of nvgpu only allows for wait method on a
sync_fence which was generated using a similar backend(i.e. either
Nvhost Syncpoints or Semaphores). In this patch, a
generic API is introduced which will decide the type of the underlying
implementation of the struct nvgpu_os_fence at runtime and run the
corresponding wait implementation on it.

This patch changes the channel_sync_gk20a's semaphore specific
implementation to use the abstract API. A subsequent patch will make
the changes for the nvhost_syncpoint based implementations as well.

JIRA NVGPU-66

Change-Id: If6675bfde5885c3d15d2ca380bb6c7c0e240e734
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1667218
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Debarshi Dutta
2018-04-18 11:03:02 +05:30
committed by mobile promotions
parent 90b2f780d4
commit 4dfd6e43cf
7 changed files with 379 additions and 78 deletions

View File

@@ -32,6 +32,7 @@ struct priv_cmd_entry;
struct channel_gk20a;
struct gk20a_fence;
struct gk20a;
struct nvgpu_semaphore;
struct gk20a_channel_sync {
nvgpu_atomic_t refcount;
@@ -103,6 +104,10 @@ struct gk20a_channel_sync {
void (*destroy)(struct gk20a_channel_sync *s);
};
void gk20a_channel_gen_sema_wait_cmd(struct channel_gk20a *c,
struct nvgpu_semaphore *sema, struct priv_cmd_entry *wait_cmd,
u32 wait_cmd_size, int pos);
void gk20a_channel_sync_destroy(struct gk20a_channel_sync *sync,
bool set_safe_state);
struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c,