diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/Makefile | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/fecs_trace_gp10b.c | 53 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/fecs_trace_gp10b.h | 23 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 17 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hw_ctxsw_prog_gp10b.h | 184 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hw_timer_gp10b.h | 2 |
8 files changed, 283 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index c4873257..c29173f5 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile | |||
@@ -16,6 +16,7 @@ nvgpu-y += \ | |||
16 | $(nvgpu-t18x)/gp10b/regops_gp10b.o \ | 16 | $(nvgpu-t18x)/gp10b/regops_gp10b.o \ |
17 | $(nvgpu-t18x)/gp10b/cde_gp10b.o \ | 17 | $(nvgpu-t18x)/gp10b/cde_gp10b.o \ |
18 | $(nvgpu-t18x)/gp10b/therm_gp10b.o \ | 18 | $(nvgpu-t18x)/gp10b/therm_gp10b.o \ |
19 | $(nvgpu-t18x)/gp10b/fecs_trace_gp10b.o \ | ||
19 | $(nvgpu-t18x)/gp10b/gp10b_sysfs.o | 20 | $(nvgpu-t18x)/gp10b/gp10b_sysfs.o |
20 | 21 | ||
21 | nvgpu-$(CONFIG_TEGRA_GK20A) += $(nvgpu-t18x)/gp10b/platform_gp10b_tegra.o | 22 | nvgpu-$(CONFIG_TEGRA_GK20A) += $(nvgpu-t18x)/gp10b/platform_gp10b_tegra.o |
diff --git a/drivers/gpu/nvgpu/gp10b/fecs_trace_gp10b.c b/drivers/gpu/nvgpu/gp10b/fecs_trace_gp10b.c new file mode 100644 index 00000000..7dd200a9 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/fecs_trace_gp10b.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * GP10B GPU FECS traces | ||
3 | * | ||
4 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include "gk20a/gk20a.h" | ||
17 | #include "gk20a/fecs_trace_gk20a.h" | ||
18 | #include "gp10b/hw_ctxsw_prog_gp10b.h" | ||
19 | #include "gp10b/hw_gr_gp10b.h" | ||
20 | |||
21 | #ifdef CONFIG_GK20A_CTXSW_TRACE | ||
22 | static int gp10b_fecs_trace_flush(struct gk20a *g) | ||
23 | { | ||
24 | struct fecs_method_op_gk20a op = { | ||
25 | .mailbox = { .id = 0, .data = 0, | ||
26 | .clr = ~0, .ok = 0, .fail = 0}, | ||
27 | .method.addr = gr_fecs_method_push_adr_write_timestamp_record_v(), | ||
28 | .method.data = 0, | ||
29 | .cond.ok = GR_IS_UCODE_OP_NOT_EQUAL, | ||
30 | .cond.fail = GR_IS_UCODE_OP_SKIP, | ||
31 | }; | ||
32 | int err; | ||
33 | |||
34 | gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, ""); | ||
35 | |||
36 | err = gr_gk20a_elpg_protected_call(g, | ||
37 | gr_gk20a_submit_fecs_method_op(g, op, false)); | ||
38 | if (err) | ||
39 | gk20a_err(dev_from_gk20a(g), "write timestamp record failed"); | ||
40 | |||
41 | return err; | ||
42 | } | ||
43 | |||
44 | void gp10b_init_fecs_trace_ops(struct gpu_ops *ops) | ||
45 | { | ||
46 | gk20a_init_fecs_trace_ops(ops); | ||
47 | ops->fecs_trace.flush = gp10b_fecs_trace_flush; | ||
48 | } | ||
49 | #else | ||
50 | void gp10b_init_fecs_trace_ops(struct gpu_ops *ops) | ||
51 | { | ||
52 | } | ||
53 | #endif /* CONFIG_GK20A_CTXSW_TRACE */ | ||
diff --git a/drivers/gpu/nvgpu/gp10b/fecs_trace_gp10b.h b/drivers/gpu/nvgpu/gp10b/fecs_trace_gp10b.h new file mode 100644 index 00000000..2a25f4f6 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/fecs_trace_gp10b.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * GP10B GPU FECS traces | ||
3 | * | ||
4 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef _NVGPU_FECS_TRACE_GP10B_H_ | ||
17 | #define _NVGPU_FECS_TRACE_GP10B_H_ | ||
18 | |||
19 | struct gpu_ops; | ||
20 | |||
21 | int gp10b_init_fecs_trace_ops(struct gpu_ops *); | ||
22 | |||
23 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 9eea7d43..f2308ab5 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |||
@@ -902,6 +902,23 @@ static void dump_ctx_switch_stats(struct gk20a *g, struct vm_gk20a *vm, | |||
902 | WARN_ON("Cannot map context"); | 902 | WARN_ON("Cannot map context"); |
903 | return; | 903 | return; |
904 | } | 904 | } |
905 | gk20a_err(dev_from_gk20a(g), "ctxsw_prog_main_image_magic_value_o : %x (expect %x)\n", | ||
906 | gk20a_mem_rd32(ctx_ptr + | ||
907 | ctxsw_prog_main_image_magic_value_o(), 0), | ||
908 | ctxsw_prog_main_image_magic_value_v_value_v()); | ||
909 | |||
910 | gk20a_err(dev_from_gk20a(g), "ctxsw_prog_main_image_context_timestamp_buffer_ptr_hi : %x\n", | ||
911 | gk20a_mem_rd32(ctx_ptr + | ||
912 | ctxsw_prog_main_image_context_timestamp_buffer_ptr_hi_o(), 0)); | ||
913 | |||
914 | gk20a_err(dev_from_gk20a(g), "ctxsw_prog_main_image_context_timestamp_buffer_ptr : %x\n", | ||
915 | gk20a_mem_rd32(ctx_ptr + | ||
916 | ctxsw_prog_main_image_context_timestamp_buffer_ptr_o(), 0)); | ||
917 | |||
918 | gk20a_err(dev_from_gk20a(g), "ctxsw_prog_main_image_context_timestamp_buffer_control : %x\n", | ||
919 | gk20a_mem_rd32(ctx_ptr + | ||
920 | ctxsw_prog_main_image_context_timestamp_buffer_control_o(), 0)); | ||
921 | |||
905 | gk20a_err(dev_from_gk20a(g), "NUM_SAVE_OPERATIONS : %d\n", | 922 | gk20a_err(dev_from_gk20a(g), "NUM_SAVE_OPERATIONS : %d\n", |
906 | gk20a_mem_rd32(ctx_ptr + | 923 | gk20a_mem_rd32(ctx_ptr + |
907 | ctxsw_prog_main_image_num_save_ops_o(), 0)); | 924 | ctxsw_prog_main_image_num_save_ops_o(), 0)); |
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 37fad41a..4f67cb09 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "gk20a/gk20a.h" | 21 | #include "gk20a/gk20a.h" |
22 | 22 | ||
23 | #include "gp10b/gr_gp10b.h" | 23 | #include "gp10b/gr_gp10b.h" |
24 | #include "gp10b/fecs_trace_gp10b.h" | ||
24 | #include "gp10b/mc_gp10b.h" | 25 | #include "gp10b/mc_gp10b.h" |
25 | #include "gp10b/ltc_gp10b.h" | 26 | #include "gp10b/ltc_gp10b.h" |
26 | #include "gp10b/mm_gp10b.h" | 27 | #include "gp10b/mm_gp10b.h" |
@@ -139,6 +140,7 @@ int gp10b_init_hal(struct gk20a *g) | |||
139 | 140 | ||
140 | gp10b_init_mc(gops); | 141 | gp10b_init_mc(gops); |
141 | gp10b_init_gr(gops); | 142 | gp10b_init_gr(gops); |
143 | gp10b_init_fecs_trace_ops(gops); | ||
142 | gp10b_init_ltc(gops); | 144 | gp10b_init_ltc(gops); |
143 | gp10b_init_fb(gops); | 145 | gp10b_init_fb(gops); |
144 | gp10b_init_fifo(gops); | 146 | gp10b_init_fifo(gops); |
diff --git a/drivers/gpu/nvgpu/gp10b/hw_ctxsw_prog_gp10b.h b/drivers/gpu/nvgpu/gp10b/hw_ctxsw_prog_gp10b.h index 49e92df9..eef9a96f 100644 --- a/drivers/gpu/nvgpu/gp10b/hw_ctxsw_prog_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/hw_ctxsw_prog_gp10b.h | |||
@@ -62,6 +62,10 @@ static inline u32 ctxsw_prog_main_image_patch_count_o(void) | |||
62 | { | 62 | { |
63 | return 0x00000010; | 63 | return 0x00000010; |
64 | } | 64 | } |
65 | static inline u32 ctxsw_prog_main_image_context_id_o(void) | ||
66 | { | ||
67 | return 0x000000f0; | ||
68 | } | ||
65 | static inline u32 ctxsw_prog_main_image_patch_adr_lo_o(void) | 69 | static inline u32 ctxsw_prog_main_image_patch_adr_lo_o(void) |
66 | { | 70 | { |
67 | return 0x00000014; | 71 | return 0x00000014; |
@@ -286,8 +290,184 @@ static inline u32 ctxsw_prog_main_image_compute_preemption_options_control_cilp_ | |||
286 | { | 290 | { |
287 | return 0x2; | 291 | return 0x2; |
288 | } | 292 | } |
289 | static inline u32 ctxsw_prog_main_image_context_id_o(void) | 293 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_control_o(void) |
290 | { | 294 | { |
291 | return 0x000000f0; | 295 | return 0x000000ac; |
296 | } | ||
297 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_control_num_records_f(u32 v) | ||
298 | { | ||
299 | return (v & 0xffff) << 0; | ||
300 | } | ||
301 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_ptr_hi_o(void) | ||
302 | { | ||
303 | return 0x000000b0; | ||
304 | } | ||
305 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_ptr_hi_v_m(void) | ||
306 | { | ||
307 | return 0xfffffff << 0; | ||
308 | } | ||
309 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_ptr_hi_target_m(void) | ||
310 | { | ||
311 | return 0x3 << 28; | ||
312 | } | ||
313 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_ptr_hi_target_vid_mem_f(void) | ||
314 | { | ||
315 | return 0x0; | ||
316 | } | ||
317 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_ptr_hi_target_sys_mem_coherent_f(void) | ||
318 | { | ||
319 | return 0x20000000; | ||
320 | } | ||
321 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_ptr_hi_target_sys_mem_noncoherent_f(void) | ||
322 | { | ||
323 | return 0x30000000; | ||
324 | } | ||
325 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_ptr_o(void) | ||
326 | { | ||
327 | return 0x000000b4; | ||
328 | } | ||
329 | static inline u32 ctxsw_prog_main_image_context_timestamp_buffer_ptr_v_f(u32 v) | ||
330 | { | ||
331 | return (v & 0xffffffff) << 0; | ||
332 | } | ||
333 | static inline u32 ctxsw_prog_record_timestamp_record_size_in_bytes_v(void) | ||
334 | { | ||
335 | return 0x00000080; | ||
336 | } | ||
337 | static inline u32 ctxsw_prog_record_timestamp_record_size_in_words_v(void) | ||
338 | { | ||
339 | return 0x00000020; | ||
340 | } | ||
341 | static inline u32 ctxsw_prog_record_timestamp_magic_value_lo_o(void) | ||
342 | { | ||
343 | return 0x00000000; | ||
344 | } | ||
345 | static inline u32 ctxsw_prog_record_timestamp_magic_value_lo_v_value_v(void) | ||
346 | { | ||
347 | return 0x00000000; | ||
348 | } | ||
349 | static inline u32 ctxsw_prog_record_timestamp_magic_value_hi_o(void) | ||
350 | { | ||
351 | return 0x00000004; | ||
352 | } | ||
353 | static inline u32 ctxsw_prog_record_timestamp_magic_value_hi_v_value_v(void) | ||
354 | { | ||
355 | return 0x600dbeef; | ||
356 | } | ||
357 | static inline u32 ctxsw_prog_record_timestamp_context_id_o(void) | ||
358 | { | ||
359 | return 0x00000008; | ||
360 | } | ||
361 | static inline u32 ctxsw_prog_record_timestamp_context_ptr_o(void) | ||
362 | { | ||
363 | return 0x0000000c; | ||
364 | } | ||
365 | static inline u32 ctxsw_prog_record_timestamp_timestamp_lo_o(void) | ||
366 | { | ||
367 | return 0x00000018; | ||
368 | } | ||
369 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_o(void) | ||
370 | { | ||
371 | return 0x0000001c; | ||
372 | } | ||
373 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_v_f(u32 v) | ||
374 | { | ||
375 | return (v & 0xffffff) << 0; | ||
376 | } | ||
377 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_v_v(u32 r) | ||
378 | { | ||
379 | return (r >> 0) & 0xffffff; | ||
380 | } | ||
381 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_f(u32 v) | ||
382 | { | ||
383 | return (v & 0xff) << 24; | ||
384 | } | ||
385 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_m(void) | ||
386 | { | ||
387 | return 0xff << 24; | ||
388 | } | ||
389 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_v(u32 r) | ||
390 | { | ||
391 | return (r >> 24) & 0xff; | ||
392 | } | ||
393 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_ctxsw_req_by_host_v(void) | ||
394 | { | ||
395 | return 0x00000001; | ||
396 | } | ||
397 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_ctxsw_req_by_host_f(void) | ||
398 | { | ||
399 | return 0x1000000; | ||
400 | } | ||
401 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_v(void) | ||
402 | { | ||
403 | return 0x00000002; | ||
404 | } | ||
405 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_f(void) | ||
406 | { | ||
407 | return 0x2000000; | ||
408 | } | ||
409 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_wfi_v(void) | ||
410 | { | ||
411 | return 0x0000000a; | ||
412 | } | ||
413 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_wfi_f(void) | ||
414 | { | ||
415 | return 0xa000000; | ||
416 | } | ||
417 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_gfxp_v(void) | ||
418 | { | ||
419 | return 0x0000000b; | ||
420 | } | ||
421 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_gfxp_f(void) | ||
422 | { | ||
423 | return 0xb000000; | ||
424 | } | ||
425 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_ctap_v(void) | ||
426 | { | ||
427 | return 0x0000000c; | ||
428 | } | ||
429 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_ctap_f(void) | ||
430 | { | ||
431 | return 0xc000000; | ||
432 | } | ||
433 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_cilp_v(void) | ||
434 | { | ||
435 | return 0x0000000d; | ||
436 | } | ||
437 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_fe_ack_cilp_f(void) | ||
438 | { | ||
439 | return 0xd000000; | ||
440 | } | ||
441 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_save_end_v(void) | ||
442 | { | ||
443 | return 0x00000003; | ||
444 | } | ||
445 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_save_end_f(void) | ||
446 | { | ||
447 | return 0x3000000; | ||
448 | } | ||
449 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_restore_start_v(void) | ||
450 | { | ||
451 | return 0x00000004; | ||
452 | } | ||
453 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_restore_start_f(void) | ||
454 | { | ||
455 | return 0x4000000; | ||
456 | } | ||
457 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_context_start_v(void) | ||
458 | { | ||
459 | return 0x00000005; | ||
460 | } | ||
461 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_context_start_f(void) | ||
462 | { | ||
463 | return 0x5000000; | ||
464 | } | ||
465 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_invalid_timestamp_v(void) | ||
466 | { | ||
467 | return 0x000000ff; | ||
468 | } | ||
469 | static inline u32 ctxsw_prog_record_timestamp_timestamp_hi_tag_invalid_timestamp_f(void) | ||
470 | { | ||
471 | return 0xff000000; | ||
292 | } | 472 | } |
293 | #endif | 473 | #endif |
diff --git a/drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h index 62ac1327..26578bb5 100644 --- a/drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h | |||
@@ -1094,6 +1094,10 @@ static inline u32 gr_fecs_method_push_adr_set_watchdog_timeout_f(void) | |||
1094 | { | 1094 | { |
1095 | return 0x21; | 1095 | return 0x21; |
1096 | } | 1096 | } |
1097 | static inline u32 gr_fecs_method_push_adr_write_timestamp_record_v(void) | ||
1098 | { | ||
1099 | return 0x0000003d; | ||
1100 | } | ||
1097 | static inline u32 gr_fecs_method_push_adr_discover_preemption_image_size_v(void) | 1101 | static inline u32 gr_fecs_method_push_adr_discover_preemption_image_size_v(void) |
1098 | { | 1102 | { |
1099 | return 0x0000001a; | 1103 | return 0x0000001a; |
diff --git a/drivers/gpu/nvgpu/gp10b/hw_timer_gp10b.h b/drivers/gpu/nvgpu/gp10b/hw_timer_gp10b.h index e0fc59df..df27154f 100644 --- a/drivers/gpu/nvgpu/gp10b/hw_timer_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/hw_timer_gp10b.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |