summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h
new file mode 100644
index 00000000..5e2b9b82
--- /dev/null
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h
@@ -0,0 +1,91 @@
1/*
2 * Copyright (c) 2014-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#ifndef __TSG_GK20A_H_
23#define __TSG_GK20A_H_
24
25#include <nvgpu/lock.h>
26#include <nvgpu/kref.h>
27#include <nvgpu/rwsem.h>
28
29#ifdef CONFIG_TEGRA_19x_GPU
30#include "tsg_t19x.h"
31#endif
32#define NVGPU_INVALID_TSG_ID (-1)
33
34struct channel_gk20a;
35
36bool gk20a_is_channel_marked_as_tsg(struct channel_gk20a *ch);
37struct tsg_gk20a *gk20a_tsg_open(struct gk20a *g);
38void gk20a_tsg_release(struct nvgpu_ref *ref);
39
40int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid);
41struct tsg_gk20a *tsg_gk20a_from_ch(struct channel_gk20a *ch);
42
43struct tsg_gk20a {
44 struct gk20a *g;
45
46 bool in_use;
47 int tsgid;
48
49 struct nvgpu_ref refcount;
50
51 struct nvgpu_list_node ch_list;
52 int num_active_channels;
53 struct nvgpu_rwsem ch_list_lock;
54
55 unsigned int timeslice_us;
56 unsigned int timeslice_timeout;
57 unsigned int timeslice_scale;
58
59 struct gr_ctx_desc *tsg_gr_ctx;
60
61 struct vm_gk20a *vm;
62
63 u32 interleave_level;
64
65 struct nvgpu_list_node event_id_list;
66 struct nvgpu_mutex event_id_list_lock;
67
68 u32 runlist_id;
69 pid_t tgid;
70 struct nvgpu_mem *eng_method_buffers;
71#ifdef CONFIG_TEGRA_19x_GPU
72 struct tsg_t19x t19x;
73#endif
74};
75
76int gk20a_enable_tsg(struct tsg_gk20a *tsg);
77int gk20a_disable_tsg(struct tsg_gk20a *tsg);
78int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg,
79 struct channel_gk20a *ch);
80int gk20a_tsg_unbind_channel(struct channel_gk20a *ch);
81
82void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg,
83 int event_id);
84int gk20a_tsg_set_runlist_interleave(struct tsg_gk20a *tsg, u32 level);
85int gk20a_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice);
86u32 gk20a_tsg_get_timeslice(struct tsg_gk20a *tsg);
87int gk20a_tsg_set_priority(struct gk20a *g, struct tsg_gk20a *tsg,
88 u32 priority);
89
90
91#endif /* __TSG_GK20A_H_ */