From 5f10073540acba056ccf905010dd400d8f32ca31 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 21 Mar 2016 19:58:28 +0530 Subject: gpu: nvgpu: add TSG support to channel event id Add NVGPU_IOCTL_TSG_EVENT_ID_CTRL API for channel event id support to TSGs This API 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) Events generated for TSGs will reuse file operations "gk20a_event_id_ops" Bug 200089620 Change-Id: I2f563c6d3a0988eb670caac2d3c7c6795724792c Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1030776 (cherry picked from commit 72b61fa266279038f013e582be80c21808e1038d) Reviewed-on: http://git-master/r/1120319 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 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 be9c7cd4..4ad9d85b 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -2506,7 +2506,13 @@ unsigned int gk20a_event_id_poll(struct file *filep, poll_table *wait) mutex_lock(&event_id_data->lock); - if (!event_id_data->is_tsg) { + if (event_id_data->is_tsg) { + struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id; + + gk20a_dbg_info( + "found pending event_id=%d on TSG=%d\n", + event_id, tsg->tsgid); + } else { struct channel_gk20a *ch = g->fifo.channel + event_id_data->id; @@ -2526,7 +2532,13 @@ int gk20a_event_id_release(struct inode *inode, struct file *filp) struct gk20a_event_id_data *event_id_data = filp->private_data; struct gk20a *g = event_id_data->g; - if (!event_id_data->is_tsg) { + if (event_id_data->is_tsg) { + struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id; + + mutex_lock(&tsg->event_id_list_lock); + list_del_init(&event_id_data->event_id_node); + mutex_unlock(&tsg->event_id_list_lock); + } else { struct channel_gk20a *ch = g->fifo.channel + event_id_data->id; mutex_lock(&ch->event_id_list_lock); @@ -2540,7 +2552,7 @@ int gk20a_event_id_release(struct inode *inode, struct file *filp) return 0; } -static const struct file_operations gk20a_event_id_ops = { +const struct file_operations gk20a_event_id_ops = { .owner = THIS_MODULE, .poll = gk20a_event_id_poll, .release = gk20a_event_id_release, -- cgit v1.2.2