From e87ba53235151cccee181489ceb5e35b131e7d2d Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 31 Mar 2016 12:33:19 +0530 Subject: gpu: nvgpu: add channel event id support With NVGPU_IOCTL_CHANNEL_EVENTS_CTRL, nvgpu can raise events to User space. But user space cannot distinguish between various types of events. To overcome this, we need finer-grained API to deliver various events to user space. Remove old API NVGPU_IOCTL_CHANNEL_EVENTS_CTRL, and all the support for this API (we can remove this since User space has not started using this API at all) Add new API NVGPU_IOCTL_CHANNEL_EVENT_ID_CTRL which will accept an event_id (like BPT.INT or BPT.PAUSE), a command to enable the event, and return a file descriptor on which we can raise the event (if cmd=enable) Event is disabled when file descriptor is closed Add file operations "gk20a_event_id_ops" to support polling on event fd Also add API gk20a_channel_get_event_data_from_id() to get event_data of event from its id Bug 200089620 Change-Id: I5288f19f38ff49448c46338c33b2a927c9e02254 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1030775 (cherry picked from commit 5721ce2735950440bedc2b86f851db08ed593275) Reviewed-on: http://git-master/r/1120318 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bharat Nihalani --- drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index e3fbba3e..cbe0fd59 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h @@ -74,10 +74,16 @@ struct channel_gk20a_timeout { struct channel_gk20a_job *job; }; -struct channel_gk20a_poll_events { +struct gk20a_event_id_data { + struct gk20a *g; + + int id; /* ch or tsg */ + bool is_tsg; + u32 event_id; + + wait_queue_head_t event_id_wq; struct mutex lock; - bool events_enabled; - int num_pending_events; + struct list_head event_id_node; }; struct channel_gk20a_clean_up { @@ -163,6 +169,9 @@ struct channel_gk20a { struct mutex dbg_s_lock; struct list_head dbg_s_list; + struct list_head event_id_list; + struct mutex event_id_list_lock; + bool has_timedout; u32 timeout_ms_max; bool timeout_debug_dump; @@ -178,9 +187,6 @@ struct channel_gk20a { u64 virt_ctx; #endif - /* event support */ - struct channel_gk20a_poll_events poll_events; - /* signal channel owner via a callback, if set, in gk20a_channel_update * via schedule_work */ void (*update_fn)(struct channel_gk20a *, void *); @@ -227,9 +233,6 @@ long gk20a_channel_ioctl(struct file *filp, int gk20a_channel_release(struct inode *inode, struct file *filp); struct channel_gk20a *gk20a_get_channel_from_file(int fd); void gk20a_channel_update(struct channel_gk20a *c, int nr_completed); -unsigned int gk20a_channel_poll(struct file *filep, poll_table *wait); -void gk20a_channel_event(struct channel_gk20a *ch); -void gk20a_channel_post_event(struct channel_gk20a *ch); void gk20a_init_channel(struct gpu_ops *gops); -- cgit v1.2.2