summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-05-01 18:31:00 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-12 13:19:52 -0400
commita8cf64019f74dd05626a911af3df079efd9c7c89 (patch)
treeb88b450a989a13cb4cbd0f831cd7add30c4ef0c4
parent5a4926f2918b84fccefb8ddf6dbaa7b6449735bf (diff)
gpu: nvgpu: Introduce priv ring HAL and define ISR
Introduce a priv ring HAL and define ISR as the only function in it. Introduce a gp10b version of the ISR that writes error message to UART for every priv ring error, and leave the old chips with silent error handling. Bug 1846641 Change-Id: I73e38396205ac7bb7b8488b7fbca3ff67a3db3bb Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1473696 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/Makefile.nvgpu1
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h3
-rw-r--r--drivers/gpu/nvgpu/gk20a/hal_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c5
-rw-r--r--drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.h9
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c4
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c2
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c4
-rw-r--r--drivers/gpu/nvgpu/gp10b/priv_ring_gp10b.c82
-rw-r--r--drivers/gpu/nvgpu/gp10b/priv_ring_gp10b.h22
10 files changed, 127 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/Makefile.nvgpu b/drivers/gpu/nvgpu/Makefile.nvgpu
index 59c81826..411e06cc 100644
--- a/drivers/gpu/nvgpu/Makefile.nvgpu
+++ b/drivers/gpu/nvgpu/Makefile.nvgpu
@@ -165,6 +165,7 @@ nvgpu-y += \
165 gp10b/therm_gp10b.o \ 165 gp10b/therm_gp10b.o \
166 gp10b/fecs_trace_gp10b.o \ 166 gp10b/fecs_trace_gp10b.o \
167 gp10b/gp10b_sysfs.o \ 167 gp10b/gp10b_sysfs.o \
168 gp10b/priv_ring_gp10b.o \
168 gp10b/gp10b.o \ 169 gp10b/gp10b.o \
169 gp106/hal_gp106.o \ 170 gp106/hal_gp106.o \
170 gp106/mm_gp106.o \ 171 gp106/mm_gp106.o \
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 03f61c33..626ed2bd 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -886,6 +886,9 @@ struct gpu_ops {
886 struct { 886 struct {
887 void (*falcon_hal_sw_init)(struct nvgpu_falcon *flcn); 887 void (*falcon_hal_sw_init)(struct nvgpu_falcon *flcn);
888 } falcon; 888 } falcon;
889 struct {
890 void (*isr)(struct gk20a *g);
891 } priv_ring;
889}; 892};
890 893
891struct nvgpu_bios_ucode { 894struct nvgpu_bios_ucode {
diff --git a/drivers/gpu/nvgpu/gk20a/hal_gk20a.c b/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
index 3dbe856d..729a277f 100644
--- a/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
@@ -35,6 +35,7 @@
35#include "dbg_gpu_gk20a.h" 35#include "dbg_gpu_gk20a.h"
36#include "css_gr_gk20a.h" 36#include "css_gr_gk20a.h"
37#include "pramin_gk20a.h" 37#include "pramin_gk20a.h"
38#include "priv_ring_gk20a.h"
38 39
39#include <nvgpu/log.h> 40#include <nvgpu/log.h>
40#include <nvgpu/bug.h> 41#include <nvgpu/bug.h>
@@ -155,6 +156,7 @@ int gk20a_init_hal(struct gk20a *g)
155 gops->pmupstate = false; 156 gops->pmupstate = false;
156 gk20a_init_bus(gops); 157 gk20a_init_bus(gops);
157 gk20a_init_mc(gops); 158 gk20a_init_mc(gops);
159 gk20a_init_priv_ring(gops);
158 gk20a_init_ltc(gops); 160 gk20a_init_ltc(gops);
159 gk20a_init_gr_ops(gops); 161 gk20a_init_gr_ops(gops);
160 gk20a_init_fecs_trace_ops(gops); 162 gk20a_init_fecs_trace_ops(gops);
diff --git a/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c b/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c
index 96e21d2d..2f837bfc 100644
--- a/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c
@@ -94,3 +94,8 @@ void gk20a_priv_ring_isr(struct gk20a *g)
94 if (retry <= 0) 94 if (retry <= 0)
95 nvgpu_warn(g, "priv ringmaster cmd ack too many retries"); 95 nvgpu_warn(g, "priv ringmaster cmd ack too many retries");
96} 96}
97
98void gk20a_init_priv_ring(struct gpu_ops *gops)
99{
100 gops->priv_ring.isr = gk20a_priv_ring_isr;
101}
diff --git a/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.h b/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.h
index 8a6320d7..61780288 100644
--- a/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.h
@@ -11,15 +11,14 @@
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details. 13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */ 14 */
19#ifndef __PRIV_RING_GK20A_H__ 15#ifndef __PRIV_RING_GK20A_H__
20#define __PRIV_RING_GK20A_H__ 16#define __PRIV_RING_GK20A_H__
21 17
22void gk20a_enable_priv_ring(struct gk20a *g); 18struct gpu_ops;
19
23void gk20a_priv_ring_isr(struct gk20a *g); 20void gk20a_priv_ring_isr(struct gk20a *g);
21void gk20a_enable_priv_ring(struct gk20a *g);
22void gk20a_init_priv_ring(struct gpu_ops *gops);
24 23
25#endif /*__PRIV_RING_GK20A_H__*/ 24#endif /*__PRIV_RING_GK20A_H__*/
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
index 62cd6119..fbeed3c2 100644
--- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GM20B Graphics 2 * GM20B Graphics
3 * 3 *
4 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 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, 7 * under the terms and conditions of the GNU General Public License,
@@ -18,6 +18,7 @@
18#include "gk20a/css_gr_gk20a.h" 18#include "gk20a/css_gr_gk20a.h"
19#include "gk20a/bus_gk20a.h" 19#include "gk20a/bus_gk20a.h"
20#include "gk20a/flcn_gk20a.h" 20#include "gk20a/flcn_gk20a.h"
21#include "gk20a/priv_ring_gk20a.h"
21 22
22#include "ltc_gm20b.h" 23#include "ltc_gm20b.h"
23#include "ce2_gm20b.h" 24#include "ce2_gm20b.h"
@@ -218,6 +219,7 @@ int gm20b_init_hal(struct gk20a *g)
218#endif 219#endif
219 gk20a_init_bus(gops); 220 gk20a_init_bus(gops);
220 gm20b_init_mc(gops); 221 gm20b_init_mc(gops);
222 gk20a_init_priv_ring(gops);
221 gm20b_init_ltc(gops); 223 gm20b_init_ltc(gops);
222 gm20b_init_gr(gops); 224 gm20b_init_gr(gops);
223 gm20b_init_ltc(gops); 225 gm20b_init_ltc(gops);
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index e39843ac..3f64283a 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -27,6 +27,7 @@
27#include "gp10b/ce_gp10b.h" 27#include "gp10b/ce_gp10b.h"
28#include "gp10b/regops_gp10b.h" 28#include "gp10b/regops_gp10b.h"
29#include "gp10b/cde_gp10b.h" 29#include "gp10b/cde_gp10b.h"
30#include "gp10b/priv_ring_gp10b.h"
30 31
31#include "gp106/fifo_gp106.h" 32#include "gp106/fifo_gp106.h"
32#include "gp106/regops_gp106.h" 33#include "gp106/regops_gp106.h"
@@ -232,6 +233,7 @@ int gp106_init_hal(struct gk20a *g)
232 gops->pmupstate = true; 233 gops->pmupstate = true;
233 gk20a_init_bus(gops); 234 gk20a_init_bus(gops);
234 gp10b_init_mc(gops); 235 gp10b_init_mc(gops);
236 gp10b_init_priv_ring(gops);
235 gp106_init_gr(gops); 237 gp106_init_gr(gops);
236 gp10b_init_fecs_trace_ops(gops); 238 gp10b_init_fecs_trace_ops(gops);
237 gp106_init_ltc(gops); 239 gp106_init_ltc(gops);
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index 40e49e13..1d3ad275 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP10B Tegra HAL interface 2 * GP10B Tegra HAL interface
3 * 3 *
4 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 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, 7 * under the terms and conditions of the GNU General Public License,
@@ -34,6 +34,7 @@
34#include "gp10b/regops_gp10b.h" 34#include "gp10b/regops_gp10b.h"
35#include "gp10b/cde_gp10b.h" 35#include "gp10b/cde_gp10b.h"
36#include "gp10b/therm_gp10b.h" 36#include "gp10b/therm_gp10b.h"
37#include "gp10b/priv_ring_gp10b.h"
37 38
38#include "gm20b/gr_gm20b.h" 39#include "gm20b/gr_gm20b.h"
39#include "gm20b/fifo_gm20b.h" 40#include "gm20b/fifo_gm20b.h"
@@ -233,6 +234,7 @@ int gp10b_init_hal(struct gk20a *g)
233 234
234 gk20a_init_bus(gops); 235 gk20a_init_bus(gops);
235 gp10b_init_mc(gops); 236 gp10b_init_mc(gops);
237 gp10b_init_priv_ring(gops);
236 gp10b_init_gr(gops); 238 gp10b_init_gr(gops);
237 gp10b_init_fecs_trace_ops(gops); 239 gp10b_init_fecs_trace_ops(gops);
238 gp10b_init_ltc(gops); 240 gp10b_init_ltc(gops);
diff --git a/drivers/gpu/nvgpu/gp10b/priv_ring_gp10b.c b/drivers/gpu/nvgpu/gp10b/priv_ring_gp10b.c
new file mode 100644
index 00000000..7cdbec5e
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp10b/priv_ring_gp10b.c
@@ -0,0 +1,82 @@
1/*
2 * GP10B priv ring
3 *
4 * Copyright (c) 2017, 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 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "gk20a/gk20a.h"
20
21#include <nvgpu/log.h>
22#include <nvgpu/timers.h>
23
24#include <nvgpu/hw/gp10b/hw_mc_gp10b.h>
25#include <nvgpu/hw/gp10b/hw_pri_ringmaster_gp10b.h>
26#include <nvgpu/hw/gp10b/hw_pri_ringstation_sys_gp10b.h>
27#include <nvgpu/hw/gp10b/hw_pri_ringstation_gpc_gp10b.h>
28
29static void gp10b_priv_ring_isr(struct gk20a *g)
30{
31 u32 status0, status1;
32 u32 cmd;
33 s32 retry = 100;
34 u32 gpc;
35 u32 gpc_stride = nvgpu_get_litter_value(g, GPU_LIT_GPC_STRIDE);
36
37 if (g->is_fmodel)
38 return;
39
40 status0 = gk20a_readl(g, pri_ringmaster_intr_status0_r());
41 status1 = gk20a_readl(g, pri_ringmaster_intr_status1_r());
42
43 nvgpu_err(g, "ringmaster intr status0: 0x%08x,"
44 "status1: 0x%08x", status0, status1);
45
46 if (pri_ringmaster_intr_status0_gbl_write_error_sys_v(status0) != 0) {
47 nvgpu_err(g, "SYS write error. ADR %08x WRDAT %08x INFO %08x, CODE %08x",
48 gk20a_readl(g, pri_ringstation_sys_priv_error_adr_r()),
49 gk20a_readl(g, pri_ringstation_sys_priv_error_wrdat_r()),
50 gk20a_readl(g, pri_ringstation_sys_priv_error_info_r()),
51 gk20a_readl(g, pri_ringstation_sys_priv_error_code_r()));
52 }
53
54 for (gpc = 0; gpc < g->gr.gpc_count; gpc++) {
55 if (status1 & BIT(gpc)) {
56 nvgpu_err(g, "GPC%u write error. ADR %08x WRDAT %08x INFO %08x, CODE %08x", gpc,
57 gk20a_readl(g, pri_ringstation_gpc_gpc0_priv_error_adr_r() + gpc * gpc_stride),
58 gk20a_readl(g, pri_ringstation_gpc_gpc0_priv_error_wrdat_r() + gpc * gpc_stride),
59 gk20a_readl(g, pri_ringstation_gpc_gpc0_priv_error_info_r() + gpc * gpc_stride),
60 gk20a_readl(g, pri_ringstation_gpc_gpc0_priv_error_code_r() + gpc * gpc_stride));
61 }
62 }
63
64 cmd = gk20a_readl(g, pri_ringmaster_command_r());
65 cmd = set_field(cmd, pri_ringmaster_command_cmd_m(),
66 pri_ringmaster_command_cmd_ack_interrupt_f());
67 gk20a_writel(g, pri_ringmaster_command_r(), cmd);
68
69 do {
70 cmd = pri_ringmaster_command_cmd_v(
71 gk20a_readl(g, pri_ringmaster_command_r()));
72 nvgpu_usleep_range(20, 40);
73 } while (cmd != pri_ringmaster_command_cmd_no_cmd_v() && --retry);
74
75 if (retry <= 0)
76 nvgpu_warn(g, "priv ringmaster cmd ack too many retries");
77}
78
79void gp10b_init_priv_ring(struct gpu_ops *gops)
80{
81 gops->priv_ring.isr = gp10b_priv_ring_isr;
82}
diff --git a/drivers/gpu/nvgpu/gp10b/priv_ring_gp10b.h b/drivers/gpu/nvgpu/gp10b/priv_ring_gp10b.h
new file mode 100644
index 00000000..acd0857f
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp10b/priv_ring_gp10b.h
@@ -0,0 +1,22 @@
1/*
2 * GP10B PRIV ringmaster
3 *
4 * Copyright (c) 2011-2017, 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#ifndef __PRIV_RING_GP10B_H__
16#define __PRIV_RING_GP10B_H__
17
18struct gpu_ops;
19
20void gp10b_init_priv_ring(struct gpu_ops *gops);
21
22#endif /*__PRIV_RING_GP10B_H__*/