diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/pmu/pmu_fw.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/pmu/pmu_fw.c | 2368 |
1 files changed, 2368 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_fw.c b/drivers/gpu/nvgpu/common/pmu/pmu_fw.c new file mode 100644 index 00000000..654fde21 --- /dev/null +++ b/drivers/gpu/nvgpu/common/pmu/pmu_fw.c | |||
@@ -0,0 +1,2368 @@ | |||
1 | /* | ||
2 | * Copyright (c) 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 | #include <nvgpu/pmu.h> | ||
24 | #include <nvgpu/dma.h> | ||
25 | #include <nvgpu/log.h> | ||
26 | #include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h> | ||
27 | #include <nvgpu/firmware.h> | ||
28 | #include <nvgpu/enabled.h> | ||
29 | |||
30 | #include "gk20a/gk20a.h" | ||
31 | |||
32 | #include "boardobj/boardobj.h" | ||
33 | #include "boardobj/boardobjgrp.h" | ||
34 | |||
35 | /* PMU NS UCODE IMG */ | ||
36 | #define NVGPU_PMU_NS_UCODE_IMAGE "gpmu_ucode.bin" | ||
37 | |||
38 | /* PMU F/W version */ | ||
39 | #define APP_VERSION_BIGGPU 22836594 | ||
40 | #define APP_VERSION_NC_3 22204331 | ||
41 | #define APP_VERSION_NC_2 20429989 | ||
42 | #define APP_VERSION_NC_1 20313802 | ||
43 | #define APP_VERSION_NC_0 20360931 | ||
44 | #define APP_VERSION_GM206 20652057 | ||
45 | #define APP_VERSION_NV_GPU 21307569 | ||
46 | #define APP_VERSION_NV_GPU_1 21308030 | ||
47 | #define APP_VERSION_GM20B_5 20490253 | ||
48 | #define APP_VERSION_GM20B_4 19008461 | ||
49 | #define APP_VERSION_GM20B_3 18935575 | ||
50 | #define APP_VERSION_GM20B_2 18694072 | ||
51 | #define APP_VERSION_GM20B_1 18547257 | ||
52 | #define APP_VERSION_GM20B 17615280 | ||
53 | #define APP_VERSION_3 18357968 | ||
54 | #define APP_VERSION_2 18542378 | ||
55 | #define APP_VERSION_1 17997577 /*Obsolete this once 18357968 gets in*/ | ||
56 | #define APP_VERSION_0 16856675 | ||
57 | |||
58 | /* PMU version specific functions */ | ||
59 | static u32 pmu_perfmon_cntr_sz_v0(struct nvgpu_pmu *pmu) | ||
60 | { | ||
61 | return sizeof(struct pmu_perfmon_counter_v0); | ||
62 | } | ||
63 | |||
64 | static u32 pmu_perfmon_cntr_sz_v2(struct nvgpu_pmu *pmu) | ||
65 | { | ||
66 | return sizeof(struct pmu_perfmon_counter_v2); | ||
67 | } | ||
68 | |||
69 | static void *get_perfmon_cntr_ptr_v2(struct nvgpu_pmu *pmu) | ||
70 | { | ||
71 | return (void *)(&pmu->perfmon_counter_v2); | ||
72 | } | ||
73 | |||
74 | static void *get_perfmon_cntr_ptr_v0(struct nvgpu_pmu *pmu) | ||
75 | { | ||
76 | return (void *)(&pmu->perfmon_counter_v0); | ||
77 | } | ||
78 | |||
79 | static void set_perfmon_cntr_ut_v2(struct nvgpu_pmu *pmu, u16 ut) | ||
80 | { | ||
81 | pmu->perfmon_counter_v2.upper_threshold = ut; | ||
82 | } | ||
83 | |||
84 | static void set_perfmon_cntr_ut_v0(struct nvgpu_pmu *pmu, u16 ut) | ||
85 | { | ||
86 | pmu->perfmon_counter_v0.upper_threshold = ut; | ||
87 | } | ||
88 | |||
89 | static void set_perfmon_cntr_lt_v2(struct nvgpu_pmu *pmu, u16 lt) | ||
90 | { | ||
91 | pmu->perfmon_counter_v2.lower_threshold = lt; | ||
92 | } | ||
93 | |||
94 | static void set_perfmon_cntr_lt_v0(struct nvgpu_pmu *pmu, u16 lt) | ||
95 | { | ||
96 | pmu->perfmon_counter_v0.lower_threshold = lt; | ||
97 | } | ||
98 | |||
99 | static void set_perfmon_cntr_valid_v2(struct nvgpu_pmu *pmu, u8 valid) | ||
100 | { | ||
101 | pmu->perfmon_counter_v2.valid = valid; | ||
102 | } | ||
103 | |||
104 | static void set_perfmon_cntr_valid_v0(struct nvgpu_pmu *pmu, u8 valid) | ||
105 | { | ||
106 | pmu->perfmon_counter_v0.valid = valid; | ||
107 | } | ||
108 | |||
109 | static void set_perfmon_cntr_index_v2(struct nvgpu_pmu *pmu, u8 index) | ||
110 | { | ||
111 | pmu->perfmon_counter_v2.index = index; | ||
112 | } | ||
113 | |||
114 | static void set_perfmon_cntr_index_v0(struct nvgpu_pmu *pmu, u8 index) | ||
115 | { | ||
116 | pmu->perfmon_counter_v0.index = index; | ||
117 | } | ||
118 | |||
119 | static void set_perfmon_cntr_group_id_v2(struct nvgpu_pmu *pmu, u8 gid) | ||
120 | { | ||
121 | pmu->perfmon_counter_v2.group_id = gid; | ||
122 | } | ||
123 | |||
124 | static void set_perfmon_cntr_group_id_v0(struct nvgpu_pmu *pmu, u8 gid) | ||
125 | { | ||
126 | pmu->perfmon_counter_v0.group_id = gid; | ||
127 | } | ||
128 | |||
129 | static u32 pmu_cmdline_size_v0(struct nvgpu_pmu *pmu) | ||
130 | { | ||
131 | return sizeof(struct pmu_cmdline_args_v0); | ||
132 | } | ||
133 | |||
134 | static u32 pmu_cmdline_size_v1(struct nvgpu_pmu *pmu) | ||
135 | { | ||
136 | return sizeof(struct pmu_cmdline_args_v1); | ||
137 | } | ||
138 | |||
139 | static u32 pmu_cmdline_size_v2(struct nvgpu_pmu *pmu) | ||
140 | { | ||
141 | return sizeof(struct pmu_cmdline_args_v2); | ||
142 | } | ||
143 | |||
144 | static void set_pmu_cmdline_args_cpufreq_v2(struct nvgpu_pmu *pmu, u32 freq) | ||
145 | { | ||
146 | pmu->args_v2.cpu_freq_hz = freq; | ||
147 | } | ||
148 | static void set_pmu_cmdline_args_secure_mode_v2(struct nvgpu_pmu *pmu, u32 val) | ||
149 | { | ||
150 | pmu->args_v2.secure_mode = val; | ||
151 | } | ||
152 | |||
153 | static void set_pmu_cmdline_args_falctracesize_v2( | ||
154 | struct nvgpu_pmu *pmu, u32 size) | ||
155 | { | ||
156 | pmu->args_v2.falc_trace_size = size; | ||
157 | } | ||
158 | |||
159 | static void set_pmu_cmdline_args_falctracedmabase_v2(struct nvgpu_pmu *pmu) | ||
160 | { | ||
161 | pmu->args_v2.falc_trace_dma_base = ((u32)pmu->trace_buf.gpu_va)/0x100; | ||
162 | } | ||
163 | |||
164 | static void set_pmu_cmdline_args_falctracedmaidx_v2( | ||
165 | struct nvgpu_pmu *pmu, u32 idx) | ||
166 | { | ||
167 | pmu->args_v2.falc_trace_dma_idx = idx; | ||
168 | } | ||
169 | |||
170 | |||
171 | static void set_pmu_cmdline_args_falctracedmabase_v4(struct nvgpu_pmu *pmu) | ||
172 | { | ||
173 | pmu->args_v4.dma_addr.dma_base = ((u32)pmu->trace_buf.gpu_va)/0x100; | ||
174 | pmu->args_v4.dma_addr.dma_base1 = 0; | ||
175 | pmu->args_v4.dma_addr.dma_offset = 0; | ||
176 | } | ||
177 | |||
178 | static u32 pmu_cmdline_size_v4(struct nvgpu_pmu *pmu) | ||
179 | { | ||
180 | return sizeof(struct pmu_cmdline_args_v4); | ||
181 | } | ||
182 | |||
183 | static void set_pmu_cmdline_args_cpufreq_v4(struct nvgpu_pmu *pmu, u32 freq) | ||
184 | { | ||
185 | pmu->args_v4.cpu_freq_hz = freq; | ||
186 | } | ||
187 | static void set_pmu_cmdline_args_secure_mode_v4(struct nvgpu_pmu *pmu, u32 val) | ||
188 | { | ||
189 | pmu->args_v4.secure_mode = val; | ||
190 | } | ||
191 | |||
192 | static void set_pmu_cmdline_args_falctracesize_v4( | ||
193 | struct nvgpu_pmu *pmu, u32 size) | ||
194 | { | ||
195 | pmu->args_v4.falc_trace_size = size; | ||
196 | } | ||
197 | static void set_pmu_cmdline_args_falctracedmaidx_v4( | ||
198 | struct nvgpu_pmu *pmu, u32 idx) | ||
199 | { | ||
200 | pmu->args_v4.falc_trace_dma_idx = idx; | ||
201 | } | ||
202 | |||
203 | static u32 pmu_cmdline_size_v5(struct nvgpu_pmu *pmu) | ||
204 | { | ||
205 | return sizeof(struct pmu_cmdline_args_v5); | ||
206 | } | ||
207 | |||
208 | static u32 pmu_cmdline_size_v6(struct nvgpu_pmu *pmu) | ||
209 | { | ||
210 | return sizeof(struct pmu_cmdline_args_v6); | ||
211 | } | ||
212 | |||
213 | static void set_pmu_cmdline_args_cpufreq_v5(struct nvgpu_pmu *pmu, u32 freq) | ||
214 | { | ||
215 | pmu->args_v5.cpu_freq_hz = 204000000; | ||
216 | } | ||
217 | static void set_pmu_cmdline_args_secure_mode_v5(struct nvgpu_pmu *pmu, u32 val) | ||
218 | { | ||
219 | pmu->args_v5.secure_mode = val; | ||
220 | } | ||
221 | |||
222 | static void set_pmu_cmdline_args_falctracesize_v5( | ||
223 | struct nvgpu_pmu *pmu, u32 size) | ||
224 | { | ||
225 | /* set by surface describe */ | ||
226 | } | ||
227 | |||
228 | static void set_pmu_cmdline_args_falctracedmabase_v5(struct nvgpu_pmu *pmu) | ||
229 | { | ||
230 | struct gk20a *g = gk20a_from_pmu(pmu); | ||
231 | |||
232 | nvgpu_pmu_surface_describe(g, &pmu->trace_buf, &pmu->args_v5.trace_buf); | ||
233 | } | ||
234 | |||
235 | static void set_pmu_cmdline_args_falctracedmaidx_v5( | ||
236 | struct nvgpu_pmu *pmu, u32 idx) | ||
237 | { | ||
238 | /* set by surface describe */ | ||
239 | } | ||
240 | |||
241 | static u32 pmu_cmdline_size_v3(struct nvgpu_pmu *pmu) | ||
242 | { | ||
243 | return sizeof(struct pmu_cmdline_args_v3); | ||
244 | } | ||
245 | |||
246 | static void set_pmu_cmdline_args_cpufreq_v3(struct nvgpu_pmu *pmu, u32 freq) | ||
247 | { | ||
248 | pmu->args_v3.cpu_freq_hz = freq; | ||
249 | } | ||
250 | static void set_pmu_cmdline_args_secure_mode_v3(struct nvgpu_pmu *pmu, u32 val) | ||
251 | { | ||
252 | pmu->args_v3.secure_mode = val; | ||
253 | } | ||
254 | |||
255 | static void set_pmu_cmdline_args_falctracesize_v3( | ||
256 | struct nvgpu_pmu *pmu, u32 size) | ||
257 | { | ||
258 | pmu->args_v3.falc_trace_size = size; | ||
259 | } | ||
260 | |||
261 | static void set_pmu_cmdline_args_falctracedmabase_v3(struct nvgpu_pmu *pmu) | ||
262 | { | ||
263 | pmu->args_v3.falc_trace_dma_base = ((u32)pmu->trace_buf.gpu_va)/0x100; | ||
264 | } | ||
265 | |||
266 | static void set_pmu_cmdline_args_falctracedmaidx_v3( | ||
267 | struct nvgpu_pmu *pmu, u32 idx) | ||
268 | { | ||
269 | pmu->args_v3.falc_trace_dma_idx = idx; | ||
270 | } | ||
271 | |||
272 | static void set_pmu_cmdline_args_cpufreq_v1(struct nvgpu_pmu *pmu, u32 freq) | ||
273 | { | ||
274 | pmu->args_v1.cpu_freq_hz = freq; | ||
275 | } | ||
276 | static void set_pmu_cmdline_args_secure_mode_v1(struct nvgpu_pmu *pmu, u32 val) | ||
277 | { | ||
278 | pmu->args_v1.secure_mode = val; | ||
279 | } | ||
280 | |||
281 | static void set_pmu_cmdline_args_falctracesize_v1( | ||
282 | struct nvgpu_pmu *pmu, u32 size) | ||
283 | { | ||
284 | pmu->args_v1.falc_trace_size = size; | ||
285 | } | ||
286 | |||
287 | static void set_pmu_cmdline_args_falctracedmabase_v1(struct nvgpu_pmu *pmu) | ||
288 | { | ||
289 | pmu->args_v1.falc_trace_dma_base = ((u32)pmu->trace_buf.gpu_va)/0x100; | ||
290 | } | ||
291 | |||
292 | static void set_pmu_cmdline_args_falctracedmaidx_v1( | ||
293 | struct nvgpu_pmu *pmu, u32 idx) | ||
294 | { | ||
295 | pmu->args_v1.falc_trace_dma_idx = idx; | ||
296 | } | ||
297 | |||
298 | static void set_pmu_cmdline_args_cpufreq_v0(struct nvgpu_pmu *pmu, u32 freq) | ||
299 | { | ||
300 | pmu->args_v0.cpu_freq_hz = freq; | ||
301 | } | ||
302 | |||
303 | static void *get_pmu_cmdline_args_ptr_v4(struct nvgpu_pmu *pmu) | ||
304 | { | ||
305 | return (void *)(&pmu->args_v4); | ||
306 | } | ||
307 | |||
308 | static void *get_pmu_cmdline_args_ptr_v3(struct nvgpu_pmu *pmu) | ||
309 | { | ||
310 | return (void *)(&pmu->args_v3); | ||
311 | } | ||
312 | |||
313 | static void *get_pmu_cmdline_args_ptr_v2(struct nvgpu_pmu *pmu) | ||
314 | { | ||
315 | return (void *)(&pmu->args_v2); | ||
316 | } | ||
317 | |||
318 | static void *get_pmu_cmdline_args_ptr_v5(struct nvgpu_pmu *pmu) | ||
319 | { | ||
320 | return (void *)(&pmu->args_v5); | ||
321 | } | ||
322 | static void *get_pmu_cmdline_args_ptr_v1(struct nvgpu_pmu *pmu) | ||
323 | { | ||
324 | return (void *)(&pmu->args_v1); | ||
325 | } | ||
326 | |||
327 | static void *get_pmu_cmdline_args_ptr_v0(struct nvgpu_pmu *pmu) | ||
328 | { | ||
329 | return (void *)(&pmu->args_v0); | ||
330 | } | ||
331 | |||
332 | static u32 get_pmu_allocation_size_v3(struct nvgpu_pmu *pmu) | ||
333 | { | ||
334 | return sizeof(struct pmu_allocation_v3); | ||
335 | } | ||
336 | |||
337 | static u32 get_pmu_allocation_size_v2(struct nvgpu_pmu *pmu) | ||
338 | { | ||
339 | return sizeof(struct pmu_allocation_v2); | ||
340 | } | ||
341 | |||
342 | static u32 get_pmu_allocation_size_v1(struct nvgpu_pmu *pmu) | ||
343 | { | ||
344 | return sizeof(struct pmu_allocation_v1); | ||
345 | } | ||
346 | |||
347 | static u32 get_pmu_allocation_size_v0(struct nvgpu_pmu *pmu) | ||
348 | { | ||
349 | return sizeof(struct pmu_allocation_v0); | ||
350 | } | ||
351 | |||
352 | static void set_pmu_allocation_ptr_v3(struct nvgpu_pmu *pmu, | ||
353 | void **pmu_alloc_ptr, void *assign_ptr) | ||
354 | { | ||
355 | struct pmu_allocation_v3 **pmu_a_ptr = | ||
356 | (struct pmu_allocation_v3 **)pmu_alloc_ptr; | ||
357 | |||
358 | *pmu_a_ptr = (struct pmu_allocation_v3 *)assign_ptr; | ||
359 | } | ||
360 | |||
361 | static void set_pmu_allocation_ptr_v2(struct nvgpu_pmu *pmu, | ||
362 | void **pmu_alloc_ptr, void *assign_ptr) | ||
363 | { | ||
364 | struct pmu_allocation_v2 **pmu_a_ptr = | ||
365 | (struct pmu_allocation_v2 **)pmu_alloc_ptr; | ||
366 | |||
367 | *pmu_a_ptr = (struct pmu_allocation_v2 *)assign_ptr; | ||
368 | } | ||
369 | |||
370 | static void set_pmu_allocation_ptr_v1(struct nvgpu_pmu *pmu, | ||
371 | void **pmu_alloc_ptr, void *assign_ptr) | ||
372 | { | ||
373 | struct pmu_allocation_v1 **pmu_a_ptr = | ||
374 | (struct pmu_allocation_v1 **)pmu_alloc_ptr; | ||
375 | |||
376 | *pmu_a_ptr = (struct pmu_allocation_v1 *)assign_ptr; | ||
377 | } | ||
378 | |||
379 | static void set_pmu_allocation_ptr_v0(struct nvgpu_pmu *pmu, | ||
380 | void **pmu_alloc_ptr, void *assign_ptr) | ||
381 | { | ||
382 | struct pmu_allocation_v0 **pmu_a_ptr = | ||
383 | (struct pmu_allocation_v0 **)pmu_alloc_ptr; | ||
384 | |||
385 | *pmu_a_ptr = (struct pmu_allocation_v0 *)assign_ptr; | ||
386 | } | ||
387 | |||
388 | static void pmu_allocation_set_dmem_size_v3(struct nvgpu_pmu *pmu, | ||
389 | void *pmu_alloc_ptr, u16 size) | ||
390 | { | ||
391 | struct pmu_allocation_v3 *pmu_a_ptr = | ||
392 | (struct pmu_allocation_v3 *)pmu_alloc_ptr; | ||
393 | |||
394 | pmu_a_ptr->alloc.dmem.size = size; | ||
395 | } | ||
396 | |||
397 | static void pmu_allocation_set_dmem_size_v2(struct nvgpu_pmu *pmu, | ||
398 | void *pmu_alloc_ptr, u16 size) | ||
399 | { | ||
400 | struct pmu_allocation_v2 *pmu_a_ptr = | ||
401 | (struct pmu_allocation_v2 *)pmu_alloc_ptr; | ||
402 | |||
403 | pmu_a_ptr->alloc.dmem.size = size; | ||
404 | } | ||
405 | |||
406 | static void pmu_allocation_set_dmem_size_v1(struct nvgpu_pmu *pmu, | ||
407 | void *pmu_alloc_ptr, u16 size) | ||
408 | { | ||
409 | struct pmu_allocation_v1 *pmu_a_ptr = | ||
410 | (struct pmu_allocation_v1 *)pmu_alloc_ptr; | ||
411 | |||
412 | pmu_a_ptr->alloc.dmem.size = size; | ||
413 | } | ||
414 | |||
415 | static void pmu_allocation_set_dmem_size_v0(struct nvgpu_pmu *pmu, | ||
416 | void *pmu_alloc_ptr, u16 size) | ||
417 | { | ||
418 | struct pmu_allocation_v0 *pmu_a_ptr = | ||
419 | (struct pmu_allocation_v0 *)pmu_alloc_ptr; | ||
420 | |||
421 | pmu_a_ptr->alloc.dmem.size = size; | ||
422 | } | ||
423 | |||
424 | static u16 pmu_allocation_get_dmem_size_v3(struct nvgpu_pmu *pmu, | ||
425 | void *pmu_alloc_ptr) | ||
426 | { | ||
427 | struct pmu_allocation_v3 *pmu_a_ptr = | ||
428 | (struct pmu_allocation_v3 *)pmu_alloc_ptr; | ||
429 | |||
430 | return pmu_a_ptr->alloc.dmem.size; | ||
431 | } | ||
432 | |||
433 | static u16 pmu_allocation_get_dmem_size_v2(struct nvgpu_pmu *pmu, | ||
434 | void *pmu_alloc_ptr) | ||
435 | { | ||
436 | struct pmu_allocation_v2 *pmu_a_ptr = | ||
437 | (struct pmu_allocation_v2 *)pmu_alloc_ptr; | ||
438 | |||
439 | return pmu_a_ptr->alloc.dmem.size; | ||
440 | } | ||
441 | |||
442 | static u16 pmu_allocation_get_dmem_size_v1(struct nvgpu_pmu *pmu, | ||
443 | void *pmu_alloc_ptr) | ||
444 | { | ||
445 | struct pmu_allocation_v1 *pmu_a_ptr = | ||
446 | (struct pmu_allocation_v1 *)pmu_alloc_ptr; | ||
447 | |||
448 | return pmu_a_ptr->alloc.dmem.size; | ||
449 | } | ||
450 | |||
451 | static u16 pmu_allocation_get_dmem_size_v0(struct nvgpu_pmu *pmu, | ||
452 | void *pmu_alloc_ptr) | ||
453 | { | ||
454 | struct pmu_allocation_v0 *pmu_a_ptr = | ||
455 | (struct pmu_allocation_v0 *)pmu_alloc_ptr; | ||
456 | |||
457 | return pmu_a_ptr->alloc.dmem.size; | ||
458 | } | ||
459 | |||
460 | static u32 pmu_allocation_get_dmem_offset_v3(struct nvgpu_pmu *pmu, | ||
461 | void *pmu_alloc_ptr) | ||
462 | { | ||
463 | struct pmu_allocation_v3 *pmu_a_ptr = | ||
464 | (struct pmu_allocation_v3 *)pmu_alloc_ptr; | ||
465 | |||
466 | return pmu_a_ptr->alloc.dmem.offset; | ||
467 | } | ||
468 | |||
469 | static u32 pmu_allocation_get_dmem_offset_v2(struct nvgpu_pmu *pmu, | ||
470 | void *pmu_alloc_ptr) | ||
471 | { | ||
472 | struct pmu_allocation_v2 *pmu_a_ptr = | ||
473 | (struct pmu_allocation_v2 *)pmu_alloc_ptr; | ||
474 | |||
475 | return pmu_a_ptr->alloc.dmem.offset; | ||
476 | } | ||
477 | |||
478 | static u32 pmu_allocation_get_dmem_offset_v1(struct nvgpu_pmu *pmu, | ||
479 | void *pmu_alloc_ptr) | ||
480 | { | ||
481 | struct pmu_allocation_v1 *pmu_a_ptr = | ||
482 | (struct pmu_allocation_v1 *)pmu_alloc_ptr; | ||
483 | |||
484 | return pmu_a_ptr->alloc.dmem.offset; | ||
485 | } | ||
486 | |||
487 | static u32 pmu_allocation_get_dmem_offset_v0(struct nvgpu_pmu *pmu, | ||
488 | void *pmu_alloc_ptr) | ||
489 | { | ||
490 | struct pmu_allocation_v0 *pmu_a_ptr = | ||
491 | (struct pmu_allocation_v0 *)pmu_alloc_ptr; | ||
492 | |||
493 | return pmu_a_ptr->alloc.dmem.offset; | ||
494 | } | ||
495 | |||
496 | static u32 *pmu_allocation_get_dmem_offset_addr_v3(struct nvgpu_pmu *pmu, | ||
497 | void *pmu_alloc_ptr) | ||
498 | { | ||
499 | struct pmu_allocation_v3 *pmu_a_ptr = | ||
500 | (struct pmu_allocation_v3 *)pmu_alloc_ptr; | ||
501 | |||
502 | return &pmu_a_ptr->alloc.dmem.offset; | ||
503 | } | ||
504 | |||
505 | static void *pmu_allocation_get_fb_addr_v3( | ||
506 | struct nvgpu_pmu *pmu, void *pmu_alloc_ptr) | ||
507 | { | ||
508 | struct pmu_allocation_v3 *pmu_a_ptr = | ||
509 | (struct pmu_allocation_v3 *)pmu_alloc_ptr; | ||
510 | |||
511 | return (void *)&pmu_a_ptr->alloc.fb; | ||
512 | } | ||
513 | |||
514 | static u32 pmu_allocation_get_fb_size_v3( | ||
515 | struct nvgpu_pmu *pmu, void *pmu_alloc_ptr) | ||
516 | { | ||
517 | struct pmu_allocation_v3 *pmu_a_ptr = | ||
518 | (struct pmu_allocation_v3 *)pmu_alloc_ptr; | ||
519 | |||
520 | return sizeof(pmu_a_ptr->alloc.fb); | ||
521 | } | ||
522 | |||
523 | static u32 *pmu_allocation_get_dmem_offset_addr_v2(struct nvgpu_pmu *pmu, | ||
524 | void *pmu_alloc_ptr) | ||
525 | { | ||
526 | struct pmu_allocation_v2 *pmu_a_ptr = | ||
527 | (struct pmu_allocation_v2 *)pmu_alloc_ptr; | ||
528 | |||
529 | return &pmu_a_ptr->alloc.dmem.offset; | ||
530 | } | ||
531 | |||
532 | static u32 *pmu_allocation_get_dmem_offset_addr_v1(struct nvgpu_pmu *pmu, | ||
533 | void *pmu_alloc_ptr) | ||
534 | { | ||
535 | struct pmu_allocation_v1 *pmu_a_ptr = | ||
536 | (struct pmu_allocation_v1 *)pmu_alloc_ptr; | ||
537 | |||
538 | return &pmu_a_ptr->alloc.dmem.offset; | ||
539 | } | ||
540 | |||
541 | static u32 *pmu_allocation_get_dmem_offset_addr_v0(struct nvgpu_pmu *pmu, | ||
542 | void *pmu_alloc_ptr) | ||
543 | { | ||
544 | struct pmu_allocation_v0 *pmu_a_ptr = | ||
545 | (struct pmu_allocation_v0 *)pmu_alloc_ptr; | ||
546 | |||
547 | return &pmu_a_ptr->alloc.dmem.offset; | ||
548 | } | ||
549 | |||
550 | static void pmu_allocation_set_dmem_offset_v3(struct nvgpu_pmu *pmu, | ||
551 | void *pmu_alloc_ptr, u32 offset) | ||
552 | { | ||
553 | struct pmu_allocation_v3 *pmu_a_ptr = | ||
554 | (struct pmu_allocation_v3 *)pmu_alloc_ptr; | ||
555 | |||
556 | pmu_a_ptr->alloc.dmem.offset = offset; | ||
557 | } | ||
558 | |||
559 | static void pmu_allocation_set_dmem_offset_v2(struct nvgpu_pmu *pmu, | ||
560 | void *pmu_alloc_ptr, u32 offset) | ||
561 | { | ||
562 | struct pmu_allocation_v2 *pmu_a_ptr = | ||
563 | (struct pmu_allocation_v2 *)pmu_alloc_ptr; | ||
564 | |||
565 | pmu_a_ptr->alloc.dmem.offset = offset; | ||
566 | } | ||
567 | |||
568 | static void pmu_allocation_set_dmem_offset_v1(struct nvgpu_pmu *pmu, | ||
569 | void *pmu_alloc_ptr, u32 offset) | ||
570 | { | ||
571 | struct pmu_allocation_v1 *pmu_a_ptr = | ||
572 | (struct pmu_allocation_v1 *)pmu_alloc_ptr; | ||
573 | |||
574 | pmu_a_ptr->alloc.dmem.offset = offset; | ||
575 | } | ||
576 | |||
577 | static void pmu_allocation_set_dmem_offset_v0(struct nvgpu_pmu *pmu, | ||
578 | void *pmu_alloc_ptr, u32 offset) | ||
579 | { | ||
580 | struct pmu_allocation_v0 *pmu_a_ptr = | ||
581 | (struct pmu_allocation_v0 *)pmu_alloc_ptr; | ||
582 | |||
583 | pmu_a_ptr->alloc.dmem.offset = offset; | ||
584 | } | ||
585 | |||
586 | static void *get_pmu_msg_pmu_init_msg_ptr_v4(struct pmu_init_msg *init) | ||
587 | { | ||
588 | return (void *)(&(init->pmu_init_v4)); | ||
589 | } | ||
590 | |||
591 | static void *get_pmu_msg_pmu_init_msg_ptr_v3(struct pmu_init_msg *init) | ||
592 | { | ||
593 | return (void *)(&(init->pmu_init_v3)); | ||
594 | } | ||
595 | |||
596 | static u16 get_pmu_init_msg_pmu_sw_mg_off_v4(union pmu_init_msg_pmu *init_msg) | ||
597 | { | ||
598 | struct pmu_init_msg_pmu_v4 *init = | ||
599 | (struct pmu_init_msg_pmu_v4 *)(&init_msg->v4); | ||
600 | |||
601 | return init->sw_managed_area_offset; | ||
602 | } | ||
603 | |||
604 | static u16 get_pmu_init_msg_pmu_sw_mg_off_v3(union pmu_init_msg_pmu *init_msg) | ||
605 | { | ||
606 | struct pmu_init_msg_pmu_v3 *init = | ||
607 | (struct pmu_init_msg_pmu_v3 *)(&init_msg->v3); | ||
608 | |||
609 | return init->sw_managed_area_offset; | ||
610 | } | ||
611 | |||
612 | static u16 get_pmu_init_msg_pmu_sw_mg_size_v4(union pmu_init_msg_pmu *init_msg) | ||
613 | { | ||
614 | struct pmu_init_msg_pmu_v4 *init = | ||
615 | (struct pmu_init_msg_pmu_v4 *)(&init_msg->v4); | ||
616 | |||
617 | return init->sw_managed_area_size; | ||
618 | } | ||
619 | |||
620 | static u16 get_pmu_init_msg_pmu_sw_mg_size_v3(union pmu_init_msg_pmu *init_msg) | ||
621 | { | ||
622 | struct pmu_init_msg_pmu_v3 *init = | ||
623 | (struct pmu_init_msg_pmu_v3 *)(&init_msg->v3); | ||
624 | |||
625 | return init->sw_managed_area_size; | ||
626 | } | ||
627 | |||
628 | static void *get_pmu_msg_pmu_init_msg_ptr_v2(struct pmu_init_msg *init) | ||
629 | { | ||
630 | return (void *)(&(init->pmu_init_v2)); | ||
631 | } | ||
632 | |||
633 | static u16 get_pmu_init_msg_pmu_sw_mg_off_v2(union pmu_init_msg_pmu *init_msg) | ||
634 | { | ||
635 | struct pmu_init_msg_pmu_v2 *init = | ||
636 | (struct pmu_init_msg_pmu_v2 *)(&init_msg->v1); | ||
637 | |||
638 | return init->sw_managed_area_offset; | ||
639 | } | ||
640 | |||
641 | static u16 get_pmu_init_msg_pmu_sw_mg_size_v2(union pmu_init_msg_pmu *init_msg) | ||
642 | { | ||
643 | struct pmu_init_msg_pmu_v2 *init = | ||
644 | (struct pmu_init_msg_pmu_v2 *)(&init_msg->v1); | ||
645 | |||
646 | return init->sw_managed_area_size; | ||
647 | } | ||
648 | |||
649 | static void *get_pmu_msg_pmu_init_msg_ptr_v1(struct pmu_init_msg *init) | ||
650 | { | ||
651 | return (void *)(&(init->pmu_init_v1)); | ||
652 | } | ||
653 | |||
654 | static u16 get_pmu_init_msg_pmu_sw_mg_off_v1(union pmu_init_msg_pmu *init_msg) | ||
655 | { | ||
656 | struct pmu_init_msg_pmu_v1 *init = | ||
657 | (struct pmu_init_msg_pmu_v1 *)(&init_msg->v1); | ||
658 | |||
659 | return init->sw_managed_area_offset; | ||
660 | } | ||
661 | |||
662 | static u16 get_pmu_init_msg_pmu_sw_mg_size_v1(union pmu_init_msg_pmu *init_msg) | ||
663 | { | ||
664 | struct pmu_init_msg_pmu_v1 *init = | ||
665 | (struct pmu_init_msg_pmu_v1 *)(&init_msg->v1); | ||
666 | |||
667 | return init->sw_managed_area_size; | ||
668 | } | ||
669 | |||
670 | static void *get_pmu_msg_pmu_init_msg_ptr_v0(struct pmu_init_msg *init) | ||
671 | { | ||
672 | return (void *)(&(init->pmu_init_v0)); | ||
673 | } | ||
674 | |||
675 | static u16 get_pmu_init_msg_pmu_sw_mg_off_v0(union pmu_init_msg_pmu *init_msg) | ||
676 | { | ||
677 | struct pmu_init_msg_pmu_v0 *init = | ||
678 | (struct pmu_init_msg_pmu_v0 *)(&init_msg->v0); | ||
679 | |||
680 | return init->sw_managed_area_offset; | ||
681 | } | ||
682 | |||
683 | static u16 get_pmu_init_msg_pmu_sw_mg_size_v0(union pmu_init_msg_pmu *init_msg) | ||
684 | { | ||
685 | struct pmu_init_msg_pmu_v0 *init = | ||
686 | (struct pmu_init_msg_pmu_v0 *)(&init_msg->v0); | ||
687 | |||
688 | return init->sw_managed_area_size; | ||
689 | } | ||
690 | |||
691 | static u32 get_pmu_perfmon_cmd_start_size_v3(void) | ||
692 | { | ||
693 | return sizeof(struct pmu_perfmon_cmd_start_v3); | ||
694 | } | ||
695 | |||
696 | static u32 get_pmu_perfmon_cmd_start_size_v2(void) | ||
697 | { | ||
698 | return sizeof(struct pmu_perfmon_cmd_start_v2); | ||
699 | } | ||
700 | |||
701 | static u32 get_pmu_perfmon_cmd_start_size_v1(void) | ||
702 | { | ||
703 | return sizeof(struct pmu_perfmon_cmd_start_v1); | ||
704 | } | ||
705 | |||
706 | static u32 get_pmu_perfmon_cmd_start_size_v0(void) | ||
707 | { | ||
708 | return sizeof(struct pmu_perfmon_cmd_start_v0); | ||
709 | } | ||
710 | |||
711 | static int get_perfmon_cmd_start_offsetofvar_v3( | ||
712 | enum pmu_perfmon_cmd_start_fields field) | ||
713 | { | ||
714 | switch (field) { | ||
715 | case COUNTER_ALLOC: | ||
716 | return offsetof(struct pmu_perfmon_cmd_start_v3, | ||
717 | counter_alloc); | ||
718 | default: | ||
719 | return -EINVAL; | ||
720 | } | ||
721 | |||
722 | return 0; | ||
723 | } | ||
724 | |||
725 | static int get_perfmon_cmd_start_offsetofvar_v2( | ||
726 | enum pmu_perfmon_cmd_start_fields field) | ||
727 | { | ||
728 | switch (field) { | ||
729 | case COUNTER_ALLOC: | ||
730 | return offsetof(struct pmu_perfmon_cmd_start_v2, | ||
731 | counter_alloc); | ||
732 | default: | ||
733 | return -EINVAL; | ||
734 | } | ||
735 | |||
736 | return 0; | ||
737 | } | ||
738 | |||
739 | static int get_perfmon_cmd_start_offsetofvar_v1( | ||
740 | enum pmu_perfmon_cmd_start_fields field) | ||
741 | { | ||
742 | switch (field) { | ||
743 | case COUNTER_ALLOC: | ||
744 | return offsetof(struct pmu_perfmon_cmd_start_v1, | ||
745 | counter_alloc); | ||
746 | default: | ||
747 | return -EINVAL; | ||
748 | } | ||
749 | |||
750 | return 0; | ||
751 | } | ||
752 | |||
753 | static int get_perfmon_cmd_start_offsetofvar_v0( | ||
754 | enum pmu_perfmon_cmd_start_fields field) | ||
755 | { | ||
756 | switch (field) { | ||
757 | case COUNTER_ALLOC: | ||
758 | return offsetof(struct pmu_perfmon_cmd_start_v0, | ||
759 | counter_alloc); | ||
760 | default: | ||
761 | return -EINVAL; | ||
762 | } | ||
763 | |||
764 | return 0; | ||
765 | } | ||
766 | |||
767 | static u32 get_pmu_perfmon_cmd_init_size_v3(void) | ||
768 | { | ||
769 | return sizeof(struct pmu_perfmon_cmd_init_v3); | ||
770 | } | ||
771 | |||
772 | static u32 get_pmu_perfmon_cmd_init_size_v2(void) | ||
773 | { | ||
774 | return sizeof(struct pmu_perfmon_cmd_init_v2); | ||
775 | } | ||
776 | |||
777 | static u32 get_pmu_perfmon_cmd_init_size_v1(void) | ||
778 | { | ||
779 | return sizeof(struct pmu_perfmon_cmd_init_v1); | ||
780 | } | ||
781 | |||
782 | static u32 get_pmu_perfmon_cmd_init_size_v0(void) | ||
783 | { | ||
784 | return sizeof(struct pmu_perfmon_cmd_init_v0); | ||
785 | } | ||
786 | |||
787 | static int get_perfmon_cmd_init_offsetofvar_v3( | ||
788 | enum pmu_perfmon_cmd_start_fields field) | ||
789 | { | ||
790 | switch (field) { | ||
791 | case COUNTER_ALLOC: | ||
792 | return offsetof(struct pmu_perfmon_cmd_init_v3, | ||
793 | counter_alloc); | ||
794 | default: | ||
795 | return -EINVAL; | ||
796 | } | ||
797 | |||
798 | return 0; | ||
799 | } | ||
800 | |||
801 | static int get_perfmon_cmd_init_offsetofvar_v2( | ||
802 | enum pmu_perfmon_cmd_start_fields field) | ||
803 | { | ||
804 | switch (field) { | ||
805 | case COUNTER_ALLOC: | ||
806 | return offsetof(struct pmu_perfmon_cmd_init_v2, | ||
807 | counter_alloc); | ||
808 | default: | ||
809 | return -EINVAL; | ||
810 | } | ||
811 | |||
812 | return 0; | ||
813 | } | ||
814 | |||
815 | static int get_perfmon_cmd_init_offsetofvar_v1( | ||
816 | enum pmu_perfmon_cmd_start_fields field) | ||
817 | { | ||
818 | switch (field) { | ||
819 | case COUNTER_ALLOC: | ||
820 | return offsetof(struct pmu_perfmon_cmd_init_v1, | ||
821 | counter_alloc); | ||
822 | default: | ||
823 | return -EINVAL; | ||
824 | } | ||
825 | |||
826 | return 0; | ||
827 | } | ||
828 | |||
829 | static int get_perfmon_cmd_init_offsetofvar_v0( | ||
830 | enum pmu_perfmon_cmd_start_fields field) | ||
831 | { | ||
832 | switch (field) { | ||
833 | case COUNTER_ALLOC: | ||
834 | return offsetof(struct pmu_perfmon_cmd_init_v0, | ||
835 | counter_alloc); | ||
836 | default: | ||
837 | return -EINVAL; | ||
838 | } | ||
839 | |||
840 | return 0; | ||
841 | } | ||
842 | |||
843 | static void perfmon_start_set_cmd_type_v3(struct pmu_perfmon_cmd *pc, u8 value) | ||
844 | { | ||
845 | struct pmu_perfmon_cmd_start_v3 *start = &pc->start_v3; | ||
846 | |||
847 | start->cmd_type = value; | ||
848 | } | ||
849 | |||
850 | static void perfmon_start_set_cmd_type_v2(struct pmu_perfmon_cmd *pc, u8 value) | ||
851 | { | ||
852 | struct pmu_perfmon_cmd_start_v2 *start = &pc->start_v2; | ||
853 | |||
854 | start->cmd_type = value; | ||
855 | } | ||
856 | |||
857 | static void perfmon_start_set_cmd_type_v1(struct pmu_perfmon_cmd *pc, u8 value) | ||
858 | { | ||
859 | struct pmu_perfmon_cmd_start_v1 *start = &pc->start_v1; | ||
860 | |||
861 | start->cmd_type = value; | ||
862 | } | ||
863 | |||
864 | static void perfmon_start_set_cmd_type_v0(struct pmu_perfmon_cmd *pc, u8 value) | ||
865 | { | ||
866 | struct pmu_perfmon_cmd_start_v0 *start = &pc->start_v0; | ||
867 | |||
868 | start->cmd_type = value; | ||
869 | } | ||
870 | |||
871 | static void perfmon_start_set_group_id_v3(struct pmu_perfmon_cmd *pc, u8 value) | ||
872 | { | ||
873 | struct pmu_perfmon_cmd_start_v3 *start = &pc->start_v3; | ||
874 | |||
875 | start->group_id = value; | ||
876 | } | ||
877 | |||
878 | static void perfmon_start_set_group_id_v2(struct pmu_perfmon_cmd *pc, u8 value) | ||
879 | { | ||
880 | struct pmu_perfmon_cmd_start_v2 *start = &pc->start_v2; | ||
881 | |||
882 | start->group_id = value; | ||
883 | } | ||
884 | |||
885 | static void perfmon_start_set_group_id_v1(struct pmu_perfmon_cmd *pc, u8 value) | ||
886 | { | ||
887 | struct pmu_perfmon_cmd_start_v1 *start = &pc->start_v1; | ||
888 | |||
889 | start->group_id = value; | ||
890 | } | ||
891 | |||
892 | static void perfmon_start_set_group_id_v0(struct pmu_perfmon_cmd *pc, u8 value) | ||
893 | { | ||
894 | struct pmu_perfmon_cmd_start_v0 *start = &pc->start_v0; | ||
895 | |||
896 | start->group_id = value; | ||
897 | } | ||
898 | |||
899 | static void perfmon_start_set_state_id_v3(struct pmu_perfmon_cmd *pc, u8 value) | ||
900 | { | ||
901 | struct pmu_perfmon_cmd_start_v3 *start = &pc->start_v3; | ||
902 | |||
903 | start->state_id = value; | ||
904 | } | ||
905 | |||
906 | static void perfmon_start_set_state_id_v2(struct pmu_perfmon_cmd *pc, u8 value) | ||
907 | { | ||
908 | struct pmu_perfmon_cmd_start_v2 *start = &pc->start_v2; | ||
909 | |||
910 | start->state_id = value; | ||
911 | } | ||
912 | |||
913 | static void perfmon_start_set_state_id_v1(struct pmu_perfmon_cmd *pc, u8 value) | ||
914 | { | ||
915 | struct pmu_perfmon_cmd_start_v1 *start = &pc->start_v1; | ||
916 | |||
917 | start->state_id = value; | ||
918 | } | ||
919 | |||
920 | static void perfmon_start_set_state_id_v0(struct pmu_perfmon_cmd *pc, u8 value) | ||
921 | { | ||
922 | struct pmu_perfmon_cmd_start_v0 *start = &pc->start_v0; | ||
923 | |||
924 | start->state_id = value; | ||
925 | } | ||
926 | |||
927 | static void perfmon_start_set_flags_v3(struct pmu_perfmon_cmd *pc, u8 value) | ||
928 | { | ||
929 | struct pmu_perfmon_cmd_start_v3 *start = &pc->start_v3; | ||
930 | |||
931 | start->flags = value; | ||
932 | } | ||
933 | |||
934 | static void perfmon_start_set_flags_v2(struct pmu_perfmon_cmd *pc, u8 value) | ||
935 | { | ||
936 | struct pmu_perfmon_cmd_start_v2 *start = &pc->start_v2; | ||
937 | |||
938 | start->flags = value; | ||
939 | } | ||
940 | |||
941 | static void perfmon_start_set_flags_v1(struct pmu_perfmon_cmd *pc, u8 value) | ||
942 | { | ||
943 | struct pmu_perfmon_cmd_start_v1 *start = &pc->start_v1; | ||
944 | |||
945 | start->flags = value; | ||
946 | } | ||
947 | |||
948 | static void perfmon_start_set_flags_v0(struct pmu_perfmon_cmd *pc, u8 value) | ||
949 | { | ||
950 | struct pmu_perfmon_cmd_start_v0 *start = &pc->start_v0; | ||
951 | |||
952 | start->flags = value; | ||
953 | } | ||
954 | |||
955 | static u8 perfmon_start_get_flags_v3(struct pmu_perfmon_cmd *pc) | ||
956 | { | ||
957 | struct pmu_perfmon_cmd_start_v3 *start = &pc->start_v3; | ||
958 | |||
959 | return start->flags; | ||
960 | } | ||
961 | |||
962 | static u8 perfmon_start_get_flags_v2(struct pmu_perfmon_cmd *pc) | ||
963 | { | ||
964 | struct pmu_perfmon_cmd_start_v2 *start = &pc->start_v2; | ||
965 | |||
966 | return start->flags; | ||
967 | } | ||
968 | |||
969 | static u8 perfmon_start_get_flags_v1(struct pmu_perfmon_cmd *pc) | ||
970 | { | ||
971 | struct pmu_perfmon_cmd_start_v1 *start = &pc->start_v1; | ||
972 | |||
973 | return start->flags; | ||
974 | } | ||
975 | |||
976 | static u8 perfmon_start_get_flags_v0(struct pmu_perfmon_cmd *pc) | ||
977 | { | ||
978 | struct pmu_perfmon_cmd_start_v0 *start = &pc->start_v0; | ||
979 | |||
980 | return start->flags; | ||
981 | } | ||
982 | |||
983 | static void perfmon_cmd_init_set_sample_buffer_v3(struct pmu_perfmon_cmd *pc, | ||
984 | u16 value) | ||
985 | { | ||
986 | struct pmu_perfmon_cmd_init_v3 *init = &pc->init_v3; | ||
987 | |||
988 | init->sample_buffer = value; | ||
989 | } | ||
990 | |||
991 | static void perfmon_cmd_init_set_sample_buffer_v2(struct pmu_perfmon_cmd *pc, | ||
992 | u16 value) | ||
993 | { | ||
994 | struct pmu_perfmon_cmd_init_v2 *init = &pc->init_v2; | ||
995 | |||
996 | init->sample_buffer = value; | ||
997 | } | ||
998 | |||
999 | |||
1000 | static void perfmon_cmd_init_set_sample_buffer_v1(struct pmu_perfmon_cmd *pc, | ||
1001 | u16 value) | ||
1002 | { | ||
1003 | struct pmu_perfmon_cmd_init_v1 *init = &pc->init_v1; | ||
1004 | |||
1005 | init->sample_buffer = value; | ||
1006 | } | ||
1007 | |||
1008 | static void perfmon_cmd_init_set_sample_buffer_v0(struct pmu_perfmon_cmd *pc, | ||
1009 | u16 value) | ||
1010 | { | ||
1011 | struct pmu_perfmon_cmd_init_v0 *init = &pc->init_v0; | ||
1012 | |||
1013 | init->sample_buffer = value; | ||
1014 | } | ||
1015 | |||
1016 | static void perfmon_cmd_init_set_dec_cnt_v3(struct pmu_perfmon_cmd *pc, | ||
1017 | u8 value) | ||
1018 | { | ||
1019 | struct pmu_perfmon_cmd_init_v3 *init = &pc->init_v3; | ||
1020 | |||
1021 | init->to_decrease_count = value; | ||
1022 | } | ||
1023 | |||
1024 | static void perfmon_cmd_init_set_dec_cnt_v2(struct pmu_perfmon_cmd *pc, | ||
1025 | u8 value) | ||
1026 | { | ||
1027 | struct pmu_perfmon_cmd_init_v2 *init = &pc->init_v2; | ||
1028 | |||
1029 | init->to_decrease_count = value; | ||
1030 | } | ||
1031 | |||
1032 | static void perfmon_cmd_init_set_dec_cnt_v1(struct pmu_perfmon_cmd *pc, | ||
1033 | u8 value) | ||
1034 | { | ||
1035 | struct pmu_perfmon_cmd_init_v1 *init = &pc->init_v1; | ||
1036 | |||
1037 | init->to_decrease_count = value; | ||
1038 | } | ||
1039 | |||
1040 | static void perfmon_cmd_init_set_dec_cnt_v0(struct pmu_perfmon_cmd *pc, | ||
1041 | u8 value) | ||
1042 | { | ||
1043 | struct pmu_perfmon_cmd_init_v0 *init = &pc->init_v0; | ||
1044 | |||
1045 | init->to_decrease_count = value; | ||
1046 | } | ||
1047 | |||
1048 | static void perfmon_cmd_init_set_base_cnt_id_v3(struct pmu_perfmon_cmd *pc, | ||
1049 | u8 value) | ||
1050 | { | ||
1051 | struct pmu_perfmon_cmd_init_v3 *init = &pc->init_v3; | ||
1052 | |||
1053 | init->base_counter_id = value; | ||
1054 | } | ||
1055 | |||
1056 | static void perfmon_cmd_init_set_base_cnt_id_v2(struct pmu_perfmon_cmd *pc, | ||
1057 | u8 value) | ||
1058 | { | ||
1059 | struct pmu_perfmon_cmd_init_v2 *init = &pc->init_v2; | ||
1060 | |||
1061 | init->base_counter_id = value; | ||
1062 | } | ||
1063 | |||
1064 | static void perfmon_cmd_init_set_base_cnt_id_v1(struct pmu_perfmon_cmd *pc, | ||
1065 | u8 value) | ||
1066 | { | ||
1067 | struct pmu_perfmon_cmd_init_v1 *init = &pc->init_v1; | ||
1068 | |||
1069 | init->base_counter_id = value; | ||
1070 | } | ||
1071 | |||
1072 | static void perfmon_cmd_init_set_base_cnt_id_v0(struct pmu_perfmon_cmd *pc, | ||
1073 | u8 value) | ||
1074 | { | ||
1075 | struct pmu_perfmon_cmd_init_v0 *init = &pc->init_v0; | ||
1076 | |||
1077 | init->base_counter_id = value; | ||
1078 | } | ||
1079 | |||
1080 | static void perfmon_cmd_init_set_samp_period_us_v3(struct pmu_perfmon_cmd *pc, | ||
1081 | u32 value) | ||
1082 | { | ||
1083 | struct pmu_perfmon_cmd_init_v3 *init = &pc->init_v3; | ||
1084 | |||
1085 | init->sample_period_us = value; | ||
1086 | } | ||
1087 | |||
1088 | static void perfmon_cmd_init_set_samp_period_us_v2(struct pmu_perfmon_cmd *pc, | ||
1089 | u32 value) | ||
1090 | { | ||
1091 | struct pmu_perfmon_cmd_init_v2 *init = &pc->init_v2; | ||
1092 | |||
1093 | init->sample_period_us = value; | ||
1094 | } | ||
1095 | |||
1096 | static void perfmon_cmd_init_set_samp_period_us_v1(struct pmu_perfmon_cmd *pc, | ||
1097 | u32 value) | ||
1098 | { | ||
1099 | struct pmu_perfmon_cmd_init_v1 *init = &pc->init_v1; | ||
1100 | |||
1101 | init->sample_period_us = value; | ||
1102 | } | ||
1103 | |||
1104 | static void perfmon_cmd_init_set_samp_period_us_v0(struct pmu_perfmon_cmd *pc, | ||
1105 | u32 value) | ||
1106 | { | ||
1107 | struct pmu_perfmon_cmd_init_v0 *init = &pc->init_v0; | ||
1108 | |||
1109 | init->sample_period_us = value; | ||
1110 | } | ||
1111 | |||
1112 | static void perfmon_cmd_init_set_num_cnt_v3(struct pmu_perfmon_cmd *pc, | ||
1113 | u8 value) | ||
1114 | { | ||
1115 | struct pmu_perfmon_cmd_init_v3 *init = &pc->init_v3; | ||
1116 | |||
1117 | init->num_counters = value; | ||
1118 | } | ||
1119 | |||
1120 | static void perfmon_cmd_init_set_num_cnt_v2(struct pmu_perfmon_cmd *pc, | ||
1121 | u8 value) | ||
1122 | { | ||
1123 | struct pmu_perfmon_cmd_init_v2 *init = &pc->init_v2; | ||
1124 | |||
1125 | init->num_counters = value; | ||
1126 | } | ||
1127 | |||
1128 | static void perfmon_cmd_init_set_num_cnt_v1(struct pmu_perfmon_cmd *pc, | ||
1129 | u8 value) | ||
1130 | { | ||
1131 | struct pmu_perfmon_cmd_init_v1 *init = &pc->init_v1; | ||
1132 | |||
1133 | init->num_counters = value; | ||
1134 | } | ||
1135 | |||
1136 | static void perfmon_cmd_init_set_num_cnt_v0(struct pmu_perfmon_cmd *pc, | ||
1137 | u8 value) | ||
1138 | { | ||
1139 | struct pmu_perfmon_cmd_init_v0 *init = &pc->init_v0; | ||
1140 | |||
1141 | init->num_counters = value; | ||
1142 | } | ||
1143 | |||
1144 | static void perfmon_cmd_init_set_mov_avg_v3(struct pmu_perfmon_cmd *pc, | ||
1145 | u8 value) | ||
1146 | { | ||
1147 | struct pmu_perfmon_cmd_init_v3 *init = &pc->init_v3; | ||
1148 | |||
1149 | init->samples_in_moving_avg = value; | ||
1150 | } | ||
1151 | |||
1152 | static void perfmon_cmd_init_set_mov_avg_v2(struct pmu_perfmon_cmd *pc, | ||
1153 | u8 value) | ||
1154 | { | ||
1155 | struct pmu_perfmon_cmd_init_v2 *init = &pc->init_v2; | ||
1156 | |||
1157 | init->samples_in_moving_avg = value; | ||
1158 | } | ||
1159 | |||
1160 | static void perfmon_cmd_init_set_mov_avg_v1(struct pmu_perfmon_cmd *pc, | ||
1161 | u8 value) | ||
1162 | { | ||
1163 | struct pmu_perfmon_cmd_init_v1 *init = &pc->init_v1; | ||
1164 | |||
1165 | init->samples_in_moving_avg = value; | ||
1166 | } | ||
1167 | |||
1168 | static void perfmon_cmd_init_set_mov_avg_v0(struct pmu_perfmon_cmd *pc, | ||
1169 | u8 value) | ||
1170 | { | ||
1171 | struct pmu_perfmon_cmd_init_v0 *init = &pc->init_v0; | ||
1172 | |||
1173 | init->samples_in_moving_avg = value; | ||
1174 | } | ||
1175 | |||
1176 | static void get_pmu_init_msg_pmu_queue_params_v0(struct pmu_queue *queue, | ||
1177 | u32 id, void *pmu_init_msg) | ||
1178 | { | ||
1179 | struct pmu_init_msg_pmu_v0 *init = | ||
1180 | (struct pmu_init_msg_pmu_v0 *)pmu_init_msg; | ||
1181 | |||
1182 | queue->index = init->queue_info[id].index; | ||
1183 | queue->offset = init->queue_info[id].offset; | ||
1184 | queue->size = init->queue_info[id].size; | ||
1185 | } | ||
1186 | |||
1187 | static void get_pmu_init_msg_pmu_queue_params_v1(struct pmu_queue *queue, | ||
1188 | u32 id, void *pmu_init_msg) | ||
1189 | { | ||
1190 | struct pmu_init_msg_pmu_v1 *init = | ||
1191 | (struct pmu_init_msg_pmu_v1 *)pmu_init_msg; | ||
1192 | |||
1193 | queue->index = init->queue_info[id].index; | ||
1194 | queue->offset = init->queue_info[id].offset; | ||
1195 | queue->size = init->queue_info[id].size; | ||
1196 | } | ||
1197 | |||
1198 | static void get_pmu_init_msg_pmu_queue_params_v2(struct pmu_queue *queue, | ||
1199 | u32 id, void *pmu_init_msg) | ||
1200 | { | ||
1201 | struct pmu_init_msg_pmu_v2 *init = | ||
1202 | (struct pmu_init_msg_pmu_v2 *)pmu_init_msg; | ||
1203 | |||
1204 | queue->index = init->queue_info[id].index; | ||
1205 | queue->offset = init->queue_info[id].offset; | ||
1206 | queue->size = init->queue_info[id].size; | ||
1207 | } | ||
1208 | |||
1209 | static void get_pmu_init_msg_pmu_queue_params_v4(struct pmu_queue *queue, | ||
1210 | u32 id, void *pmu_init_msg) | ||
1211 | { | ||
1212 | struct pmu_init_msg_pmu_v4 *init = pmu_init_msg; | ||
1213 | u32 current_ptr = 0; | ||
1214 | u8 i; | ||
1215 | u8 tmp_id = id; | ||
1216 | |||
1217 | if (tmp_id == PMU_COMMAND_QUEUE_HPQ) | ||
1218 | tmp_id = PMU_QUEUE_HPQ_IDX_FOR_V3; | ||
1219 | else if (tmp_id == PMU_COMMAND_QUEUE_LPQ) | ||
1220 | tmp_id = PMU_QUEUE_LPQ_IDX_FOR_V3; | ||
1221 | else if (tmp_id == PMU_MESSAGE_QUEUE) | ||
1222 | tmp_id = PMU_QUEUE_MSG_IDX_FOR_V3; | ||
1223 | else | ||
1224 | return; | ||
1225 | |||
1226 | queue->index = init->queue_index[tmp_id]; | ||
1227 | queue->size = init->queue_size[tmp_id]; | ||
1228 | if (tmp_id != 0) { | ||
1229 | for (i = 0 ; i < tmp_id; i++) | ||
1230 | current_ptr += init->queue_size[i]; | ||
1231 | } | ||
1232 | queue->offset = init->queue_offset + current_ptr; | ||
1233 | } | ||
1234 | |||
1235 | static void get_pmu_init_msg_pmu_queue_params_v5(struct pmu_queue *queue, | ||
1236 | u32 id, void *pmu_init_msg) | ||
1237 | { | ||
1238 | struct pmu_init_msg_pmu_v4 *init = pmu_init_msg; | ||
1239 | u32 current_ptr = 0; | ||
1240 | u8 i; | ||
1241 | u8 tmp_id = id; | ||
1242 | |||
1243 | if (tmp_id == PMU_COMMAND_QUEUE_HPQ) | ||
1244 | tmp_id = PMU_QUEUE_HPQ_IDX_FOR_V3; | ||
1245 | else if (tmp_id == PMU_COMMAND_QUEUE_LPQ) | ||
1246 | tmp_id = PMU_QUEUE_LPQ_IDX_FOR_V3; | ||
1247 | else if (tmp_id == PMU_MESSAGE_QUEUE) | ||
1248 | tmp_id = PMU_QUEUE_MSG_IDX_FOR_V4; | ||
1249 | else | ||
1250 | return; | ||
1251 | |||
1252 | queue->index = init->queue_index[tmp_id]; | ||
1253 | queue->size = init->queue_size[tmp_id]; | ||
1254 | if (tmp_id != 0) { | ||
1255 | for (i = 0 ; i < tmp_id; i++) | ||
1256 | current_ptr += init->queue_size[i]; | ||
1257 | } | ||
1258 | queue->offset = init->queue_offset + current_ptr; | ||
1259 | } | ||
1260 | |||
1261 | static void get_pmu_init_msg_pmu_queue_params_v3(struct pmu_queue *queue, | ||
1262 | u32 id, void *pmu_init_msg) | ||
1263 | { | ||
1264 | struct pmu_init_msg_pmu_v3 *init = | ||
1265 | (struct pmu_init_msg_pmu_v3 *)pmu_init_msg; | ||
1266 | u32 current_ptr = 0; | ||
1267 | u8 i; | ||
1268 | u8 tmp_id = id; | ||
1269 | |||
1270 | if (tmp_id == PMU_COMMAND_QUEUE_HPQ) | ||
1271 | tmp_id = PMU_QUEUE_HPQ_IDX_FOR_V3; | ||
1272 | else if (tmp_id == PMU_COMMAND_QUEUE_LPQ) | ||
1273 | tmp_id = PMU_QUEUE_LPQ_IDX_FOR_V3; | ||
1274 | else if (tmp_id == PMU_MESSAGE_QUEUE) | ||
1275 | tmp_id = PMU_QUEUE_MSG_IDX_FOR_V3; | ||
1276 | else | ||
1277 | return; | ||
1278 | queue->index = init->queue_index[tmp_id]; | ||
1279 | queue->size = init->queue_size[tmp_id]; | ||
1280 | if (tmp_id != 0) { | ||
1281 | for (i = 0 ; i < tmp_id; i++) | ||
1282 | current_ptr += init->queue_size[i]; | ||
1283 | } | ||
1284 | queue->offset = init->queue_offset + current_ptr; | ||
1285 | } | ||
1286 | |||
1287 | static void *get_pmu_sequence_in_alloc_ptr_v3(struct pmu_sequence *seq) | ||
1288 | { | ||
1289 | return (void *)(&seq->in_v3); | ||
1290 | } | ||
1291 | |||
1292 | static void *get_pmu_sequence_in_alloc_ptr_v1(struct pmu_sequence *seq) | ||
1293 | { | ||
1294 | return (void *)(&seq->in_v1); | ||
1295 | } | ||
1296 | |||
1297 | static void *get_pmu_sequence_in_alloc_ptr_v0(struct pmu_sequence *seq) | ||
1298 | { | ||
1299 | return (void *)(&seq->in_v0); | ||
1300 | } | ||
1301 | |||
1302 | static void *get_pmu_sequence_out_alloc_ptr_v3(struct pmu_sequence *seq) | ||
1303 | { | ||
1304 | return (void *)(&seq->out_v3); | ||
1305 | } | ||
1306 | |||
1307 | static void *get_pmu_sequence_out_alloc_ptr_v1(struct pmu_sequence *seq) | ||
1308 | { | ||
1309 | return (void *)(&seq->out_v1); | ||
1310 | } | ||
1311 | |||
1312 | static void *get_pmu_sequence_out_alloc_ptr_v0(struct pmu_sequence *seq) | ||
1313 | { | ||
1314 | return (void *)(&seq->out_v0); | ||
1315 | } | ||
1316 | |||
1317 | static u8 pg_cmd_eng_buf_load_size_v0(struct pmu_pg_cmd *pg) | ||
1318 | { | ||
1319 | return sizeof(pg->eng_buf_load_v0); | ||
1320 | } | ||
1321 | |||
1322 | static u8 pg_cmd_eng_buf_load_size_v1(struct pmu_pg_cmd *pg) | ||
1323 | { | ||
1324 | return sizeof(pg->eng_buf_load_v1); | ||
1325 | } | ||
1326 | |||
1327 | static u8 pg_cmd_eng_buf_load_size_v2(struct pmu_pg_cmd *pg) | ||
1328 | { | ||
1329 | return sizeof(pg->eng_buf_load_v2); | ||
1330 | } | ||
1331 | |||
1332 | static void pg_cmd_eng_buf_load_set_cmd_type_v0(struct pmu_pg_cmd *pg, | ||
1333 | u8 value) | ||
1334 | { | ||
1335 | pg->eng_buf_load_v0.cmd_type = value; | ||
1336 | } | ||
1337 | |||
1338 | static void pg_cmd_eng_buf_load_set_cmd_type_v1(struct pmu_pg_cmd *pg, | ||
1339 | u8 value) | ||
1340 | { | ||
1341 | pg->eng_buf_load_v1.cmd_type = value; | ||
1342 | } | ||
1343 | |||
1344 | static void pg_cmd_eng_buf_load_set_cmd_type_v2(struct pmu_pg_cmd *pg, | ||
1345 | u8 value) | ||
1346 | { | ||
1347 | pg->eng_buf_load_v2.cmd_type = value; | ||
1348 | } | ||
1349 | |||
1350 | static void pg_cmd_eng_buf_load_set_engine_id_v0(struct pmu_pg_cmd *pg, | ||
1351 | u8 value) | ||
1352 | { | ||
1353 | pg->eng_buf_load_v0.engine_id = value; | ||
1354 | } | ||
1355 | static void pg_cmd_eng_buf_load_set_engine_id_v1(struct pmu_pg_cmd *pg, | ||
1356 | u8 value) | ||
1357 | { | ||
1358 | pg->eng_buf_load_v1.engine_id = value; | ||
1359 | } | ||
1360 | static void pg_cmd_eng_buf_load_set_engine_id_v2(struct pmu_pg_cmd *pg, | ||
1361 | u8 value) | ||
1362 | { | ||
1363 | pg->eng_buf_load_v2.engine_id = value; | ||
1364 | } | ||
1365 | static void pg_cmd_eng_buf_load_set_buf_idx_v0(struct pmu_pg_cmd *pg, | ||
1366 | u8 value) | ||
1367 | { | ||
1368 | pg->eng_buf_load_v0.buf_idx = value; | ||
1369 | } | ||
1370 | static void pg_cmd_eng_buf_load_set_buf_idx_v1(struct pmu_pg_cmd *pg, | ||
1371 | u8 value) | ||
1372 | { | ||
1373 | pg->eng_buf_load_v1.buf_idx = value; | ||
1374 | } | ||
1375 | static void pg_cmd_eng_buf_load_set_buf_idx_v2(struct pmu_pg_cmd *pg, | ||
1376 | u8 value) | ||
1377 | { | ||
1378 | pg->eng_buf_load_v2.buf_idx = value; | ||
1379 | } | ||
1380 | |||
1381 | static void pg_cmd_eng_buf_load_set_pad_v0(struct pmu_pg_cmd *pg, | ||
1382 | u8 value) | ||
1383 | { | ||
1384 | pg->eng_buf_load_v0.pad = value; | ||
1385 | } | ||
1386 | static void pg_cmd_eng_buf_load_set_pad_v1(struct pmu_pg_cmd *pg, | ||
1387 | u8 value) | ||
1388 | { | ||
1389 | pg->eng_buf_load_v1.pad = value; | ||
1390 | } | ||
1391 | static void pg_cmd_eng_buf_load_set_pad_v2(struct pmu_pg_cmd *pg, | ||
1392 | u8 value) | ||
1393 | { | ||
1394 | pg->eng_buf_load_v2.pad = value; | ||
1395 | } | ||
1396 | |||
1397 | static void pg_cmd_eng_buf_load_set_buf_size_v0(struct pmu_pg_cmd *pg, | ||
1398 | u16 value) | ||
1399 | { | ||
1400 | pg->eng_buf_load_v0.buf_size = value; | ||
1401 | } | ||
1402 | static void pg_cmd_eng_buf_load_set_buf_size_v1(struct pmu_pg_cmd *pg, | ||
1403 | u16 value) | ||
1404 | { | ||
1405 | pg->eng_buf_load_v1.dma_desc.dma_size = value; | ||
1406 | } | ||
1407 | static void pg_cmd_eng_buf_load_set_buf_size_v2(struct pmu_pg_cmd *pg, | ||
1408 | u16 value) | ||
1409 | { | ||
1410 | pg->eng_buf_load_v2.dma_desc.params = value; | ||
1411 | } | ||
1412 | |||
1413 | static void pg_cmd_eng_buf_load_set_dma_base_v0(struct pmu_pg_cmd *pg, | ||
1414 | u32 value) | ||
1415 | { | ||
1416 | pg->eng_buf_load_v0.dma_base = (value >> 8); | ||
1417 | } | ||
1418 | static void pg_cmd_eng_buf_load_set_dma_base_v1(struct pmu_pg_cmd *pg, | ||
1419 | u32 value) | ||
1420 | { | ||
1421 | pg->eng_buf_load_v1.dma_desc.dma_addr.lo |= u64_lo32(value); | ||
1422 | pg->eng_buf_load_v1.dma_desc.dma_addr.hi |= u64_hi32(value); | ||
1423 | } | ||
1424 | static void pg_cmd_eng_buf_load_set_dma_base_v2(struct pmu_pg_cmd *pg, | ||
1425 | u32 value) | ||
1426 | { | ||
1427 | pg->eng_buf_load_v2.dma_desc.address.lo = u64_lo32(value); | ||
1428 | pg->eng_buf_load_v2.dma_desc.address.hi = u64_lo32(value); | ||
1429 | } | ||
1430 | |||
1431 | static void pg_cmd_eng_buf_load_set_dma_offset_v0(struct pmu_pg_cmd *pg, | ||
1432 | u8 value) | ||
1433 | { | ||
1434 | pg->eng_buf_load_v0.dma_offset = value; | ||
1435 | } | ||
1436 | static void pg_cmd_eng_buf_load_set_dma_offset_v1(struct pmu_pg_cmd *pg, | ||
1437 | u8 value) | ||
1438 | { | ||
1439 | pg->eng_buf_load_v1.dma_desc.dma_addr.lo |= value; | ||
1440 | } | ||
1441 | static void pg_cmd_eng_buf_load_set_dma_offset_v2(struct pmu_pg_cmd *pg, | ||
1442 | u8 value) | ||
1443 | { | ||
1444 | pg->eng_buf_load_v2.dma_desc.address.lo |= u64_lo32(value); | ||
1445 | pg->eng_buf_load_v2.dma_desc.address.hi |= u64_lo32(value); | ||
1446 | } | ||
1447 | |||
1448 | static void pg_cmd_eng_buf_load_set_dma_idx_v0(struct pmu_pg_cmd *pg, | ||
1449 | u8 value) | ||
1450 | { | ||
1451 | pg->eng_buf_load_v0.dma_idx = value; | ||
1452 | } | ||
1453 | |||
1454 | static void pg_cmd_eng_buf_load_set_dma_idx_v1(struct pmu_pg_cmd *pg, | ||
1455 | u8 value) | ||
1456 | { | ||
1457 | pg->eng_buf_load_v1.dma_desc.dma_idx = value; | ||
1458 | } | ||
1459 | |||
1460 | static void pg_cmd_eng_buf_load_set_dma_idx_v2(struct pmu_pg_cmd *pg, | ||
1461 | u8 value) | ||
1462 | { | ||
1463 | pg->eng_buf_load_v2.dma_desc.params |= (value << 24); | ||
1464 | } | ||
1465 | |||
1466 | static int nvgpu_init_pmu_fw_ver_ops(struct nvgpu_pmu *pmu) | ||
1467 | { | ||
1468 | struct gk20a *g = gk20a_from_pmu(pmu); | ||
1469 | struct pmu_v *pv = &g->ops.pmu_ver; | ||
1470 | int err = 0; | ||
1471 | |||
1472 | nvgpu_log_fn(g, " "); | ||
1473 | |||
1474 | switch (pmu->desc->app_version) { | ||
1475 | case APP_VERSION_NC_2: | ||
1476 | case APP_VERSION_NC_1: | ||
1477 | case APP_VERSION_NC_0: | ||
1478 | g->ops.pmu_ver.pg_cmd_eng_buf_load_size = | ||
1479 | pg_cmd_eng_buf_load_size_v1; | ||
1480 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_cmd_type = | ||
1481 | pg_cmd_eng_buf_load_set_cmd_type_v1; | ||
1482 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_engine_id = | ||
1483 | pg_cmd_eng_buf_load_set_engine_id_v1; | ||
1484 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_idx = | ||
1485 | pg_cmd_eng_buf_load_set_buf_idx_v1; | ||
1486 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_pad = | ||
1487 | pg_cmd_eng_buf_load_set_pad_v1; | ||
1488 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_size = | ||
1489 | pg_cmd_eng_buf_load_set_buf_size_v1; | ||
1490 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_base = | ||
1491 | pg_cmd_eng_buf_load_set_dma_base_v1; | ||
1492 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_offset = | ||
1493 | pg_cmd_eng_buf_load_set_dma_offset_v1; | ||
1494 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_idx = | ||
1495 | pg_cmd_eng_buf_load_set_dma_idx_v1; | ||
1496 | g->ops.pmu_ver.get_perfmon_cntr_ptr = get_perfmon_cntr_ptr_v2; | ||
1497 | g->ops.pmu_ver.set_perfmon_cntr_ut = set_perfmon_cntr_ut_v2; | ||
1498 | g->ops.pmu_ver.set_perfmon_cntr_lt = set_perfmon_cntr_lt_v2; | ||
1499 | g->ops.pmu_ver.set_perfmon_cntr_valid = | ||
1500 | set_perfmon_cntr_valid_v2; | ||
1501 | g->ops.pmu_ver.set_perfmon_cntr_index = | ||
1502 | set_perfmon_cntr_index_v2; | ||
1503 | g->ops.pmu_ver.set_perfmon_cntr_group_id = | ||
1504 | set_perfmon_cntr_group_id_v2; | ||
1505 | g->ops.pmu_ver.get_perfmon_cntr_sz = pmu_perfmon_cntr_sz_v2; | ||
1506 | g->pmu_ver_cmd_id_zbc_table_update = 16; | ||
1507 | __nvgpu_set_enabled(g, NVGPU_PMU_ZBC_SAVE, true); | ||
1508 | g->ops.pmu_ver.get_pmu_cmdline_args_size = | ||
1509 | pmu_cmdline_size_v4; | ||
1510 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq = | ||
1511 | set_pmu_cmdline_args_cpufreq_v4; | ||
1512 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode = | ||
1513 | set_pmu_cmdline_args_secure_mode_v4; | ||
1514 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_size = | ||
1515 | set_pmu_cmdline_args_falctracesize_v4; | ||
1516 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base = | ||
1517 | set_pmu_cmdline_args_falctracedmabase_v4; | ||
1518 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx = | ||
1519 | set_pmu_cmdline_args_falctracedmaidx_v4; | ||
1520 | g->ops.pmu_ver.get_pmu_cmdline_args_ptr = | ||
1521 | get_pmu_cmdline_args_ptr_v4; | ||
1522 | g->ops.pmu_ver.get_pmu_allocation_struct_size = | ||
1523 | get_pmu_allocation_size_v2; | ||
1524 | g->ops.pmu_ver.set_pmu_allocation_ptr = | ||
1525 | set_pmu_allocation_ptr_v2; | ||
1526 | g->ops.pmu_ver.pmu_allocation_set_dmem_size = | ||
1527 | pmu_allocation_set_dmem_size_v2; | ||
1528 | g->ops.pmu_ver.pmu_allocation_get_dmem_size = | ||
1529 | pmu_allocation_get_dmem_size_v2; | ||
1530 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset = | ||
1531 | pmu_allocation_get_dmem_offset_v2; | ||
1532 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset_addr = | ||
1533 | pmu_allocation_get_dmem_offset_addr_v2; | ||
1534 | g->ops.pmu_ver.pmu_allocation_set_dmem_offset = | ||
1535 | pmu_allocation_set_dmem_offset_v2; | ||
1536 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
1537 | get_pmu_init_msg_pmu_queue_params_v1; | ||
1538 | g->ops.pmu_ver.get_pmu_msg_pmu_init_msg_ptr = | ||
1539 | get_pmu_msg_pmu_init_msg_ptr_v1; | ||
1540 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_off = | ||
1541 | get_pmu_init_msg_pmu_sw_mg_off_v1; | ||
1542 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_size = | ||
1543 | get_pmu_init_msg_pmu_sw_mg_size_v1; | ||
1544 | g->ops.pmu_ver.get_pmu_perfmon_cmd_start_size = | ||
1545 | get_pmu_perfmon_cmd_start_size_v2; | ||
1546 | g->ops.pmu_ver.get_perfmon_cmd_start_offsetofvar = | ||
1547 | get_perfmon_cmd_start_offsetofvar_v2; | ||
1548 | g->ops.pmu_ver.perfmon_start_set_cmd_type = | ||
1549 | perfmon_start_set_cmd_type_v2; | ||
1550 | g->ops.pmu_ver.perfmon_start_set_group_id = | ||
1551 | perfmon_start_set_group_id_v2; | ||
1552 | g->ops.pmu_ver.perfmon_start_set_state_id = | ||
1553 | perfmon_start_set_state_id_v2; | ||
1554 | g->ops.pmu_ver.perfmon_start_set_flags = | ||
1555 | perfmon_start_set_flags_v2; | ||
1556 | g->ops.pmu_ver.perfmon_start_get_flags = | ||
1557 | perfmon_start_get_flags_v2; | ||
1558 | g->ops.pmu_ver.get_pmu_perfmon_cmd_init_size = | ||
1559 | get_pmu_perfmon_cmd_init_size_v2; | ||
1560 | g->ops.pmu_ver.get_perfmon_cmd_init_offsetofvar = | ||
1561 | get_perfmon_cmd_init_offsetofvar_v2; | ||
1562 | g->ops.pmu_ver.perfmon_cmd_init_set_sample_buffer = | ||
1563 | perfmon_cmd_init_set_sample_buffer_v2; | ||
1564 | g->ops.pmu_ver.perfmon_cmd_init_set_dec_cnt = | ||
1565 | perfmon_cmd_init_set_dec_cnt_v2; | ||
1566 | g->ops.pmu_ver.perfmon_cmd_init_set_base_cnt_id = | ||
1567 | perfmon_cmd_init_set_base_cnt_id_v2; | ||
1568 | g->ops.pmu_ver.perfmon_cmd_init_set_samp_period_us = | ||
1569 | perfmon_cmd_init_set_samp_period_us_v2; | ||
1570 | g->ops.pmu_ver.perfmon_cmd_init_set_num_cnt = | ||
1571 | perfmon_cmd_init_set_num_cnt_v2; | ||
1572 | g->ops.pmu_ver.perfmon_cmd_init_set_mov_avg = | ||
1573 | perfmon_cmd_init_set_mov_avg_v2; | ||
1574 | g->ops.pmu_ver.get_pmu_seq_in_a_ptr = | ||
1575 | get_pmu_sequence_in_alloc_ptr_v1; | ||
1576 | g->ops.pmu_ver.get_pmu_seq_out_a_ptr = | ||
1577 | get_pmu_sequence_out_alloc_ptr_v1; | ||
1578 | break; | ||
1579 | case APP_VERSION_NC_3: | ||
1580 | case APP_VERSION_BIGGPU: | ||
1581 | g->ops.pmu_ver.pg_cmd_eng_buf_load_size = | ||
1582 | pg_cmd_eng_buf_load_size_v2; | ||
1583 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_cmd_type = | ||
1584 | pg_cmd_eng_buf_load_set_cmd_type_v2; | ||
1585 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_engine_id = | ||
1586 | pg_cmd_eng_buf_load_set_engine_id_v2; | ||
1587 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_idx = | ||
1588 | pg_cmd_eng_buf_load_set_buf_idx_v2; | ||
1589 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_pad = | ||
1590 | pg_cmd_eng_buf_load_set_pad_v2; | ||
1591 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_size = | ||
1592 | pg_cmd_eng_buf_load_set_buf_size_v2; | ||
1593 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_base = | ||
1594 | pg_cmd_eng_buf_load_set_dma_base_v2; | ||
1595 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_offset = | ||
1596 | pg_cmd_eng_buf_load_set_dma_offset_v2; | ||
1597 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_idx = | ||
1598 | pg_cmd_eng_buf_load_set_dma_idx_v2; | ||
1599 | g->ops.pmu_ver.get_perfmon_cntr_ptr = get_perfmon_cntr_ptr_v2; | ||
1600 | g->ops.pmu_ver.set_perfmon_cntr_ut = set_perfmon_cntr_ut_v2; | ||
1601 | g->ops.pmu_ver.set_perfmon_cntr_lt = set_perfmon_cntr_lt_v2; | ||
1602 | g->ops.pmu_ver.set_perfmon_cntr_valid = | ||
1603 | set_perfmon_cntr_valid_v2; | ||
1604 | g->ops.pmu_ver.set_perfmon_cntr_index = | ||
1605 | set_perfmon_cntr_index_v2; | ||
1606 | g->ops.pmu_ver.set_perfmon_cntr_group_id = | ||
1607 | set_perfmon_cntr_group_id_v2; | ||
1608 | g->ops.pmu_ver.get_perfmon_cntr_sz = pmu_perfmon_cntr_sz_v2; | ||
1609 | g->pmu_ver_cmd_id_zbc_table_update = 16; | ||
1610 | __nvgpu_set_enabled(g, NVGPU_PMU_ZBC_SAVE, false); | ||
1611 | g->ops.pmu_ver.get_pmu_cmdline_args_size = | ||
1612 | pmu_cmdline_size_v6; | ||
1613 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq = | ||
1614 | set_pmu_cmdline_args_cpufreq_v5; | ||
1615 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode = | ||
1616 | set_pmu_cmdline_args_secure_mode_v5; | ||
1617 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_size = | ||
1618 | set_pmu_cmdline_args_falctracesize_v5; | ||
1619 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base = | ||
1620 | set_pmu_cmdline_args_falctracedmabase_v5; | ||
1621 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx = | ||
1622 | set_pmu_cmdline_args_falctracedmaidx_v5; | ||
1623 | g->ops.pmu_ver.get_pmu_cmdline_args_ptr = | ||
1624 | get_pmu_cmdline_args_ptr_v5; | ||
1625 | g->ops.pmu_ver.get_pmu_allocation_struct_size = | ||
1626 | get_pmu_allocation_size_v3; | ||
1627 | g->ops.pmu_ver.set_pmu_allocation_ptr = | ||
1628 | set_pmu_allocation_ptr_v3; | ||
1629 | g->ops.pmu_ver.pmu_allocation_set_dmem_size = | ||
1630 | pmu_allocation_set_dmem_size_v3; | ||
1631 | g->ops.pmu_ver.pmu_allocation_get_dmem_size = | ||
1632 | pmu_allocation_get_dmem_size_v3; | ||
1633 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset = | ||
1634 | pmu_allocation_get_dmem_offset_v3; | ||
1635 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset_addr = | ||
1636 | pmu_allocation_get_dmem_offset_addr_v3; | ||
1637 | g->ops.pmu_ver.pmu_allocation_set_dmem_offset = | ||
1638 | pmu_allocation_set_dmem_offset_v3; | ||
1639 | g->ops.pmu_ver.pmu_allocation_get_fb_addr = | ||
1640 | pmu_allocation_get_fb_addr_v3; | ||
1641 | g->ops.pmu_ver.pmu_allocation_get_fb_size = | ||
1642 | pmu_allocation_get_fb_size_v3; | ||
1643 | if (pmu->desc->app_version == APP_VERSION_BIGGPU) | ||
1644 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
1645 | get_pmu_init_msg_pmu_queue_params_v5; | ||
1646 | else | ||
1647 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
1648 | get_pmu_init_msg_pmu_queue_params_v4; | ||
1649 | g->ops.pmu_ver.get_pmu_msg_pmu_init_msg_ptr = | ||
1650 | get_pmu_msg_pmu_init_msg_ptr_v4; | ||
1651 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_off = | ||
1652 | get_pmu_init_msg_pmu_sw_mg_off_v4; | ||
1653 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_size = | ||
1654 | get_pmu_init_msg_pmu_sw_mg_size_v4; | ||
1655 | g->ops.pmu_ver.get_pmu_perfmon_cmd_start_size = | ||
1656 | get_pmu_perfmon_cmd_start_size_v3; | ||
1657 | g->ops.pmu_ver.get_perfmon_cmd_start_offsetofvar = | ||
1658 | get_perfmon_cmd_start_offsetofvar_v3; | ||
1659 | g->ops.pmu_ver.perfmon_start_set_cmd_type = | ||
1660 | perfmon_start_set_cmd_type_v3; | ||
1661 | g->ops.pmu_ver.perfmon_start_set_group_id = | ||
1662 | perfmon_start_set_group_id_v3; | ||
1663 | g->ops.pmu_ver.perfmon_start_set_state_id = | ||
1664 | perfmon_start_set_state_id_v3; | ||
1665 | g->ops.pmu_ver.perfmon_start_set_flags = | ||
1666 | perfmon_start_set_flags_v3; | ||
1667 | g->ops.pmu_ver.perfmon_start_get_flags = | ||
1668 | perfmon_start_get_flags_v3; | ||
1669 | g->ops.pmu_ver.get_pmu_perfmon_cmd_init_size = | ||
1670 | get_pmu_perfmon_cmd_init_size_v3; | ||
1671 | g->ops.pmu_ver.get_perfmon_cmd_init_offsetofvar = | ||
1672 | get_perfmon_cmd_init_offsetofvar_v3; | ||
1673 | g->ops.pmu_ver.perfmon_cmd_init_set_sample_buffer = | ||
1674 | perfmon_cmd_init_set_sample_buffer_v3; | ||
1675 | g->ops.pmu_ver.perfmon_cmd_init_set_dec_cnt = | ||
1676 | perfmon_cmd_init_set_dec_cnt_v3; | ||
1677 | g->ops.pmu_ver.perfmon_cmd_init_set_base_cnt_id = | ||
1678 | perfmon_cmd_init_set_base_cnt_id_v3; | ||
1679 | g->ops.pmu_ver.perfmon_cmd_init_set_samp_period_us = | ||
1680 | perfmon_cmd_init_set_samp_period_us_v3; | ||
1681 | g->ops.pmu_ver.perfmon_cmd_init_set_num_cnt = | ||
1682 | perfmon_cmd_init_set_num_cnt_v3; | ||
1683 | g->ops.pmu_ver.perfmon_cmd_init_set_mov_avg = | ||
1684 | perfmon_cmd_init_set_mov_avg_v3; | ||
1685 | g->ops.pmu_ver.get_pmu_seq_in_a_ptr = | ||
1686 | get_pmu_sequence_in_alloc_ptr_v3; | ||
1687 | g->ops.pmu_ver.get_pmu_seq_out_a_ptr = | ||
1688 | get_pmu_sequence_out_alloc_ptr_v3; | ||
1689 | break; | ||
1690 | case APP_VERSION_GM206: | ||
1691 | case APP_VERSION_NV_GPU: | ||
1692 | case APP_VERSION_NV_GPU_1: | ||
1693 | g->ops.pmu_ver.pg_cmd_eng_buf_load_size = | ||
1694 | pg_cmd_eng_buf_load_size_v2; | ||
1695 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_cmd_type = | ||
1696 | pg_cmd_eng_buf_load_set_cmd_type_v2; | ||
1697 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_engine_id = | ||
1698 | pg_cmd_eng_buf_load_set_engine_id_v2; | ||
1699 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_idx = | ||
1700 | pg_cmd_eng_buf_load_set_buf_idx_v2; | ||
1701 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_pad = | ||
1702 | pg_cmd_eng_buf_load_set_pad_v2; | ||
1703 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_size = | ||
1704 | pg_cmd_eng_buf_load_set_buf_size_v2; | ||
1705 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_base = | ||
1706 | pg_cmd_eng_buf_load_set_dma_base_v2; | ||
1707 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_offset = | ||
1708 | pg_cmd_eng_buf_load_set_dma_offset_v2; | ||
1709 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_idx = | ||
1710 | pg_cmd_eng_buf_load_set_dma_idx_v2; | ||
1711 | g->ops.pmu_ver.get_perfmon_cntr_ptr = get_perfmon_cntr_ptr_v2; | ||
1712 | g->ops.pmu_ver.set_perfmon_cntr_ut = set_perfmon_cntr_ut_v2; | ||
1713 | g->ops.pmu_ver.set_perfmon_cntr_lt = set_perfmon_cntr_lt_v2; | ||
1714 | g->ops.pmu_ver.set_perfmon_cntr_valid = | ||
1715 | set_perfmon_cntr_valid_v2; | ||
1716 | g->ops.pmu_ver.set_perfmon_cntr_index = | ||
1717 | set_perfmon_cntr_index_v2; | ||
1718 | g->ops.pmu_ver.set_perfmon_cntr_group_id = | ||
1719 | set_perfmon_cntr_group_id_v2; | ||
1720 | g->ops.pmu_ver.get_perfmon_cntr_sz = pmu_perfmon_cntr_sz_v2; | ||
1721 | g->pmu_ver_cmd_id_zbc_table_update = 16; | ||
1722 | __nvgpu_set_enabled(g, NVGPU_PMU_ZBC_SAVE, true); | ||
1723 | g->ops.pmu_ver.get_pmu_cmdline_args_size = | ||
1724 | pmu_cmdline_size_v5; | ||
1725 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq = | ||
1726 | set_pmu_cmdline_args_cpufreq_v5; | ||
1727 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode = | ||
1728 | set_pmu_cmdline_args_secure_mode_v5; | ||
1729 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_size = | ||
1730 | set_pmu_cmdline_args_falctracesize_v5; | ||
1731 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base = | ||
1732 | set_pmu_cmdline_args_falctracedmabase_v5; | ||
1733 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx = | ||
1734 | set_pmu_cmdline_args_falctracedmaidx_v5; | ||
1735 | g->ops.pmu_ver.get_pmu_cmdline_args_ptr = | ||
1736 | get_pmu_cmdline_args_ptr_v5; | ||
1737 | g->ops.pmu_ver.get_pmu_allocation_struct_size = | ||
1738 | get_pmu_allocation_size_v3; | ||
1739 | g->ops.pmu_ver.set_pmu_allocation_ptr = | ||
1740 | set_pmu_allocation_ptr_v3; | ||
1741 | g->ops.pmu_ver.pmu_allocation_set_dmem_size = | ||
1742 | pmu_allocation_set_dmem_size_v3; | ||
1743 | g->ops.pmu_ver.pmu_allocation_get_dmem_size = | ||
1744 | pmu_allocation_get_dmem_size_v3; | ||
1745 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset = | ||
1746 | pmu_allocation_get_dmem_offset_v3; | ||
1747 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset_addr = | ||
1748 | pmu_allocation_get_dmem_offset_addr_v3; | ||
1749 | g->ops.pmu_ver.pmu_allocation_set_dmem_offset = | ||
1750 | pmu_allocation_set_dmem_offset_v3; | ||
1751 | g->ops.pmu_ver.pmu_allocation_get_fb_addr = | ||
1752 | pmu_allocation_get_fb_addr_v3; | ||
1753 | g->ops.pmu_ver.pmu_allocation_get_fb_size = | ||
1754 | pmu_allocation_get_fb_size_v3; | ||
1755 | if (pmu->desc->app_version != APP_VERSION_NV_GPU && | ||
1756 | pmu->desc->app_version != APP_VERSION_NV_GPU_1) { | ||
1757 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
1758 | get_pmu_init_msg_pmu_queue_params_v2; | ||
1759 | g->ops.pmu_ver.get_pmu_msg_pmu_init_msg_ptr = | ||
1760 | get_pmu_msg_pmu_init_msg_ptr_v2; | ||
1761 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_off = | ||
1762 | get_pmu_init_msg_pmu_sw_mg_off_v2; | ||
1763 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_size = | ||
1764 | get_pmu_init_msg_pmu_sw_mg_size_v2; | ||
1765 | } else { | ||
1766 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
1767 | get_pmu_init_msg_pmu_queue_params_v3; | ||
1768 | g->ops.pmu_ver.get_pmu_msg_pmu_init_msg_ptr = | ||
1769 | get_pmu_msg_pmu_init_msg_ptr_v3; | ||
1770 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_off = | ||
1771 | get_pmu_init_msg_pmu_sw_mg_off_v3; | ||
1772 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_size = | ||
1773 | get_pmu_init_msg_pmu_sw_mg_size_v3; | ||
1774 | } | ||
1775 | g->ops.pmu_ver.get_pmu_perfmon_cmd_start_size = | ||
1776 | get_pmu_perfmon_cmd_start_size_v3; | ||
1777 | g->ops.pmu_ver.get_perfmon_cmd_start_offsetofvar = | ||
1778 | get_perfmon_cmd_start_offsetofvar_v3; | ||
1779 | g->ops.pmu_ver.perfmon_start_set_cmd_type = | ||
1780 | perfmon_start_set_cmd_type_v3; | ||
1781 | g->ops.pmu_ver.perfmon_start_set_group_id = | ||
1782 | perfmon_start_set_group_id_v3; | ||
1783 | g->ops.pmu_ver.perfmon_start_set_state_id = | ||
1784 | perfmon_start_set_state_id_v3; | ||
1785 | g->ops.pmu_ver.perfmon_start_set_flags = | ||
1786 | perfmon_start_set_flags_v3; | ||
1787 | g->ops.pmu_ver.perfmon_start_get_flags = | ||
1788 | perfmon_start_get_flags_v3; | ||
1789 | g->ops.pmu_ver.get_pmu_perfmon_cmd_init_size = | ||
1790 | get_pmu_perfmon_cmd_init_size_v3; | ||
1791 | g->ops.pmu_ver.get_perfmon_cmd_init_offsetofvar = | ||
1792 | get_perfmon_cmd_init_offsetofvar_v3; | ||
1793 | g->ops.pmu_ver.perfmon_cmd_init_set_sample_buffer = | ||
1794 | perfmon_cmd_init_set_sample_buffer_v3; | ||
1795 | g->ops.pmu_ver.perfmon_cmd_init_set_dec_cnt = | ||
1796 | perfmon_cmd_init_set_dec_cnt_v3; | ||
1797 | g->ops.pmu_ver.perfmon_cmd_init_set_base_cnt_id = | ||
1798 | perfmon_cmd_init_set_base_cnt_id_v3; | ||
1799 | g->ops.pmu_ver.perfmon_cmd_init_set_samp_period_us = | ||
1800 | perfmon_cmd_init_set_samp_period_us_v3; | ||
1801 | g->ops.pmu_ver.perfmon_cmd_init_set_num_cnt = | ||
1802 | perfmon_cmd_init_set_num_cnt_v3; | ||
1803 | g->ops.pmu_ver.perfmon_cmd_init_set_mov_avg = | ||
1804 | perfmon_cmd_init_set_mov_avg_v3; | ||
1805 | g->ops.pmu_ver.get_pmu_seq_in_a_ptr = | ||
1806 | get_pmu_sequence_in_alloc_ptr_v3; | ||
1807 | g->ops.pmu_ver.get_pmu_seq_out_a_ptr = | ||
1808 | get_pmu_sequence_out_alloc_ptr_v3; | ||
1809 | break; | ||
1810 | case APP_VERSION_GM20B_5: | ||
1811 | case APP_VERSION_GM20B_4: | ||
1812 | g->ops.pmu_ver.pg_cmd_eng_buf_load_size = | ||
1813 | pg_cmd_eng_buf_load_size_v0; | ||
1814 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_cmd_type = | ||
1815 | pg_cmd_eng_buf_load_set_cmd_type_v0; | ||
1816 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_engine_id = | ||
1817 | pg_cmd_eng_buf_load_set_engine_id_v0; | ||
1818 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_idx = | ||
1819 | pg_cmd_eng_buf_load_set_buf_idx_v0; | ||
1820 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_pad = | ||
1821 | pg_cmd_eng_buf_load_set_pad_v0; | ||
1822 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_size = | ||
1823 | pg_cmd_eng_buf_load_set_buf_size_v0; | ||
1824 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_base = | ||
1825 | pg_cmd_eng_buf_load_set_dma_base_v0; | ||
1826 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_offset = | ||
1827 | pg_cmd_eng_buf_load_set_dma_offset_v0; | ||
1828 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_idx = | ||
1829 | pg_cmd_eng_buf_load_set_dma_idx_v0; | ||
1830 | g->ops.pmu_ver.get_perfmon_cntr_ptr = get_perfmon_cntr_ptr_v2; | ||
1831 | g->ops.pmu_ver.set_perfmon_cntr_ut = set_perfmon_cntr_ut_v2; | ||
1832 | g->ops.pmu_ver.set_perfmon_cntr_lt = set_perfmon_cntr_lt_v2; | ||
1833 | g->ops.pmu_ver.set_perfmon_cntr_valid = | ||
1834 | set_perfmon_cntr_valid_v2; | ||
1835 | g->ops.pmu_ver.set_perfmon_cntr_index = | ||
1836 | set_perfmon_cntr_index_v2; | ||
1837 | g->ops.pmu_ver.set_perfmon_cntr_group_id = | ||
1838 | set_perfmon_cntr_group_id_v2; | ||
1839 | g->ops.pmu_ver.get_perfmon_cntr_sz = pmu_perfmon_cntr_sz_v2; | ||
1840 | g->pmu_ver_cmd_id_zbc_table_update = 16; | ||
1841 | __nvgpu_set_enabled(g, NVGPU_PMU_ZBC_SAVE, true); | ||
1842 | g->ops.pmu_ver.get_pmu_cmdline_args_size = | ||
1843 | pmu_cmdline_size_v3; | ||
1844 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq = | ||
1845 | set_pmu_cmdline_args_cpufreq_v3; | ||
1846 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode = | ||
1847 | set_pmu_cmdline_args_secure_mode_v3; | ||
1848 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_size = | ||
1849 | set_pmu_cmdline_args_falctracesize_v3; | ||
1850 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base = | ||
1851 | set_pmu_cmdline_args_falctracedmabase_v3; | ||
1852 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx = | ||
1853 | set_pmu_cmdline_args_falctracedmaidx_v3; | ||
1854 | g->ops.pmu_ver.get_pmu_cmdline_args_ptr = | ||
1855 | get_pmu_cmdline_args_ptr_v3; | ||
1856 | g->ops.pmu_ver.get_pmu_allocation_struct_size = | ||
1857 | get_pmu_allocation_size_v1; | ||
1858 | g->ops.pmu_ver.set_pmu_allocation_ptr = | ||
1859 | set_pmu_allocation_ptr_v1; | ||
1860 | g->ops.pmu_ver.pmu_allocation_set_dmem_size = | ||
1861 | pmu_allocation_set_dmem_size_v1; | ||
1862 | g->ops.pmu_ver.pmu_allocation_get_dmem_size = | ||
1863 | pmu_allocation_get_dmem_size_v1; | ||
1864 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset = | ||
1865 | pmu_allocation_get_dmem_offset_v1; | ||
1866 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset_addr = | ||
1867 | pmu_allocation_get_dmem_offset_addr_v1; | ||
1868 | g->ops.pmu_ver.pmu_allocation_set_dmem_offset = | ||
1869 | pmu_allocation_set_dmem_offset_v1; | ||
1870 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
1871 | get_pmu_init_msg_pmu_queue_params_v1; | ||
1872 | g->ops.pmu_ver.get_pmu_msg_pmu_init_msg_ptr = | ||
1873 | get_pmu_msg_pmu_init_msg_ptr_v1; | ||
1874 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_off = | ||
1875 | get_pmu_init_msg_pmu_sw_mg_off_v1; | ||
1876 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_size = | ||
1877 | get_pmu_init_msg_pmu_sw_mg_size_v1; | ||
1878 | g->ops.pmu_ver.get_pmu_perfmon_cmd_start_size = | ||
1879 | get_pmu_perfmon_cmd_start_size_v1; | ||
1880 | g->ops.pmu_ver.get_perfmon_cmd_start_offsetofvar = | ||
1881 | get_perfmon_cmd_start_offsetofvar_v1; | ||
1882 | g->ops.pmu_ver.perfmon_start_set_cmd_type = | ||
1883 | perfmon_start_set_cmd_type_v1; | ||
1884 | g->ops.pmu_ver.perfmon_start_set_group_id = | ||
1885 | perfmon_start_set_group_id_v1; | ||
1886 | g->ops.pmu_ver.perfmon_start_set_state_id = | ||
1887 | perfmon_start_set_state_id_v1; | ||
1888 | g->ops.pmu_ver.perfmon_start_set_flags = | ||
1889 | perfmon_start_set_flags_v1; | ||
1890 | g->ops.pmu_ver.perfmon_start_get_flags = | ||
1891 | perfmon_start_get_flags_v1; | ||
1892 | g->ops.pmu_ver.get_pmu_perfmon_cmd_init_size = | ||
1893 | get_pmu_perfmon_cmd_init_size_v1; | ||
1894 | g->ops.pmu_ver.get_perfmon_cmd_init_offsetofvar = | ||
1895 | get_perfmon_cmd_init_offsetofvar_v1; | ||
1896 | g->ops.pmu_ver.perfmon_cmd_init_set_sample_buffer = | ||
1897 | perfmon_cmd_init_set_sample_buffer_v1; | ||
1898 | g->ops.pmu_ver.perfmon_cmd_init_set_dec_cnt = | ||
1899 | perfmon_cmd_init_set_dec_cnt_v1; | ||
1900 | g->ops.pmu_ver.perfmon_cmd_init_set_base_cnt_id = | ||
1901 | perfmon_cmd_init_set_base_cnt_id_v1; | ||
1902 | g->ops.pmu_ver.perfmon_cmd_init_set_samp_period_us = | ||
1903 | perfmon_cmd_init_set_samp_period_us_v1; | ||
1904 | g->ops.pmu_ver.perfmon_cmd_init_set_num_cnt = | ||
1905 | perfmon_cmd_init_set_num_cnt_v1; | ||
1906 | g->ops.pmu_ver.perfmon_cmd_init_set_mov_avg = | ||
1907 | perfmon_cmd_init_set_mov_avg_v1; | ||
1908 | g->ops.pmu_ver.get_pmu_seq_in_a_ptr = | ||
1909 | get_pmu_sequence_in_alloc_ptr_v1; | ||
1910 | g->ops.pmu_ver.get_pmu_seq_out_a_ptr = | ||
1911 | get_pmu_sequence_out_alloc_ptr_v1; | ||
1912 | break; | ||
1913 | case APP_VERSION_GM20B_3: | ||
1914 | case APP_VERSION_GM20B_2: | ||
1915 | g->ops.pmu_ver.pg_cmd_eng_buf_load_size = | ||
1916 | pg_cmd_eng_buf_load_size_v0; | ||
1917 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_cmd_type = | ||
1918 | pg_cmd_eng_buf_load_set_cmd_type_v0; | ||
1919 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_engine_id = | ||
1920 | pg_cmd_eng_buf_load_set_engine_id_v0; | ||
1921 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_idx = | ||
1922 | pg_cmd_eng_buf_load_set_buf_idx_v0; | ||
1923 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_pad = | ||
1924 | pg_cmd_eng_buf_load_set_pad_v0; | ||
1925 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_size = | ||
1926 | pg_cmd_eng_buf_load_set_buf_size_v0; | ||
1927 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_base = | ||
1928 | pg_cmd_eng_buf_load_set_dma_base_v0; | ||
1929 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_offset = | ||
1930 | pg_cmd_eng_buf_load_set_dma_offset_v0; | ||
1931 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_idx = | ||
1932 | pg_cmd_eng_buf_load_set_dma_idx_v0; | ||
1933 | g->ops.pmu_ver.get_perfmon_cntr_ptr = get_perfmon_cntr_ptr_v2; | ||
1934 | g->ops.pmu_ver.set_perfmon_cntr_ut = set_perfmon_cntr_ut_v2; | ||
1935 | g->ops.pmu_ver.set_perfmon_cntr_lt = set_perfmon_cntr_lt_v2; | ||
1936 | g->ops.pmu_ver.set_perfmon_cntr_valid = | ||
1937 | set_perfmon_cntr_valid_v2; | ||
1938 | g->ops.pmu_ver.set_perfmon_cntr_index = | ||
1939 | set_perfmon_cntr_index_v2; | ||
1940 | g->ops.pmu_ver.set_perfmon_cntr_group_id = | ||
1941 | set_perfmon_cntr_group_id_v2; | ||
1942 | g->ops.pmu_ver.get_perfmon_cntr_sz = pmu_perfmon_cntr_sz_v2; | ||
1943 | g->pmu_ver_cmd_id_zbc_table_update = 16; | ||
1944 | __nvgpu_set_enabled(g, NVGPU_PMU_ZBC_SAVE, true); | ||
1945 | g->ops.pmu_ver.get_pmu_cmdline_args_size = | ||
1946 | pmu_cmdline_size_v2; | ||
1947 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq = | ||
1948 | set_pmu_cmdline_args_cpufreq_v2; | ||
1949 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode = | ||
1950 | set_pmu_cmdline_args_secure_mode_v2; | ||
1951 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_size = | ||
1952 | set_pmu_cmdline_args_falctracesize_v2; | ||
1953 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base = | ||
1954 | set_pmu_cmdline_args_falctracedmabase_v2; | ||
1955 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx = | ||
1956 | set_pmu_cmdline_args_falctracedmaidx_v2; | ||
1957 | g->ops.pmu_ver.get_pmu_cmdline_args_ptr = | ||
1958 | get_pmu_cmdline_args_ptr_v2; | ||
1959 | g->ops.pmu_ver.get_pmu_allocation_struct_size = | ||
1960 | get_pmu_allocation_size_v1; | ||
1961 | g->ops.pmu_ver.set_pmu_allocation_ptr = | ||
1962 | set_pmu_allocation_ptr_v1; | ||
1963 | g->ops.pmu_ver.pmu_allocation_set_dmem_size = | ||
1964 | pmu_allocation_set_dmem_size_v1; | ||
1965 | g->ops.pmu_ver.pmu_allocation_get_dmem_size = | ||
1966 | pmu_allocation_get_dmem_size_v1; | ||
1967 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset = | ||
1968 | pmu_allocation_get_dmem_offset_v1; | ||
1969 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset_addr = | ||
1970 | pmu_allocation_get_dmem_offset_addr_v1; | ||
1971 | g->ops.pmu_ver.pmu_allocation_set_dmem_offset = | ||
1972 | pmu_allocation_set_dmem_offset_v1; | ||
1973 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
1974 | get_pmu_init_msg_pmu_queue_params_v1; | ||
1975 | g->ops.pmu_ver.get_pmu_msg_pmu_init_msg_ptr = | ||
1976 | get_pmu_msg_pmu_init_msg_ptr_v1; | ||
1977 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_off = | ||
1978 | get_pmu_init_msg_pmu_sw_mg_off_v1; | ||
1979 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_size = | ||
1980 | get_pmu_init_msg_pmu_sw_mg_size_v1; | ||
1981 | g->ops.pmu_ver.get_pmu_perfmon_cmd_start_size = | ||
1982 | get_pmu_perfmon_cmd_start_size_v1; | ||
1983 | g->ops.pmu_ver.get_perfmon_cmd_start_offsetofvar = | ||
1984 | get_perfmon_cmd_start_offsetofvar_v1; | ||
1985 | g->ops.pmu_ver.perfmon_start_set_cmd_type = | ||
1986 | perfmon_start_set_cmd_type_v1; | ||
1987 | g->ops.pmu_ver.perfmon_start_set_group_id = | ||
1988 | perfmon_start_set_group_id_v1; | ||
1989 | g->ops.pmu_ver.perfmon_start_set_state_id = | ||
1990 | perfmon_start_set_state_id_v1; | ||
1991 | g->ops.pmu_ver.perfmon_start_set_flags = | ||
1992 | perfmon_start_set_flags_v1; | ||
1993 | g->ops.pmu_ver.perfmon_start_get_flags = | ||
1994 | perfmon_start_get_flags_v1; | ||
1995 | g->ops.pmu_ver.get_pmu_perfmon_cmd_init_size = | ||
1996 | get_pmu_perfmon_cmd_init_size_v1; | ||
1997 | g->ops.pmu_ver.get_perfmon_cmd_init_offsetofvar = | ||
1998 | get_perfmon_cmd_init_offsetofvar_v1; | ||
1999 | g->ops.pmu_ver.perfmon_cmd_init_set_sample_buffer = | ||
2000 | perfmon_cmd_init_set_sample_buffer_v1; | ||
2001 | g->ops.pmu_ver.perfmon_cmd_init_set_dec_cnt = | ||
2002 | perfmon_cmd_init_set_dec_cnt_v1; | ||
2003 | g->ops.pmu_ver.perfmon_cmd_init_set_base_cnt_id = | ||
2004 | perfmon_cmd_init_set_base_cnt_id_v1; | ||
2005 | g->ops.pmu_ver.perfmon_cmd_init_set_samp_period_us = | ||
2006 | perfmon_cmd_init_set_samp_period_us_v1; | ||
2007 | g->ops.pmu_ver.perfmon_cmd_init_set_num_cnt = | ||
2008 | perfmon_cmd_init_set_num_cnt_v1; | ||
2009 | g->ops.pmu_ver.perfmon_cmd_init_set_mov_avg = | ||
2010 | perfmon_cmd_init_set_mov_avg_v1; | ||
2011 | g->ops.pmu_ver.get_pmu_seq_in_a_ptr = | ||
2012 | get_pmu_sequence_in_alloc_ptr_v1; | ||
2013 | g->ops.pmu_ver.get_pmu_seq_out_a_ptr = | ||
2014 | get_pmu_sequence_out_alloc_ptr_v1; | ||
2015 | break; | ||
2016 | case APP_VERSION_GM20B_1: | ||
2017 | case APP_VERSION_GM20B: | ||
2018 | case APP_VERSION_1: | ||
2019 | case APP_VERSION_2: | ||
2020 | case APP_VERSION_3: | ||
2021 | g->ops.pmu_ver.pg_cmd_eng_buf_load_size = | ||
2022 | pg_cmd_eng_buf_load_size_v0; | ||
2023 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_cmd_type = | ||
2024 | pg_cmd_eng_buf_load_set_cmd_type_v0; | ||
2025 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_engine_id = | ||
2026 | pg_cmd_eng_buf_load_set_engine_id_v0; | ||
2027 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_idx = | ||
2028 | pg_cmd_eng_buf_load_set_buf_idx_v0; | ||
2029 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_pad = | ||
2030 | pg_cmd_eng_buf_load_set_pad_v0; | ||
2031 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_size = | ||
2032 | pg_cmd_eng_buf_load_set_buf_size_v0; | ||
2033 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_base = | ||
2034 | pg_cmd_eng_buf_load_set_dma_base_v0; | ||
2035 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_offset = | ||
2036 | pg_cmd_eng_buf_load_set_dma_offset_v0; | ||
2037 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_idx = | ||
2038 | pg_cmd_eng_buf_load_set_dma_idx_v0; | ||
2039 | g->pmu_ver_cmd_id_zbc_table_update = 16; | ||
2040 | __nvgpu_set_enabled(g, NVGPU_PMU_ZBC_SAVE, true); | ||
2041 | g->ops.pmu_ver.get_perfmon_cntr_ptr = get_perfmon_cntr_ptr_v0; | ||
2042 | g->ops.pmu_ver.set_perfmon_cntr_ut = set_perfmon_cntr_ut_v0; | ||
2043 | g->ops.pmu_ver.set_perfmon_cntr_lt = set_perfmon_cntr_lt_v0; | ||
2044 | g->ops.pmu_ver.set_perfmon_cntr_valid = | ||
2045 | set_perfmon_cntr_valid_v0; | ||
2046 | g->ops.pmu_ver.set_perfmon_cntr_index = | ||
2047 | set_perfmon_cntr_index_v0; | ||
2048 | g->ops.pmu_ver.set_perfmon_cntr_group_id = | ||
2049 | set_perfmon_cntr_group_id_v0; | ||
2050 | g->ops.pmu_ver.get_perfmon_cntr_sz = pmu_perfmon_cntr_sz_v0; | ||
2051 | g->ops.pmu_ver.get_pmu_cmdline_args_size = | ||
2052 | pmu_cmdline_size_v1; | ||
2053 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq = | ||
2054 | set_pmu_cmdline_args_cpufreq_v1; | ||
2055 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode = | ||
2056 | set_pmu_cmdline_args_secure_mode_v1; | ||
2057 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_size = | ||
2058 | set_pmu_cmdline_args_falctracesize_v1; | ||
2059 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base = | ||
2060 | set_pmu_cmdline_args_falctracedmabase_v1; | ||
2061 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx = | ||
2062 | set_pmu_cmdline_args_falctracedmaidx_v1; | ||
2063 | g->ops.pmu_ver.get_pmu_cmdline_args_ptr = | ||
2064 | get_pmu_cmdline_args_ptr_v1; | ||
2065 | g->ops.pmu_ver.get_pmu_allocation_struct_size = | ||
2066 | get_pmu_allocation_size_v1; | ||
2067 | g->ops.pmu_ver.set_pmu_allocation_ptr = | ||
2068 | set_pmu_allocation_ptr_v1; | ||
2069 | g->ops.pmu_ver.pmu_allocation_set_dmem_size = | ||
2070 | pmu_allocation_set_dmem_size_v1; | ||
2071 | g->ops.pmu_ver.pmu_allocation_get_dmem_size = | ||
2072 | pmu_allocation_get_dmem_size_v1; | ||
2073 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset = | ||
2074 | pmu_allocation_get_dmem_offset_v1; | ||
2075 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset_addr = | ||
2076 | pmu_allocation_get_dmem_offset_addr_v1; | ||
2077 | g->ops.pmu_ver.pmu_allocation_set_dmem_offset = | ||
2078 | pmu_allocation_set_dmem_offset_v1; | ||
2079 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
2080 | get_pmu_init_msg_pmu_queue_params_v1; | ||
2081 | g->ops.pmu_ver.get_pmu_msg_pmu_init_msg_ptr = | ||
2082 | get_pmu_msg_pmu_init_msg_ptr_v1; | ||
2083 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_off = | ||
2084 | get_pmu_init_msg_pmu_sw_mg_off_v1; | ||
2085 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_size = | ||
2086 | get_pmu_init_msg_pmu_sw_mg_size_v1; | ||
2087 | g->ops.pmu_ver.get_pmu_perfmon_cmd_start_size = | ||
2088 | get_pmu_perfmon_cmd_start_size_v1; | ||
2089 | g->ops.pmu_ver.get_perfmon_cmd_start_offsetofvar = | ||
2090 | get_perfmon_cmd_start_offsetofvar_v1; | ||
2091 | g->ops.pmu_ver.perfmon_start_set_cmd_type = | ||
2092 | perfmon_start_set_cmd_type_v1; | ||
2093 | g->ops.pmu_ver.perfmon_start_set_group_id = | ||
2094 | perfmon_start_set_group_id_v1; | ||
2095 | g->ops.pmu_ver.perfmon_start_set_state_id = | ||
2096 | perfmon_start_set_state_id_v1; | ||
2097 | g->ops.pmu_ver.perfmon_start_set_flags = | ||
2098 | perfmon_start_set_flags_v1; | ||
2099 | g->ops.pmu_ver.perfmon_start_get_flags = | ||
2100 | perfmon_start_get_flags_v1; | ||
2101 | g->ops.pmu_ver.get_pmu_perfmon_cmd_init_size = | ||
2102 | get_pmu_perfmon_cmd_init_size_v1; | ||
2103 | g->ops.pmu_ver.get_perfmon_cmd_init_offsetofvar = | ||
2104 | get_perfmon_cmd_init_offsetofvar_v1; | ||
2105 | g->ops.pmu_ver.perfmon_cmd_init_set_sample_buffer = | ||
2106 | perfmon_cmd_init_set_sample_buffer_v1; | ||
2107 | g->ops.pmu_ver.perfmon_cmd_init_set_dec_cnt = | ||
2108 | perfmon_cmd_init_set_dec_cnt_v1; | ||
2109 | g->ops.pmu_ver.perfmon_cmd_init_set_base_cnt_id = | ||
2110 | perfmon_cmd_init_set_base_cnt_id_v1; | ||
2111 | g->ops.pmu_ver.perfmon_cmd_init_set_samp_period_us = | ||
2112 | perfmon_cmd_init_set_samp_period_us_v1; | ||
2113 | g->ops.pmu_ver.perfmon_cmd_init_set_num_cnt = | ||
2114 | perfmon_cmd_init_set_num_cnt_v1; | ||
2115 | g->ops.pmu_ver.perfmon_cmd_init_set_mov_avg = | ||
2116 | perfmon_cmd_init_set_mov_avg_v1; | ||
2117 | g->ops.pmu_ver.get_pmu_seq_in_a_ptr = | ||
2118 | get_pmu_sequence_in_alloc_ptr_v1; | ||
2119 | g->ops.pmu_ver.get_pmu_seq_out_a_ptr = | ||
2120 | get_pmu_sequence_out_alloc_ptr_v1; | ||
2121 | break; | ||
2122 | case APP_VERSION_0: | ||
2123 | g->ops.pmu_ver.pg_cmd_eng_buf_load_size = | ||
2124 | pg_cmd_eng_buf_load_size_v0; | ||
2125 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_cmd_type = | ||
2126 | pg_cmd_eng_buf_load_set_cmd_type_v0; | ||
2127 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_engine_id = | ||
2128 | pg_cmd_eng_buf_load_set_engine_id_v0; | ||
2129 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_idx = | ||
2130 | pg_cmd_eng_buf_load_set_buf_idx_v0; | ||
2131 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_pad = | ||
2132 | pg_cmd_eng_buf_load_set_pad_v0; | ||
2133 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_buf_size = | ||
2134 | pg_cmd_eng_buf_load_set_buf_size_v0; | ||
2135 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_base = | ||
2136 | pg_cmd_eng_buf_load_set_dma_base_v0; | ||
2137 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_offset = | ||
2138 | pg_cmd_eng_buf_load_set_dma_offset_v0; | ||
2139 | g->ops.pmu_ver.pg_cmd_eng_buf_load_set_dma_idx = | ||
2140 | pg_cmd_eng_buf_load_set_dma_idx_v0; | ||
2141 | g->pmu_ver_cmd_id_zbc_table_update = 14; | ||
2142 | __nvgpu_set_enabled(g, NVGPU_PMU_ZBC_SAVE, true); | ||
2143 | g->ops.pmu_ver.get_perfmon_cntr_ptr = get_perfmon_cntr_ptr_v0; | ||
2144 | g->ops.pmu_ver.set_perfmon_cntr_ut = set_perfmon_cntr_ut_v0; | ||
2145 | g->ops.pmu_ver.set_perfmon_cntr_lt = set_perfmon_cntr_lt_v0; | ||
2146 | g->ops.pmu_ver.set_perfmon_cntr_valid = | ||
2147 | set_perfmon_cntr_valid_v0; | ||
2148 | g->ops.pmu_ver.set_perfmon_cntr_index = | ||
2149 | set_perfmon_cntr_index_v0; | ||
2150 | g->ops.pmu_ver.set_perfmon_cntr_group_id = | ||
2151 | set_perfmon_cntr_group_id_v0; | ||
2152 | g->ops.pmu_ver.get_perfmon_cntr_sz = pmu_perfmon_cntr_sz_v0; | ||
2153 | g->ops.pmu_ver.get_pmu_cmdline_args_size = | ||
2154 | pmu_cmdline_size_v0; | ||
2155 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq = | ||
2156 | set_pmu_cmdline_args_cpufreq_v0; | ||
2157 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode = | ||
2158 | NULL; | ||
2159 | g->ops.pmu_ver.get_pmu_cmdline_args_ptr = | ||
2160 | get_pmu_cmdline_args_ptr_v0; | ||
2161 | g->ops.pmu_ver.get_pmu_allocation_struct_size = | ||
2162 | get_pmu_allocation_size_v0; | ||
2163 | g->ops.pmu_ver.set_pmu_allocation_ptr = | ||
2164 | set_pmu_allocation_ptr_v0; | ||
2165 | g->ops.pmu_ver.pmu_allocation_set_dmem_size = | ||
2166 | pmu_allocation_set_dmem_size_v0; | ||
2167 | g->ops.pmu_ver.pmu_allocation_get_dmem_size = | ||
2168 | pmu_allocation_get_dmem_size_v0; | ||
2169 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset = | ||
2170 | pmu_allocation_get_dmem_offset_v0; | ||
2171 | g->ops.pmu_ver.pmu_allocation_get_dmem_offset_addr = | ||
2172 | pmu_allocation_get_dmem_offset_addr_v0; | ||
2173 | g->ops.pmu_ver.pmu_allocation_set_dmem_offset = | ||
2174 | pmu_allocation_set_dmem_offset_v0; | ||
2175 | g->ops.pmu_ver.get_pmu_init_msg_pmu_queue_params = | ||
2176 | get_pmu_init_msg_pmu_queue_params_v0; | ||
2177 | g->ops.pmu_ver.get_pmu_msg_pmu_init_msg_ptr = | ||
2178 | get_pmu_msg_pmu_init_msg_ptr_v0; | ||
2179 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_off = | ||
2180 | get_pmu_init_msg_pmu_sw_mg_off_v0; | ||
2181 | g->ops.pmu_ver.get_pmu_init_msg_pmu_sw_mg_size = | ||
2182 | get_pmu_init_msg_pmu_sw_mg_size_v0; | ||
2183 | g->ops.pmu_ver.get_pmu_perfmon_cmd_start_size = | ||
2184 | get_pmu_perfmon_cmd_start_size_v0; | ||
2185 | g->ops.pmu_ver.get_perfmon_cmd_start_offsetofvar = | ||
2186 | get_perfmon_cmd_start_offsetofvar_v0; | ||
2187 | g->ops.pmu_ver.perfmon_start_set_cmd_type = | ||
2188 | perfmon_start_set_cmd_type_v0; | ||
2189 | g->ops.pmu_ver.perfmon_start_set_group_id = | ||
2190 | perfmon_start_set_group_id_v0; | ||
2191 | g->ops.pmu_ver.perfmon_start_set_state_id = | ||
2192 | perfmon_start_set_state_id_v0; | ||
2193 | g->ops.pmu_ver.perfmon_start_set_flags = | ||
2194 | perfmon_start_set_flags_v0; | ||
2195 | g->ops.pmu_ver.perfmon_start_get_flags = | ||
2196 | perfmon_start_get_flags_v0; | ||
2197 | g->ops.pmu_ver.get_pmu_perfmon_cmd_init_size = | ||
2198 | get_pmu_perfmon_cmd_init_size_v0; | ||
2199 | g->ops.pmu_ver.get_perfmon_cmd_init_offsetofvar = | ||
2200 | get_perfmon_cmd_init_offsetofvar_v0; | ||
2201 | g->ops.pmu_ver.perfmon_cmd_init_set_sample_buffer = | ||
2202 | perfmon_cmd_init_set_sample_buffer_v0; | ||
2203 | g->ops.pmu_ver.perfmon_cmd_init_set_dec_cnt = | ||
2204 | perfmon_cmd_init_set_dec_cnt_v0; | ||
2205 | g->ops.pmu_ver.perfmon_cmd_init_set_base_cnt_id = | ||
2206 | perfmon_cmd_init_set_base_cnt_id_v0; | ||
2207 | g->ops.pmu_ver.perfmon_cmd_init_set_samp_period_us = | ||
2208 | perfmon_cmd_init_set_samp_period_us_v0; | ||
2209 | g->ops.pmu_ver.perfmon_cmd_init_set_num_cnt = | ||
2210 | perfmon_cmd_init_set_num_cnt_v0; | ||
2211 | g->ops.pmu_ver.perfmon_cmd_init_set_mov_avg = | ||
2212 | perfmon_cmd_init_set_mov_avg_v0; | ||
2213 | g->ops.pmu_ver.get_pmu_seq_in_a_ptr = | ||
2214 | get_pmu_sequence_in_alloc_ptr_v0; | ||
2215 | g->ops.pmu_ver.get_pmu_seq_out_a_ptr = | ||
2216 | get_pmu_sequence_out_alloc_ptr_v0; | ||
2217 | break; | ||
2218 | default: | ||
2219 | nvgpu_err(g, "PMU code version not supported version: %d\n", | ||
2220 | pmu->desc->app_version); | ||
2221 | err = -EINVAL; | ||
2222 | } | ||
2223 | pv->set_perfmon_cntr_index(pmu, 3); /* GR & CE2 */ | ||
2224 | pv->set_perfmon_cntr_group_id(pmu, PMU_DOMAIN_GROUP_PSTATE); | ||
2225 | |||
2226 | return err; | ||
2227 | } | ||
2228 | |||
2229 | static void nvgpu_remove_pmu_support(struct nvgpu_pmu *pmu) | ||
2230 | { | ||
2231 | struct gk20a *g = gk20a_from_pmu(pmu); | ||
2232 | struct mm_gk20a *mm = &g->mm; | ||
2233 | struct vm_gk20a *vm = mm->pmu.vm; | ||
2234 | struct boardobj *pboardobj, *pboardobj_tmp; | ||
2235 | struct boardobjgrp *pboardobjgrp, *pboardobjgrp_tmp; | ||
2236 | |||
2237 | nvgpu_log_fn(g, " "); | ||
2238 | |||
2239 | if (nvgpu_alloc_initialized(&pmu->dmem)) | ||
2240 | nvgpu_alloc_destroy(&pmu->dmem); | ||
2241 | |||
2242 | nvgpu_list_for_each_entry_safe(pboardobjgrp, pboardobjgrp_tmp, | ||
2243 | &g->boardobjgrp_head, boardobjgrp, node) { | ||
2244 | pboardobjgrp->destruct(pboardobjgrp); | ||
2245 | } | ||
2246 | |||
2247 | nvgpu_list_for_each_entry_safe(pboardobj, pboardobj_tmp, | ||
2248 | &g->boardobj_head, boardobj, node) { | ||
2249 | pboardobj->destruct(pboardobj); | ||
2250 | } | ||
2251 | |||
2252 | if (pmu->fw) | ||
2253 | nvgpu_release_firmware(g, pmu->fw); | ||
2254 | |||
2255 | if (g->acr.pmu_fw) | ||
2256 | nvgpu_release_firmware(g, g->acr.pmu_fw); | ||
2257 | |||
2258 | if (g->acr.pmu_desc) | ||
2259 | nvgpu_release_firmware(g, g->acr.pmu_desc); | ||
2260 | |||
2261 | if (g->acr.acr_fw) | ||
2262 | nvgpu_release_firmware(g, g->acr.acr_fw); | ||
2263 | |||
2264 | if (g->acr.hsbl_fw) | ||
2265 | nvgpu_release_firmware(g, g->acr.hsbl_fw); | ||
2266 | |||
2267 | nvgpu_dma_unmap_free(vm, &g->acr.acr_ucode); | ||
2268 | nvgpu_dma_unmap_free(vm, &g->acr.hsbl_ucode); | ||
2269 | |||
2270 | nvgpu_dma_unmap_free(vm, &pmu->seq_buf); | ||
2271 | |||
2272 | nvgpu_mutex_destroy(&pmu->elpg_mutex); | ||
2273 | nvgpu_mutex_destroy(&pmu->pg_mutex); | ||
2274 | nvgpu_mutex_destroy(&pmu->isr_mutex); | ||
2275 | nvgpu_mutex_destroy(&pmu->pmu_copy_lock); | ||
2276 | nvgpu_mutex_destroy(&pmu->pmu_seq_lock); | ||
2277 | } | ||
2278 | |||
2279 | int nvgpu_init_pmu_fw_support(struct nvgpu_pmu *pmu) | ||
2280 | { | ||
2281 | struct gk20a *g = gk20a_from_pmu(pmu); | ||
2282 | int err = 0; | ||
2283 | |||
2284 | nvgpu_log_fn(g, " "); | ||
2285 | |||
2286 | err = nvgpu_mutex_init(&pmu->elpg_mutex); | ||
2287 | if (err) | ||
2288 | return err; | ||
2289 | |||
2290 | err = nvgpu_mutex_init(&pmu->pg_mutex); | ||
2291 | if (err) | ||
2292 | goto fail_elpg; | ||
2293 | |||
2294 | err = nvgpu_mutex_init(&pmu->isr_mutex); | ||
2295 | if (err) | ||
2296 | goto fail_pg; | ||
2297 | |||
2298 | err = nvgpu_mutex_init(&pmu->pmu_copy_lock); | ||
2299 | if (err) | ||
2300 | goto fail_isr; | ||
2301 | |||
2302 | err = nvgpu_mutex_init(&pmu->pmu_seq_lock); | ||
2303 | if (err) | ||
2304 | goto fail_pmu_copy; | ||
2305 | |||
2306 | pmu->remove_support = nvgpu_remove_pmu_support; | ||
2307 | |||
2308 | err = nvgpu_init_pmu_fw_ver_ops(pmu); | ||
2309 | if (err) | ||
2310 | goto fail_pmu_seq; | ||
2311 | |||
2312 | goto exit; | ||
2313 | |||
2314 | fail_pmu_seq: | ||
2315 | nvgpu_mutex_destroy(&pmu->pmu_seq_lock); | ||
2316 | fail_pmu_copy: | ||
2317 | nvgpu_mutex_destroy(&pmu->pmu_copy_lock); | ||
2318 | fail_isr: | ||
2319 | nvgpu_mutex_destroy(&pmu->isr_mutex); | ||
2320 | fail_pg: | ||
2321 | nvgpu_mutex_destroy(&pmu->pg_mutex); | ||
2322 | fail_elpg: | ||
2323 | nvgpu_mutex_destroy(&pmu->elpg_mutex); | ||
2324 | exit: | ||
2325 | return err; | ||
2326 | } | ||
2327 | |||
2328 | int nvgpu_pmu_prepare_ns_ucode_blob(struct gk20a *g) | ||
2329 | { | ||
2330 | struct nvgpu_pmu *pmu = &g->pmu; | ||
2331 | int err = 0; | ||
2332 | struct mm_gk20a *mm = &g->mm; | ||
2333 | struct vm_gk20a *vm = mm->pmu.vm; | ||
2334 | |||
2335 | nvgpu_log_fn(g, " "); | ||
2336 | |||
2337 | if (pmu->fw) | ||
2338 | return nvgpu_init_pmu_fw_support(pmu); | ||
2339 | |||
2340 | pmu->fw = nvgpu_request_firmware(g, NVGPU_PMU_NS_UCODE_IMAGE, 0); | ||
2341 | if (!pmu->fw) { | ||
2342 | nvgpu_err(g, "failed to load pmu ucode!!"); | ||
2343 | return err; | ||
2344 | } | ||
2345 | |||
2346 | nvgpu_log_fn(g, "firmware loaded"); | ||
2347 | |||
2348 | pmu->desc = (struct pmu_ucode_desc *)pmu->fw->data; | ||
2349 | pmu->ucode_image = (u32 *)((u8 *)pmu->desc + | ||
2350 | pmu->desc->descriptor_size); | ||
2351 | |||
2352 | err = nvgpu_dma_alloc_map_sys(vm, GK20A_PMU_UCODE_SIZE_MAX, | ||
2353 | &pmu->ucode); | ||
2354 | if (err) | ||
2355 | goto err_release_fw; | ||
2356 | |||
2357 | nvgpu_mem_wr_n(g, &pmu->ucode, 0, pmu->ucode_image, | ||
2358 | pmu->desc->app_start_offset + pmu->desc->app_size); | ||
2359 | |||
2360 | return nvgpu_init_pmu_fw_support(pmu); | ||
2361 | |||
2362 | err_release_fw: | ||
2363 | nvgpu_release_firmware(g, pmu->fw); | ||
2364 | pmu->fw = NULL; | ||
2365 | |||
2366 | return err; | ||
2367 | } | ||
2368 | |||