aboutsummaryrefslogtreecommitdiffstats
path: root/include/nvgpu/gk20a.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/nvgpu/gk20a.h')
-rw-r--r--include/nvgpu/gk20a.h1803
1 files changed, 1803 insertions, 0 deletions
diff --git a/include/nvgpu/gk20a.h b/include/nvgpu/gk20a.h
new file mode 100644
index 0000000..aa95969
--- /dev/null
+++ b/include/nvgpu/gk20a.h
@@ -0,0 +1,1803 @@
1/*
2 * Copyright (c) 2011-2020, NVIDIA CORPORATION. All rights reserved.
3 *
4 * GK20A Graphics
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24#ifndef GK20A_H
25#define GK20A_H
26
27struct gk20a;
28struct fifo_gk20a;
29struct channel_gk20a;
30struct gr_gk20a;
31struct sim_nvgpu;
32struct gk20a_ctxsw_ucode_segments;
33struct gk20a_fecs_trace;
34struct gk20a_ctxsw_trace;
35struct acr_desc;
36struct nvgpu_mem_alloc_tracker;
37struct dbg_profiler_object_data;
38struct gk20a_debug_output;
39struct nvgpu_clk_pll_debug_data;
40struct nvgpu_nvhost_dev;
41struct nvgpu_cpu_time_correlation_sample;
42struct nvgpu_mem_sgt;
43struct nvgpu_warpstate;
44struct nvgpu_clk_session;
45struct nvgpu_clk_arb;
46#ifdef CONFIG_GK20A_CTXSW_TRACE
47struct nvgpu_gpu_ctxsw_trace_filter;
48#endif
49struct priv_cmd_entry;
50struct nvgpu_setup_bind_args;
51
52#ifdef __KERNEL__
53#include <linux/notifier.h>
54#endif
55#include <nvgpu/lock.h>
56#include <nvgpu/thread.h>
57
58#include <nvgpu/mm.h>
59#include <nvgpu/as.h>
60#include <nvgpu/log.h>
61#include <nvgpu/pramin.h>
62#include <nvgpu/acr/nvgpu_acr.h>
63#include <nvgpu/kref.h>
64#include <nvgpu/falcon.h>
65#include <nvgpu/pmu.h>
66#include <nvgpu/atomic.h>
67#include <nvgpu/barrier.h>
68#include <nvgpu/rwsem.h>
69#include <nvgpu/nvlink.h>
70#include <nvgpu/sim.h>
71#include <nvgpu/ecc.h>
72#include <nvgpu/tsg.h>
73#include <nvgpu/sec2.h>
74#include <nvgpu/sched.h>
75
76#include "gk20a/clk_gk20a.h"
77#include "gk20a/ce2_gk20a.h"
78#include "gk20a/fifo_gk20a.h"
79#include "clk/clk.h"
80#include "pmu_perf/pmu_perf.h"
81#include "pmgr/pmgr.h"
82#include "therm/thrm.h"
83
84#ifdef CONFIG_DEBUG_FS
85struct railgate_stats {
86 unsigned long last_rail_gate_start;
87 unsigned long last_rail_gate_complete;
88 unsigned long last_rail_ungate_start;
89 unsigned long last_rail_ungate_complete;
90 unsigned long total_rail_gate_time_ms;
91 unsigned long total_rail_ungate_time_ms;
92 unsigned long railgating_cycle_count;
93};
94#endif
95
96enum gk20a_cbc_op {
97 gk20a_cbc_op_clear,
98 gk20a_cbc_op_clean,
99 gk20a_cbc_op_invalidate,
100};
101
102#define MC_INTR_UNIT_DISABLE false
103#define MC_INTR_UNIT_ENABLE true
104
105#define GPU_LIT_NUM_GPCS 0
106#define GPU_LIT_NUM_PES_PER_GPC 1
107#define GPU_LIT_NUM_ZCULL_BANKS 2
108#define GPU_LIT_NUM_TPC_PER_GPC 3
109#define GPU_LIT_NUM_SM_PER_TPC 4
110#define GPU_LIT_NUM_FBPS 5
111#define GPU_LIT_GPC_BASE 6
112#define GPU_LIT_GPC_STRIDE 7
113#define GPU_LIT_GPC_SHARED_BASE 8
114#define GPU_LIT_TPC_IN_GPC_BASE 9
115#define GPU_LIT_TPC_IN_GPC_STRIDE 10
116#define GPU_LIT_TPC_IN_GPC_SHARED_BASE 11
117#define GPU_LIT_PPC_IN_GPC_BASE 12
118#define GPU_LIT_PPC_IN_GPC_STRIDE 13
119#define GPU_LIT_PPC_IN_GPC_SHARED_BASE 14
120#define GPU_LIT_ROP_BASE 15
121#define GPU_LIT_ROP_STRIDE 16
122#define GPU_LIT_ROP_SHARED_BASE 17
123#define GPU_LIT_HOST_NUM_ENGINES 18
124#define GPU_LIT_HOST_NUM_PBDMA 19
125#define GPU_LIT_LTC_STRIDE 20
126#define GPU_LIT_LTS_STRIDE 21
127#define GPU_LIT_NUM_FBPAS 22
128#define GPU_LIT_FBPA_STRIDE 23
129#define GPU_LIT_FBPA_BASE 24
130#define GPU_LIT_FBPA_SHARED_BASE 25
131#define GPU_LIT_SM_PRI_STRIDE 26
132#define GPU_LIT_SMPC_PRI_BASE 27
133#define GPU_LIT_SMPC_PRI_SHARED_BASE 28
134#define GPU_LIT_SMPC_PRI_UNIQUE_BASE 29
135#define GPU_LIT_SMPC_PRI_STRIDE 30
136#define GPU_LIT_TWOD_CLASS 31
137#define GPU_LIT_THREED_CLASS 32
138#define GPU_LIT_COMPUTE_CLASS 33
139#define GPU_LIT_GPFIFO_CLASS 34
140#define GPU_LIT_I2M_CLASS 35
141#define GPU_LIT_DMA_COPY_CLASS 36
142#define GPU_LIT_GPC_PRIV_STRIDE 37
143#define GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START 38
144#define GPU_LIT_PERFMON_PMMGPCTPCB_DOMAIN_START 39
145#define GPU_LIT_PERFMON_PMMGPCTPC_DOMAIN_COUNT 40
146#define GPU_LIT_PERFMON_PMMFBP_LTC_DOMAIN_START 41
147#define GPU_LIT_PERFMON_PMMFBP_LTC_DOMAIN_COUNT 42
148#define GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_START 43
149#define GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT 44
150
151#define nvgpu_get_litter_value(g, v) (g)->ops.get_litter_value((g), v)
152
153#define MAX_TPC_PG_CONFIGS 9
154
155enum nvgpu_unit;
156
157enum nvgpu_flush_op;
158enum gk20a_mem_rw_flag;
159
160struct _resmgr_context;
161struct nvgpu_gpfifo_entry;
162
163struct nvgpu_gpfifo_userdata {
164 struct nvgpu_gpfifo_entry __user *entries;
165 struct _resmgr_context *context;
166};
167
168/*
169 * gpu_ops should only contain function pointers! Non-function pointer members
170 * should go in struct gk20a or be implemented with the boolean flag API defined
171 * in nvgpu/enabled.h
172 */
173
174/* index for FB fault buffer functions */
175#define NVGPU_FB_MMU_FAULT_NONREPLAY_REG_INDEX 0U
176#define NVGPU_FB_MMU_FAULT_REPLAY_REG_INDEX 1U
177#define NVGPU_FB_MMU_FAULT_BUF_DISABLED 0U
178#define NVGPU_FB_MMU_FAULT_BUF_ENABLED 1U
179
180/* Parameters for init_elcg_mode/init_blcg_mode */
181enum {
182 ELCG_RUN, /* clk always run, i.e. disable elcg */
183 ELCG_STOP, /* clk is stopped */
184 ELCG_AUTO /* clk will run when non-idle, standard elcg mode */
185};
186
187enum {
188 BLCG_RUN, /* clk always run, i.e. disable blcg */
189 BLCG_AUTO /* clk will run when non-idle, standard blcg mode */
190};
191
192struct gpu_ops {
193 struct {
194 int (*determine_L2_size_bytes)(struct gk20a *gk20a);
195 u64 (*get_cbc_base_divisor)(struct gk20a *g);
196 int (*init_comptags)(struct gk20a *g, struct gr_gk20a *gr);
197 int (*cbc_ctrl)(struct gk20a *g, enum gk20a_cbc_op op,
198 u32 min, u32 max);
199 void (*set_zbc_color_entry)(struct gk20a *g,
200 struct zbc_entry *color_val,
201 u32 index);
202 void (*set_zbc_depth_entry)(struct gk20a *g,
203 struct zbc_entry *depth_val,
204 u32 index);
205 void (*set_zbc_s_entry)(struct gk20a *g,
206 struct zbc_entry *s_val,
207 u32 index);
208 void (*init_cbc)(struct gk20a *g, struct gr_gk20a *gr);
209 void (*set_enabled)(struct gk20a *g, bool enabled);
210 void (*init_fs_state)(struct gk20a *g);
211 void (*isr)(struct gk20a *g);
212 u32 (*cbc_fix_config)(struct gk20a *g, int base);
213 void (*flush)(struct gk20a *g);
214 void (*intr_en_illegal_compstat)(struct gk20a *g, bool enable);
215 bool (*pri_is_ltc_addr)(struct gk20a *g, u32 addr);
216 bool (*is_ltcs_ltss_addr)(struct gk20a *g, u32 addr);
217 bool (*is_ltcn_ltss_addr)(struct gk20a *g, u32 addr);
218 void (*split_lts_broadcast_addr)(struct gk20a *g, u32 addr,
219 u32 *priv_addr_table,
220 u32 *priv_addr_table_index);
221 void (*split_ltc_broadcast_addr)(struct gk20a *g, u32 addr,
222 u32 *priv_addr_table,
223 u32 *priv_addr_table_index);
224 } ltc;
225 struct {
226 void (*isr_stall)(struct gk20a *g, u32 inst_id, u32 pri_base);