summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorseshendra Gadagottu <sgadagottu@nvidia.com>2017-10-16 15:14:29 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-18 14:26:10 -0400
commit201ccbfa8503daee9562a22f50a5b626fe4cc6a1 (patch)
treea9ae8607667c4b64321668df72d5cbc8bcca66ab
parent3fc7c5f75ef4a6399e060d8cbfd4d7dc40c82588 (diff)
gpu: nvgpu: gv11b: update dbg ops
Updated following hal functions for gv11b and reused them for gv100: perfbuffer_enable perfbuffer_disable These changes are needed because of following reasons: 1. Register offsets for perf_pmasys_* are changed for gv11b/gv100 from gk20a. 2. Updated memory type for perf_pmasys_mem_block_target to sys_ncoh_f(). Bug 200327596 Change-Id: Ia672ac561917c8ed36caea9cc7e74b7fc7ce8188 Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1571074 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/Makefile1
-rw-r--r--drivers/gpu/nvgpu/gv100/hal_gv100.c5
-rw-r--r--drivers/gpu/nvgpu/gv11b/dbg_gpu_gv11b.c98
-rw-r--r--drivers/gpu/nvgpu/gv11b/dbg_gpu_gv11b.h28
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c5
5 files changed, 133 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index bd703d4b..8f1d42da 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -7,6 +7,7 @@ nvgpu-y += \
7 $(nvgpu-t19x)/common/linux/module_t19x.o \ 7 $(nvgpu-t19x)/common/linux/module_t19x.o \
8 $(nvgpu-t19x)/common/linux/pci_t19x.o \ 8 $(nvgpu-t19x)/common/linux/pci_t19x.o \
9 $(nvgpu-t19x)/gv11b/gv11b.o \ 9 $(nvgpu-t19x)/gv11b/gv11b.o \
10 $(nvgpu-t19x)/gv11b/dbg_gpu_gv11b.o \
10 $(nvgpu-t19x)/gv11b/mc_gv11b.o \ 11 $(nvgpu-t19x)/gv11b/mc_gv11b.o \
11 $(nvgpu-t19x)/gv11b/ltc_gv11b.o \ 12 $(nvgpu-t19x)/gv11b/ltc_gv11b.o \
12 $(nvgpu-t19x)/gv11b/hal_gv11b.o \ 13 $(nvgpu-t19x)/gv11b/hal_gv11b.o \
diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c
index 7457c185..2ece7be8 100644
--- a/drivers/gpu/nvgpu/gv100/hal_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c
@@ -76,6 +76,7 @@
76#include "gp10b/mm_gp10b.h" 76#include "gp10b/mm_gp10b.h"
77#include "gp10b/pmu_gp10b.h" 77#include "gp10b/pmu_gp10b.h"
78 78
79#include "gv11b/dbg_gpu_gv11b.h"
79#include "gv11b/hal_gv11b.h" 80#include "gv11b/hal_gv11b.h"
80#include "gv11b/gr_gv11b.h" 81#include "gv11b/gr_gv11b.h"
81#include "gv11b/mc_gv11b.h" 82#include "gv11b/mc_gv11b.h"
@@ -625,8 +626,8 @@ static const struct gpu_ops gv100_ops = {
625 nvgpu_check_and_set_context_reservation, 626 nvgpu_check_and_set_context_reservation,
626 .release_profiler_reservation = 627 .release_profiler_reservation =
627 nvgpu_release_profiler_reservation, 628 nvgpu_release_profiler_reservation,
628 .perfbuffer_enable = NULL, 629 .perfbuffer_enable = gv11b_perfbuf_enable_locked,
629 .perfbuffer_disable = NULL, 630 .perfbuffer_disable = gv11b_perfbuf_disable_locked,
630 }, 631 },
631 .bus = { 632 .bus = {
632 .init_hw = gk20a_bus_init_hw, 633 .init_hw = gk20a_bus_init_hw,
diff --git a/drivers/gpu/nvgpu/gv11b/dbg_gpu_gv11b.c b/drivers/gpu/nvgpu/gv11b/dbg_gpu_gv11b.c
new file mode 100644
index 00000000..ad50025f
--- /dev/null
+++ b/drivers/gpu/nvgpu/gv11b/dbg_gpu_gv11b.c
@@ -0,0 +1,98 @@
1/*
2 * Tegra GV11B GPU Debugger/Profiler Driver
3 *
4 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#include <uapi/linux/nvgpu.h>
26
27#include <nvgpu/log.h>
28#include "gk20a/gk20a.h"
29#include <nvgpu/hw/gv11b/hw_perf_gv11b.h>
30
31int gv11b_perfbuf_enable_locked(struct gk20a *g, u64 offset, u32 size)
32{
33 struct mm_gk20a *mm = &g->mm;
34 u32 virt_addr_lo;
35 u32 virt_addr_hi;
36 u32 inst_pa_page;
37 int err;
38
39 gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "");
40 err = gk20a_busy(g);
41 if (err) {
42 nvgpu_err(g, "failed to poweron");
43 return err;
44 }
45
46 err = gk20a_alloc_inst_block(g, &mm->perfbuf.inst_block);
47 if (err)
48 return err;
49
50 g->ops.mm.init_inst_block(&mm->perfbuf.inst_block, mm->perfbuf.vm, 0);
51
52 virt_addr_lo = u64_lo32(offset);
53 virt_addr_hi = u64_hi32(offset);
54
55 gk20a_writel(g, perf_pmasys_outbase_r(), virt_addr_lo);
56 gk20a_writel(g, perf_pmasys_outbaseupper_r(),
57 perf_pmasys_outbaseupper_ptr_f(virt_addr_hi));
58 gk20a_writel(g, perf_pmasys_outsize_r(), size);
59
60 /* this field is aligned to 4K */
61 inst_pa_page = gk20a_mm_inst_block_addr(g,
62 &mm->perfbuf.inst_block) >> 12;
63
64 gk20a_writel(g, perf_pmasys_mem_block_r(),
65 perf_pmasys_mem_block_base_f(inst_pa_page) |
66 perf_pmasys_mem_block_valid_true_f() |
67 perf_pmasys_mem_block_target_sys_ncoh_f());
68
69 gk20a_idle(g);
70 return 0;
71}
72
73/* must be called with dbg_sessions_lock held */
74int gv11b_perfbuf_disable_locked(struct gk20a *g)
75{
76 int err;
77
78 gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "");
79 err = gk20a_busy(g);
80 if (err) {
81 nvgpu_err(g, "failed to poweron");
82 return err;
83 }
84
85 gk20a_writel(g, perf_pmasys_outbase_r(), 0);
86 gk20a_writel(g, perf_pmasys_outbaseupper_r(),
87 perf_pmasys_outbaseupper_ptr_f(0));
88 gk20a_writel(g, perf_pmasys_outsize_r(), 0);
89
90 gk20a_writel(g, perf_pmasys_mem_block_r(),
91 perf_pmasys_mem_block_base_f(0) |
92 perf_pmasys_mem_block_valid_false_f() |
93 perf_pmasys_mem_block_target_f(0));
94
95 gk20a_idle(g);
96
97 return 0;
98}
diff --git a/drivers/gpu/nvgpu/gv11b/dbg_gpu_gv11b.h b/drivers/gpu/nvgpu/gv11b/dbg_gpu_gv11b.h
new file mode 100644
index 00000000..88771a49
--- /dev/null
+++ b/drivers/gpu/nvgpu/gv11b/dbg_gpu_gv11b.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22#ifndef DBG_GPU_GV11B_H
23#define DBG_GPU_GV11B_H
24
25int gv11b_perfbuf_enable_locked(struct gk20a *g, u64 offset, u32 size);
26int gv11b_perfbuf_disable_locked(struct gk20a *g);
27
28#endif /* DBG_GPU_GV11B_H */
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 4241145a..e7e2be54 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -66,6 +66,7 @@
66#include "gp106/pmu_gp106.h" 66#include "gp106/pmu_gp106.h"
67#include "gp106/acr_gp106.h" 67#include "gp106/acr_gp106.h"
68 68
69#include "dbg_gpu_gv11b.h"
69#include "hal_gv11b.h" 70#include "hal_gv11b.h"
70#include "gr_gv11b.h" 71#include "gr_gv11b.h"
71#include "mc_gv11b.h" 72#include "mc_gv11b.h"
@@ -633,8 +634,8 @@ static const struct gpu_ops gv11b_ops = {
633 nvgpu_check_and_set_context_reservation, 634 nvgpu_check_and_set_context_reservation,
634 .release_profiler_reservation = 635 .release_profiler_reservation =
635 nvgpu_release_profiler_reservation, 636 nvgpu_release_profiler_reservation,
636 .perfbuffer_enable = NULL, 637 .perfbuffer_enable = gv11b_perfbuf_enable_locked,
637 .perfbuffer_disable = NULL, 638 .perfbuffer_disable = gv11b_perfbuf_disable_locked,
638 }, 639 },
639 .bus = { 640 .bus = {
640 .init_hw = gk20a_bus_init_hw, 641 .init_hw = gk20a_bus_init_hw,