diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-12-15 13:25:22 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-12-28 13:01:32 -0500 |
commit | f19f22fcc8ef21b363b873c499cbd2e690af29f8 (patch) | |
tree | 02d6b8280af305d0339ed860e331ab091d4b49d2 /drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | |
parent | aa52601f620423fdd98b79e2c2c5e1d767a5f685 (diff) |
gpu: nvgpu: Remove support for channel events
Remove support for events for bare channels. All users have already
moved to TSGs and TSG events.
Bug 1842197
Change-Id: Ib3ff68134ad9515ee761d0f0e19a3150a0b744ab
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1618906
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/ioctl_tsg.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | 77 |
1 files changed, 76 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index b17d7e74..445199c2 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/file.h> | 18 | #include <linux/file.h> |
19 | #include <linux/cdev.h> | 19 | #include <linux/cdev.h> |
20 | #include <linux/uaccess.h> | 20 | #include <linux/uaccess.h> |
21 | #include <linux/poll.h> | ||
21 | #include <uapi/linux/nvgpu.h> | 22 | #include <uapi/linux/nvgpu.h> |
22 | #include <linux/anon_inodes.h> | 23 | #include <linux/anon_inodes.h> |
23 | 24 | ||
@@ -79,6 +80,30 @@ static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg, | |||
79 | } | 80 | } |
80 | } | 81 | } |
81 | 82 | ||
83 | /* | ||
84 | * Convert common event_id of the form NVGPU_EVENT_ID_* to Linux specific | ||
85 | * event_id of the form NVGPU_IOCTL_CHANNEL_EVENT_ID_* which is used in IOCTLs | ||
86 | */ | ||
87 | static u32 nvgpu_event_id_to_ioctl_channel_event_id(u32 event_id) | ||
88 | { | ||
89 | switch (event_id) { | ||
90 | case NVGPU_EVENT_ID_BPT_INT: | ||
91 | return NVGPU_IOCTL_CHANNEL_EVENT_ID_BPT_INT; | ||
92 | case NVGPU_EVENT_ID_BPT_PAUSE: | ||
93 | return NVGPU_IOCTL_CHANNEL_EVENT_ID_BPT_PAUSE; | ||
94 | case NVGPU_EVENT_ID_BLOCKING_SYNC: | ||
95 | return NVGPU_IOCTL_CHANNEL_EVENT_ID_BLOCKING_SYNC; | ||
96 | case NVGPU_EVENT_ID_CILP_PREEMPTION_STARTED: | ||
97 | return NVGPU_IOCTL_CHANNEL_EVENT_ID_CILP_PREEMPTION_STARTED; | ||
98 | case NVGPU_EVENT_ID_CILP_PREEMPTION_COMPLETE: | ||
99 | return NVGPU_IOCTL_CHANNEL_EVENT_ID_CILP_PREEMPTION_COMPLETE; | ||
100 | case NVGPU_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN: | ||
101 | return NVGPU_IOCTL_CHANNEL_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN; | ||
102 | } | ||
103 | |||
104 | return NVGPU_IOCTL_CHANNEL_EVENT_ID_MAX; | ||
105 | } | ||
106 | |||
82 | void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg, | 107 | void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg, |
83 | int __event_id) | 108 | int __event_id) |
84 | { | 109 | { |
@@ -107,6 +132,57 @@ void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg, | |||
107 | nvgpu_mutex_release(&event_id_data->lock); | 132 | nvgpu_mutex_release(&event_id_data->lock); |
108 | } | 133 | } |
109 | 134 | ||
135 | static unsigned int gk20a_event_id_poll(struct file *filep, poll_table *wait) | ||
136 | { | ||
137 | unsigned int mask = 0; | ||
138 | struct gk20a_event_id_data *event_id_data = filep->private_data; | ||
139 | struct gk20a *g = event_id_data->g; | ||
140 | u32 event_id = event_id_data->event_id; | ||
141 | struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id; | ||
142 | |||
143 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_info, ""); | ||
144 | |||
145 | poll_wait(filep, &event_id_data->event_id_wq.wq, wait); | ||
146 | |||
147 | nvgpu_mutex_acquire(&event_id_data->lock); | ||
148 | |||
149 | if (event_id_data->event_posted) { | ||
150 | gk20a_dbg_info( | ||
151 | "found pending event_id=%d on TSG=%d\n", | ||
152 | event_id, tsg->tsgid); | ||
153 | mask = (POLLPRI | POLLIN); | ||
154 | event_id_data->event_posted = false; | ||
155 | } | ||
156 | |||
157 | nvgpu_mutex_release(&event_id_data->lock); | ||
158 | |||
159 | return mask; | ||
160 | } | ||
161 | |||
162 | static int gk20a_event_id_release(struct inode *inode, struct file *filp) | ||
163 | { | ||
164 | struct gk20a_event_id_data *event_id_data = filp->private_data; | ||
165 | struct gk20a *g = event_id_data->g; | ||
166 | struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id; | ||
167 | |||
168 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); | ||
169 | nvgpu_list_del(&event_id_data->event_id_node); | ||
170 | nvgpu_mutex_release(&tsg->event_id_list_lock); | ||
171 | |||
172 | nvgpu_mutex_destroy(&event_id_data->lock); | ||
173 | gk20a_put(g); | ||
174 | nvgpu_kfree(g, event_id_data); | ||
175 | filp->private_data = NULL; | ||
176 | |||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | const struct file_operations gk20a_event_id_ops = { | ||
181 | .owner = THIS_MODULE, | ||
182 | .poll = gk20a_event_id_poll, | ||
183 | .release = gk20a_event_id_release, | ||
184 | }; | ||
185 | |||
110 | static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | 186 | static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, |
111 | int event_id, | 187 | int event_id, |
112 | int *fd) | 188 | int *fd) |
@@ -152,7 +228,6 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | |||
152 | } | 228 | } |
153 | event_id_data->g = g; | 229 | event_id_data->g = g; |
154 | event_id_data->id = tsg->tsgid; | 230 | event_id_data->id = tsg->tsgid; |
155 | event_id_data->is_tsg = true; | ||
156 | event_id_data->event_id = event_id; | 231 | event_id_data->event_id = event_id; |
157 | 232 | ||
158 | nvgpu_cond_init(&event_id_data->event_id_wq); | 233 | nvgpu_cond_init(&event_id_data->event_id_wq); |