summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-10-17 13:44:51 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-20 13:05:29 -0400
commitd7fe2fbacb06e95f921f27f99f457904a0c3a57a (patch)
tree4125b78771bfdb56b55b2681f10bfc4aff85dc47
parenta2c9c6ba0573bde2d4eada8a39d4e97f9749eef1 (diff)
gpu: nvgpu: Move sched to be Linux specific
Move sched parameter APIs to be Linux specific implementation. At the same time the sched_ctrl fields were moved to nvgpu_os_linux. JIRA NVGPU-259 Change-Id: I2397e2602e1c4783f2bebf3aec462634b7f86d4a Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1580649 GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/gpu/nvgpu/Makefile.nvgpu2
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_sched.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_tsg.c23
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_tsg.h2
-rw-r--r--drivers/gpu/nvgpu/common/linux/os_linux.h3
-rw-r--r--drivers/gpu/nvgpu/common/linux/sched.c (renamed from drivers/gpu/nvgpu/gk20a/sched_gk20a.c)63
-rw-r--r--drivers/gpu/nvgpu/common/linux/sched.h55
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h3
-rw-r--r--drivers/gpu/nvgpu/gk20a/regops_gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gk20a/sched_gk20a.h62
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c4
11 files changed, 112 insertions, 110 deletions
diff --git a/drivers/gpu/nvgpu/Makefile.nvgpu b/drivers/gpu/nvgpu/Makefile.nvgpu
index 81b0d1b8..ce4f67b0 100644
--- a/drivers/gpu/nvgpu/Makefile.nvgpu
+++ b/drivers/gpu/nvgpu/Makefile.nvgpu
@@ -53,6 +53,7 @@ nvgpu-y := \
53 common/linux/cde_gp10b.o \ 53 common/linux/cde_gp10b.o \
54 common/linux/comptags.o \ 54 common/linux/comptags.o \
55 common/linux/dmabuf.o \ 55 common/linux/dmabuf.o \
56 common/linux/sched.o \
56 common/mm/nvgpu_allocator.o \ 57 common/mm/nvgpu_allocator.o \
57 common/mm/bitmap_allocator.o \ 58 common/mm/bitmap_allocator.o \
58 common/mm/buddy_allocator.o \ 59 common/mm/buddy_allocator.o \
@@ -82,7 +83,6 @@ nvgpu-y := \
82 gk20a/gk20a.o \ 83 gk20a/gk20a.o \
83 gk20a/bus_gk20a.o \ 84 gk20a/bus_gk20a.o \
84 gk20a/pramin_gk20a.o \ 85 gk20a/pramin_gk20a.o \
85 gk20a/sched_gk20a.o \
86 gk20a/ce2_gk20a.o \ 86 gk20a/ce2_gk20a.o \
87 gk20a/fifo_gk20a.o \ 87 gk20a/fifo_gk20a.o \
88 gk20a/channel_gk20a.o \ 88 gk20a/channel_gk20a.o \
diff --git a/drivers/gpu/nvgpu/common/linux/debug_sched.c b/drivers/gpu/nvgpu/common/linux/debug_sched.c
index a42deb18..5b7cbddf 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_sched.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_sched.c
@@ -21,7 +21,8 @@
21static int gk20a_sched_debugfs_show(struct seq_file *s, void *unused) 21static int gk20a_sched_debugfs_show(struct seq_file *s, void *unused)
22{ 22{
23 struct gk20a *g = s->private; 23 struct gk20a *g = s->private;
24 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 24 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
25 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
25 bool sched_busy = true; 26 bool sched_busy = true;
26 27
27 int n = sched->bitmap_size / sizeof(u64); 28 int n = sched->bitmap_size / sizeof(u64);
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
index 6d0439f3..ce7fa6af 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
@@ -237,6 +237,8 @@ int nvgpu_ioctl_tsg_open(struct gk20a *g, struct file *filp)
237 priv->tsg = tsg; 237 priv->tsg = tsg;
238 filp->private_data = priv; 238 filp->private_data = priv;
239 239
240 gk20a_sched_ctrl_tsg_added(g, tsg);
241
240 return 0; 242 return 0;
241 243
242free_ref: 244free_ref:
@@ -257,12 +259,22 @@ int nvgpu_ioctl_tsg_dev_open(struct inode *inode, struct file *filp)
257 return ret; 259 return ret;
258} 260}
259 261
262void nvgpu_ioctl_tsg_release(struct nvgpu_ref *ref)
263{
264 struct tsg_gk20a *tsg = container_of(ref, struct tsg_gk20a, refcount);
265 struct gk20a *g = tsg->g;
266
267 gk20a_sched_ctrl_tsg_removed(g, tsg);
268
269 gk20a_tsg_release(ref);
270}
271
260int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp) 272int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp)
261{ 273{
262 struct tsg_private *priv = filp->private_data; 274 struct tsg_private *priv = filp->private_data;
263 struct tsg_gk20a *tsg = priv->tsg; 275 struct tsg_gk20a *tsg = priv->tsg;
264 276
265 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 277 nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release);
266 nvgpu_kfree(tsg->g, priv); 278 nvgpu_kfree(tsg->g, priv);
267 return 0; 279 return 0;
268} 280}
@@ -270,7 +282,8 @@ int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp)
270static int gk20a_tsg_ioctl_set_priority(struct gk20a *g, 282static int gk20a_tsg_ioctl_set_priority(struct gk20a *g,
271 struct tsg_gk20a *tsg, struct nvgpu_set_priority_args *arg) 283 struct tsg_gk20a *tsg, struct nvgpu_set_priority_args *arg)
272{ 284{
273 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 285 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
286 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
274 int err; 287 int err;
275 288
276 nvgpu_mutex_acquire(&sched->control_lock); 289 nvgpu_mutex_acquire(&sched->control_lock);
@@ -296,7 +309,8 @@ done:
296static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g, 309static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g,
297 struct tsg_gk20a *tsg, struct nvgpu_runlist_interleave_args *arg) 310 struct tsg_gk20a *tsg, struct nvgpu_runlist_interleave_args *arg)
298{ 311{
299 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 312 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
313 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
300 int err; 314 int err;
301 315
302 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); 316 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid);
@@ -323,7 +337,8 @@ done:
323static int gk20a_tsg_ioctl_set_timeslice(struct gk20a *g, 337static int gk20a_tsg_ioctl_set_timeslice(struct gk20a *g,
324 struct tsg_gk20a *tsg, struct nvgpu_timeslice_args *arg) 338 struct tsg_gk20a *tsg, struct nvgpu_timeslice_args *arg)
325{ 339{
326 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 340 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
341 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
327 int err; 342 int err;
328 343
329 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); 344 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid);
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.h b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.h
index 64d7a3da..67399fd4 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.h
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.h
@@ -16,11 +16,13 @@
16struct inode; 16struct inode;
17struct file; 17struct file;
18struct gk20a; 18struct gk20a;
19struct nvgpu_ref;
19 20
20int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp); 21int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp);
21int nvgpu_ioctl_tsg_dev_open(struct inode *inode, struct file *filp); 22int nvgpu_ioctl_tsg_dev_open(struct inode *inode, struct file *filp);
22int nvgpu_ioctl_tsg_open(struct gk20a *g, struct file *filp); 23int nvgpu_ioctl_tsg_open(struct gk20a *g, struct file *filp);
23long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, 24long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp,
24 unsigned int cmd, unsigned long arg); 25 unsigned int cmd, unsigned long arg);
26void nvgpu_ioctl_tsg_release(struct nvgpu_ref *ref);
25 27
26#endif 28#endif
diff --git a/drivers/gpu/nvgpu/common/linux/os_linux.h b/drivers/gpu/nvgpu/common/linux/os_linux.h
index 27433e32..9bb9e9f4 100644
--- a/drivers/gpu/nvgpu/common/linux/os_linux.h
+++ b/drivers/gpu/nvgpu/common/linux/os_linux.h
@@ -23,6 +23,7 @@
23#endif 23#endif
24#include "gk20a/gk20a.h" 24#include "gk20a/gk20a.h"
25#include "cde.h" 25#include "cde.h"
26#include "sched.h"
26 27
27struct nvgpu_os_linux_ops { 28struct nvgpu_os_linux_ops {
28 struct { 29 struct {
@@ -144,6 +145,8 @@ struct nvgpu_os_linux {
144 struct gk20a_cde_app cde_app; 145 struct gk20a_cde_app cde_app;
145 146
146 struct rw_semaphore busy_lock; 147 struct rw_semaphore busy_lock;
148
149 struct gk20a_sched_ctrl sched_ctrl;
147}; 150};
148 151
149static inline struct nvgpu_os_linux *nvgpu_os_linux_from_gk20a(struct gk20a *g) 152static inline struct nvgpu_os_linux *nvgpu_os_linux_from_gk20a(struct gk20a *g)
diff --git a/drivers/gpu/nvgpu/gk20a/sched_gk20a.c b/drivers/gpu/nvgpu/common/linux/sched.c
index a77536af..fc3f6ed8 100644
--- a/drivers/gpu/nvgpu/gk20a/sched_gk20a.c
+++ b/drivers/gpu/nvgpu/common/linux/sched.c
@@ -1,25 +1,18 @@
1/* 1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * This program is free software; you can redistribute it and/or modify it
5 * copy of this software and associated documentation files (the "Software"), 5 * under the terms and conditions of the GNU General Public License,
6 * to deal in the Software without restriction, including without limitation 6 * version 2, as published by the Free Software Foundation.
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 * 7 *
11 * The above copyright notice and this permission notice shall be included in 8 * This program is distributed in the hope it will be useful, but WITHOUT
12 * all copies or substantial portions of the Software. 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
13 * 12 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 * You should have received a copy of the GNU General Public License
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */ 15 */
22
23#include <asm/barrier.h> 16#include <asm/barrier.h>
24#include <linux/wait.h> 17#include <linux/wait.h>
25#include <linux/uaccess.h> 18#include <linux/uaccess.h>
@@ -30,11 +23,11 @@
30#include <nvgpu/log.h> 23#include <nvgpu/log.h>
31#include <nvgpu/bug.h> 24#include <nvgpu/bug.h>
32 25
33#include "ctxsw_trace_gk20a.h" 26#include "gk20a/gk20a.h"
34#include "gk20a.h" 27#include "gk20a/gr_gk20a.h"
35#include "gr_gk20a.h" 28#include "sched.h"
36#include "sched_gk20a.h" 29#include "os_linux.h"
37#include "common/linux/os_linux.h" 30#include "ioctl_tsg.h"
38 31
39#include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h> 32#include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h>
40#include <nvgpu/hw/gk20a/hw_gr_gk20a.h> 33#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
@@ -215,7 +208,7 @@ static int gk20a_sched_dev_ioctl_get_params(struct gk20a_sched_ctrl *sched,
215 arg->compute_preempt_mode = 0; 208 arg->compute_preempt_mode = 0;
216 } 209 }
217 210
218 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 211 nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release);
219 212
220 return 0; 213 return 0;
221} 214}
@@ -248,7 +241,7 @@ static int gk20a_sched_dev_ioctl_tsg_set_timeslice(
248 gk20a_idle(g); 241 gk20a_idle(g);
249 242
250done: 243done:
251 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 244 nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release);
252 245
253 return err; 246 return err;
254} 247}
@@ -281,7 +274,7 @@ static int gk20a_sched_dev_ioctl_tsg_set_runlist_interleave(
281 gk20a_idle(g); 274 gk20a_idle(g);
282 275
283done: 276done:
284 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 277 nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release);
285 278
286 return err; 279 return err;
287} 280}
@@ -335,9 +328,9 @@ static int gk20a_sched_dev_ioctl_get_tsg(struct gk20a_sched_ctrl *sched,
335 nvgpu_mutex_acquire(&sched->status_lock); 328 nvgpu_mutex_acquire(&sched->status_lock);
336 if (NVGPU_SCHED_ISSET(tsgid, sched->ref_tsg_bitmap)) { 329 if (NVGPU_SCHED_ISSET(tsgid, sched->ref_tsg_bitmap)) {
337 nvgpu_warn(g, "tsgid=%d already referenced", tsgid); 330 nvgpu_warn(g, "tsgid=%d already referenced", tsgid);
338 /* unlock status_lock as gk20a_tsg_release locks it */ 331 /* unlock status_lock as nvgpu_ioctl_tsg_release locks it */
339 nvgpu_mutex_release(&sched->status_lock); 332 nvgpu_mutex_release(&sched->status_lock);
340 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 333 nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release);
341 return -ENXIO; 334 return -ENXIO;
342 } 335 }
343 336
@@ -373,7 +366,7 @@ static int gk20a_sched_dev_ioctl_put_tsg(struct gk20a_sched_ctrl *sched,
373 nvgpu_mutex_release(&sched->status_lock); 366 nvgpu_mutex_release(&sched->status_lock);
374 367
375 tsg = &f->tsg[tsgid]; 368 tsg = &f->tsg[tsgid];
376 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 369 nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release);
377 370
378 return 0; 371 return 0;
379} 372}
@@ -389,7 +382,7 @@ int gk20a_sched_dev_open(struct inode *inode, struct file *filp)
389 g = gk20a_get(&l->g); 382 g = gk20a_get(&l->g);
390 if (!g) 383 if (!g)
391 return -ENODEV; 384 return -ENODEV;
392 sched = &g->sched_ctrl; 385 sched = &l->sched_ctrl;
393 386
394 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "g=%p", g); 387 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "g=%p", g);
395 388
@@ -516,7 +509,7 @@ int gk20a_sched_dev_release(struct inode *inode, struct file *filp)
516 for (tsgid = 0; tsgid < f->num_channels; tsgid++) { 509 for (tsgid = 0; tsgid < f->num_channels; tsgid++) {
517 if (NVGPU_SCHED_ISSET(tsgid, sched->ref_tsg_bitmap)) { 510 if (NVGPU_SCHED_ISSET(tsgid, sched->ref_tsg_bitmap)) {
518 tsg = &f->tsg[tsgid]; 511 tsg = &f->tsg[tsgid];
519 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); 512 nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release);
520 } 513 }
521 } 514 }
522 515
@@ -532,7 +525,8 @@ int gk20a_sched_dev_release(struct inode *inode, struct file *filp)
532 525
533void gk20a_sched_ctrl_tsg_added(struct gk20a *g, struct tsg_gk20a *tsg) 526void gk20a_sched_ctrl_tsg_added(struct gk20a *g, struct tsg_gk20a *tsg)
534{ 527{
535 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 528 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
529 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
536 int err; 530 int err;
537 531
538 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); 532 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid);
@@ -557,7 +551,8 @@ void gk20a_sched_ctrl_tsg_added(struct gk20a *g, struct tsg_gk20a *tsg)
557 551
558void gk20a_sched_ctrl_tsg_removed(struct gk20a *g, struct tsg_gk20a *tsg) 552void gk20a_sched_ctrl_tsg_removed(struct gk20a *g, struct tsg_gk20a *tsg)
559{ 553{
560 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 554 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
555 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
561 556
562 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); 557 gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid);
563 558
@@ -579,7 +574,8 @@ void gk20a_sched_ctrl_tsg_removed(struct gk20a *g, struct tsg_gk20a *tsg)
579 574
580int gk20a_sched_ctrl_init(struct gk20a *g) 575int gk20a_sched_ctrl_init(struct gk20a *g)
581{ 576{
582 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 577 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
578 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
583 struct fifo_gk20a *f = &g->fifo; 579 struct fifo_gk20a *f = &g->fifo;
584 int err; 580 int err;
585 581
@@ -643,7 +639,8 @@ free_active:
643 639
644void gk20a_sched_ctrl_cleanup(struct gk20a *g) 640void gk20a_sched_ctrl_cleanup(struct gk20a *g)
645{ 641{
646 struct gk20a_sched_ctrl *sched = &g->sched_ctrl; 642 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
643 struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
647 644
648 nvgpu_kfree(g, sched->active_tsg_bitmap); 645 nvgpu_kfree(g, sched->active_tsg_bitmap);
649 nvgpu_kfree(g, sched->recent_tsg_bitmap); 646 nvgpu_kfree(g, sched->recent_tsg_bitmap);
diff --git a/drivers/gpu/nvgpu/common/linux/sched.h b/drivers/gpu/nvgpu/common/linux/sched.h
new file mode 100644
index 00000000..a699bbea
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/linux/sched.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __NVGPU_SCHED_H
17#define __NVGPU_SCHED_H
18
19struct gk20a;
20struct gpu_ops;
21struct tsg_gk20a;
22struct poll_table_struct;
23
24struct gk20a_sched_ctrl {
25 struct gk20a *g;
26
27 struct nvgpu_mutex control_lock;
28 bool control_locked;
29 bool sw_ready;
30 struct nvgpu_mutex status_lock;
31 struct nvgpu_mutex busy_lock;
32
33 u64 status;
34
35 size_t bitmap_size;
36 u64 *active_tsg_bitmap;
37 u64 *recent_tsg_bitmap;
38 u64 *ref_tsg_bitmap;
39
40 struct nvgpu_cond readout_wq;
41};
42
43int gk20a_sched_dev_release(struct inode *inode, struct file *filp);
44int gk20a_sched_dev_open(struct inode *inode, struct file *filp);
45long gk20a_sched_dev_ioctl(struct file *, unsigned int, unsigned long);
46ssize_t gk20a_sched_dev_read(struct file *, char __user *, size_t, loff_t *);
47unsigned int gk20a_sched_dev_poll(struct file *, struct poll_table_struct *);
48
49void gk20a_sched_ctrl_tsg_added(struct gk20a *, struct tsg_gk20a *);
50void gk20a_sched_ctrl_tsg_removed(struct gk20a *, struct tsg_gk20a *);
51int gk20a_sched_ctrl_init(struct gk20a *);
52
53void gk20a_sched_ctrl_cleanup(struct gk20a *g);
54
55#endif /* __NVGPU_SCHED_H */
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index b55f4517..ba932df2 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -67,7 +67,6 @@ struct nvgpu_warpstate;
67#include "pmu_gk20a.h" 67#include "pmu_gk20a.h"
68#include "priv_ring_gk20a.h" 68#include "priv_ring_gk20a.h"
69#include "therm_gk20a.h" 69#include "therm_gk20a.h"
70#include "sched_gk20a.h"
71#ifdef CONFIG_ARCH_TEGRA_18x_SOC 70#ifdef CONFIG_ARCH_TEGRA_18x_SOC
72#include "clk/clk.h" 71#include "clk/clk.h"
73#include "clk/clk_arb.h" 72#include "clk/clk_arb.h"
@@ -1220,8 +1219,6 @@ struct gk20a {
1220 struct gk20a_ctxsw_trace *ctxsw_trace; 1219 struct gk20a_ctxsw_trace *ctxsw_trace;
1221 struct gk20a_fecs_trace *fecs_trace; 1220 struct gk20a_fecs_trace *fecs_trace;
1222 1221
1223 struct gk20a_sched_ctrl sched_ctrl;
1224
1225 bool mmu_debug_ctrl; 1222 bool mmu_debug_ctrl;
1226 1223
1227 u32 tpc_fs_mask_user; 1224 u32 tpc_fs_mask_user;
diff --git a/drivers/gpu/nvgpu/gk20a/regops_gk20a.h b/drivers/gpu/nvgpu/gk20a/regops_gk20a.h
index e2ef0e62..e0496a75 100644
--- a/drivers/gpu/nvgpu/gk20a/regops_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/regops_gk20a.h
@@ -24,8 +24,6 @@
24#ifndef REGOPS_GK20A_H 24#ifndef REGOPS_GK20A_H
25#define REGOPS_GK20A_H 25#define REGOPS_GK20A_H
26 26
27#include <uapi/linux/nvgpu.h>
28
29struct regop_offset_range { 27struct regop_offset_range {
30 u32 base:24; 28 u32 base:24;
31 u32 count:8; 29 u32 count:8;
diff --git a/drivers/gpu/nvgpu/gk20a/sched_gk20a.h b/drivers/gpu/nvgpu/gk20a/sched_gk20a.h
deleted file mode 100644
index 0cdb9914..00000000
--- a/drivers/gpu/nvgpu/gk20a/sched_gk20a.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __SCHED_GK20A_H
24#define __SCHED_GK20A_H
25
26struct gk20a;
27struct gpu_ops;
28struct tsg_gk20a;
29struct poll_table_struct;
30
31struct gk20a_sched_ctrl {
32 struct gk20a *g;
33
34 struct nvgpu_mutex control_lock;
35 bool control_locked;
36 bool sw_ready;
37 struct nvgpu_mutex status_lock;
38 struct nvgpu_mutex busy_lock;
39
40 u64 status;
41
42 size_t bitmap_size;
43 u64 *active_tsg_bitmap;
44 u64 *recent_tsg_bitmap;
45 u64 *ref_tsg_bitmap;
46
47 struct nvgpu_cond readout_wq;
48};
49
50int gk20a_sched_dev_release(struct inode *inode, struct file *filp);
51int gk20a_sched_dev_open(struct inode *inode, struct file *filp);
52long gk20a_sched_dev_ioctl(struct file *, unsigned int, unsigned long);
53ssize_t gk20a_sched_dev_read(struct file *, char __user *, size_t, loff_t *);
54unsigned int gk20a_sched_dev_poll(struct file *, struct poll_table_struct *);
55
56void gk20a_sched_ctrl_tsg_added(struct gk20a *, struct tsg_gk20a *);
57void gk20a_sched_ctrl_tsg_removed(struct gk20a *, struct tsg_gk20a *);
58int gk20a_sched_ctrl_init(struct gk20a *);
59
60void gk20a_sched_ctrl_cleanup(struct gk20a *g);
61
62#endif /* __SCHED_GK20A_H */
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index cde281ad..badc7ef9 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -325,8 +325,6 @@ struct tsg_gk20a *gk20a_tsg_open(struct gk20a *g)
325 325
326 gk20a_dbg(gpu_dbg_fn, "tsg opened %d\n", tsg->tsgid); 326 gk20a_dbg(gpu_dbg_fn, "tsg opened %d\n", tsg->tsgid);
327 327
328 gk20a_sched_ctrl_tsg_added(g, tsg);
329
330 return tsg; 328 return tsg;
331 329
332clean_up: 330clean_up:
@@ -353,8 +351,6 @@ void gk20a_tsg_release(struct nvgpu_ref *ref)
353 tsg->vm = NULL; 351 tsg->vm = NULL;
354 } 352 }
355 353
356 gk20a_sched_ctrl_tsg_removed(g, tsg);
357
358 /* unhook all events created on this TSG */ 354 /* unhook all events created on this TSG */
359 nvgpu_mutex_acquire(&tsg->event_id_list_lock); 355 nvgpu_mutex_acquire(&tsg->event_id_list_lock);
360 nvgpu_list_for_each_entry_safe(event_id_data, event_id_data_temp, 356 nvgpu_list_for_each_entry_safe(event_id_data, event_id_data_temp,