summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2016-06-07 12:20:57 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2016-06-10 11:14:49 -0400
commit2bc8f4e36df6b0329417d1af20f1f14f43db62a8 (patch)
tree8cd571c7f5b5f808c2d5c897de05cc70b785d258 /drivers/gpu
parent9b1bb51cf004833817ac85d145f2bd1b4c103f57 (diff)
gpu: nvgpu: fix event id polling
In gk20a_event_id_poll(), we always set the mask value and return it. This causes poll() from UMD to be always successful irrespective of event is really generated or not Fix this by adding a flag event_posted for each event Set this flag while posting the event In gk20a_event_id_poll(), set the mask value only if this flag is set. If flag is set, set mask and clear the flag Bug 200089620 Change-Id: If14236547c611fe4bfa1410ff5b69c9fa02d43bb Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1160253 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c22
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c1
3 files changed, 18 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index a5243834..02ec5835 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -2519,18 +2519,25 @@ static unsigned int gk20a_event_id_poll(struct file *filep, poll_table *wait)
2519 if (event_id_data->is_tsg) { 2519 if (event_id_data->is_tsg) {
2520 struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id; 2520 struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id;
2521 2521
2522 gk20a_dbg_info( 2522 if (event_id_data->event_posted) {
2523 "found pending event_id=%d on TSG=%d\n", 2523 gk20a_dbg_info(
2524 event_id, tsg->tsgid); 2524 "found pending event_id=%d on TSG=%d\n",
2525 event_id, tsg->tsgid);
2526 mask = (POLLPRI | POLLIN);
2527 event_id_data->event_posted = false;
2528 }
2525 } else { 2529 } else {
2526 struct channel_gk20a *ch = g->fifo.channel 2530 struct channel_gk20a *ch = g->fifo.channel
2527 + event_id_data->id; 2531 + event_id_data->id;
2528 2532
2529 gk20a_dbg_info( 2533 if (event_id_data->event_posted) {
2530 "found pending event_id=%d on chid=%d\n", 2534 gk20a_dbg_info(
2531 event_id, ch->hw_chid); 2535 "found pending event_id=%d on chid=%d\n",
2536 event_id, ch->hw_chid);
2537 mask = (POLLPRI | POLLIN);
2538 event_id_data->event_posted = false;
2539 }
2532 } 2540 }
2533 mask = (POLLPRI | POLLIN);
2534 2541
2535 mutex_unlock(&event_id_data->lock); 2542 mutex_unlock(&event_id_data->lock);
2536 2543
@@ -2609,6 +2616,7 @@ void gk20a_channel_event_id_post_event(struct channel_gk20a *ch,
2609 gk20a_dbg_info( 2616 gk20a_dbg_info(
2610 "posting event for event_id=%d on ch=%d\n", 2617 "posting event for event_id=%d on ch=%d\n",
2611 event_id, ch->hw_chid); 2618 event_id, ch->hw_chid);
2619 event_id_data->event_posted = true;
2612 2620
2613 wake_up_interruptible_all(&event_id_data->event_id_wq); 2621 wake_up_interruptible_all(&event_id_data->event_id_wq);
2614 2622
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index 29a13d24..4e0db3cf 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -84,6 +84,8 @@ struct gk20a_event_id_data {
84 bool is_tsg; 84 bool is_tsg;
85 u32 event_id; 85 u32 event_id;
86 86
87 bool event_posted;
88
87 wait_queue_head_t event_id_wq; 89 wait_queue_head_t event_id_wq;
88 struct mutex lock; 90 struct mutex lock;
89 struct list_head event_id_node; 91 struct list_head event_id_node;
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index 5298d380..f7d5535d 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -231,6 +231,7 @@ void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg,
231 gk20a_dbg_info( 231 gk20a_dbg_info(
232 "posting event for event_id=%d on tsg=%d\n", 232 "posting event for event_id=%d on tsg=%d\n",
233 event_id, tsg->tsgid); 233 event_id, tsg->tsgid);
234 event_id_data->event_posted = true;
234 235
235 wake_up_interruptible_all(&event_id_data->event_id_wq); 236 wake_up_interruptible_all(&event_id_data->event_id_wq);
236 237