summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2014-09-10 10:23:31 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:19 -0400
commitad178917259b30330e8432e2cd33d50c03e9602b (patch)
tree194c769517bfa3707bd0fb8f0b89e5d00f4ea5f4 /drivers/gpu/nvgpu/gk20a/channel_gk20a.h
parent91ada92f61eeb41026a678b58863acafa7a33674 (diff)
gpu: nvgpu: implement poll() for semaphores
Add poll interface and control ioctls for waiting for GPU job completion via semaphores. Poll on a gk20a channel file waits for events from pending semaphore interrupts (stalling) of that channel. New ioctls enable and disable the events, and clear a single interrupt event so that next poll doesn't wake up for it again. Bug 1528781 Change-Id: I5c6238966b5d0900c8ab263c6a7f8f2611901f33 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/497750 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index 37ca8244..bb9f314c 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -26,6 +26,8 @@
26#include <linux/wait.h> 26#include <linux/wait.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/nvhost_ioctl.h> 28#include <linux/nvhost_ioctl.h>
29#include <linux/poll.h>
30
29struct gk20a; 31struct gk20a;
30struct gr_gk20a; 32struct gr_gk20a;
31struct dbg_session_gk20a; 33struct dbg_session_gk20a;
@@ -74,6 +76,12 @@ struct channel_gk20a_job {
74 struct list_head list; 76 struct list_head list;
75}; 77};
76 78
79struct channel_gk20a_poll_events {
80 struct mutex lock;
81 bool events_enabled;
82 int num_pending_events;
83};
84
77/* this is the priv element of struct nvhost_channel */ 85/* this is the priv element of struct nvhost_channel */
78struct channel_gk20a { 86struct channel_gk20a {
79 struct gk20a *g; 87 struct gk20a *g;
@@ -148,6 +156,9 @@ struct channel_gk20a {
148#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION 156#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
149 u64 virt_ctx; 157 u64 virt_ctx;
150#endif 158#endif
159
160 /* event support */
161 struct channel_gk20a_poll_events poll_events;
151}; 162};
152 163
153static inline bool gk20a_channel_as_bound(struct channel_gk20a *ch) 164static inline bool gk20a_channel_as_bound(struct channel_gk20a *ch)
@@ -180,6 +191,8 @@ long gk20a_channel_ioctl(struct file *filp,
180int gk20a_channel_release(struct inode *inode, struct file *filp); 191int gk20a_channel_release(struct inode *inode, struct file *filp);
181struct channel_gk20a *gk20a_get_channel_from_file(int fd); 192struct channel_gk20a *gk20a_get_channel_from_file(int fd);
182void gk20a_channel_update(struct channel_gk20a *c, int nr_completed); 193void gk20a_channel_update(struct channel_gk20a *c, int nr_completed);
194unsigned int gk20a_channel_poll(struct file *filep, poll_table *wait);
195void gk20a_channel_event(struct channel_gk20a *ch);
183 196
184void gk20a_init_channel(struct gpu_ops *gops); 197void gk20a_init_channel(struct gpu_ops *gops);
185 198