From ba2e59dc41f593bb011e0ec58c969337a35f4cf1 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Wed, 22 Nov 2017 15:57:11 +0200 Subject: gpu: nvgpu: use submit callback only in linux code Move the implementation for channel job update callbacks that is based on Linux specific work_struct usage to Linux-specific code. This requires a bit of extra work for allocating OS-specific priv data for channels which is also done in this patch. The priv data will be used more when more OS-specific features are moved. Jira NVGPU-259 Change-Id: I24bc0148a827f375b56a1c96044685affc2d1e8c Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1589321 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/channel.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'drivers/gpu/nvgpu/common/linux/channel.h') diff --git a/drivers/gpu/nvgpu/common/linux/channel.h b/drivers/gpu/nvgpu/common/linux/channel.h index 785c03d6..ba1935f3 100644 --- a/drivers/gpu/nvgpu/common/linux/channel.h +++ b/drivers/gpu/nvgpu/common/linux/channel.h @@ -16,6 +16,8 @@ #ifndef __NVGPU_CHANNEL_H__ #define __NVGPU_CHANNEL_H__ +#include + #include struct channel_gk20a; @@ -24,6 +26,36 @@ struct nvgpu_submit_gpfifo_args; struct nvgpu_fence; struct gk20a_fence; struct fifo_profile_gk20a; +struct nvgpu_os_linux; + +struct nvgpu_channel_completion_cb { + /* + * Signal channel owner via a callback, if set, in job cleanup with + * schedule_work. Means that something finished on the channel (perhaps + * more than one job). + */ + void (*fn)(struct channel_gk20a *, void *); + void *user_data; + /* Make access to the two above atomic */ + struct nvgpu_spinlock lock; + /* Per-channel async work task, cannot reschedule itself */ + struct work_struct work; +}; + +struct nvgpu_channel_linux { + struct channel_gk20a *ch; + + struct nvgpu_channel_completion_cb completion_cb; +}; + +int nvgpu_init_channel_support_linux(struct nvgpu_os_linux *l); +void nvgpu_remove_channel_support_linux(struct nvgpu_os_linux *l); + +struct channel_gk20a *gk20a_open_new_channel_with_cb(struct gk20a *g, + void (*update_fn)(struct channel_gk20a *, void *), + void *update_fn_data, + int runlist_id, + bool is_privileged_channel); int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, struct nvgpu_gpfifo *gpfifo, -- cgit v1.2.2