summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2015-08-10 05:06:18 -0400
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 04:52:11 -0500
commit58adb7385de5dd3dee6d1493edbf5ee33d142dbc (patch)
tree79440034da83e642b7fe472a83aa5104af9de1ea
parent960704ca2579ba78cd7996f3b5d29c0f8461596b (diff)
gpu: nvgpu: Determine ECC-enabled units for GP10B
Determine ECC-enabled units for GP10B by reading fuses/registers. Bug 1637486 Change-Id: I6431709e3c405d6156dd96438df14d4054b48644 Signed-off-by: Sami Kiminki <skiminki@nvidia.com> Signed-off-by: Adeel Raza <araza@nvidia.com> Reviewed-on: http://git-master/r/780992 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1120463 Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/Makefile3
-rw-r--r--drivers/gpu/nvgpu/gp10b/gp10b.c110
-rw-r--r--drivers/gpu/nvgpu/gp10b/gp10b.h26
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c3
-rw-r--r--drivers/gpu/nvgpu/gp10b/hw_fuse_gp10b.h10
-rw-r--r--drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h32
-rw-r--r--include/uapi/linux/nvgpu-t18x.h17
7 files changed, 198 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index e5ed32d4..13d52f84 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -17,7 +17,8 @@ nvgpu-y += \
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/fecs_trace_gp10b.o \
20 $(nvgpu-t18x)/gp10b/gp10b_sysfs.o 20 $(nvgpu-t18x)/gp10b/gp10b_sysfs.o \
21 $(nvgpu-t18x)/gp10b/gp10b.o
21 22
22nvgpu-$(CONFIG_TEGRA_GK20A) += $(nvgpu-t18x)/gp10b/platform_gp10b_tegra.o 23nvgpu-$(CONFIG_TEGRA_GK20A) += $(nvgpu-t18x)/gp10b/platform_gp10b_tegra.o
23 24
diff --git a/drivers/gpu/nvgpu/gp10b/gp10b.c b/drivers/gpu/nvgpu/gp10b/gp10b.c
new file mode 100644
index 00000000..a541dda3
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp10b/gp10b.c
@@ -0,0 +1,110 @@
1/*
2 * GP10B Graphics
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 * 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#include "hw_fuse_gp10b.h"
21#include "hw_gr_gp10b.h"
22
23static u64 gp10b_detect_ecc_enabled_units(struct gk20a *g)
24{
25 u64 ecc_enabled_units = 0;
26 u32 opt_ecc_en = gk20a_readl(g, fuse_opt_ecc_en_r());
27 u32 opt_feature_fuses_override_disable =
28 gk20a_readl(g,
29 fuse_opt_feature_fuses_override_disable_r());
30 u32 fecs_feature_override_ecc =
31 gk20a_readl(g,
32 gr_fecs_feature_override_ecc_r());
33
34 if (opt_feature_fuses_override_disable) {
35 if (opt_ecc_en)
36 ecc_enabled_units = NVGPU_GPU_FLAGS_ALL_ECC_ENABLED;
37 else
38 ecc_enabled_units = 0;
39 } else {
40 /* SM LRF */
41 if (gr_fecs_feature_override_ecc_sm_lrf_override_v(
42 fecs_feature_override_ecc)) {
43 if (gr_fecs_feature_override_ecc_sm_lrf_v(
44 fecs_feature_override_ecc)) {
45 ecc_enabled_units |=
46 NVGPU_GPU_FLAGS_ECC_ENABLED_SM_LRF;
47 }
48 } else {
49 if (opt_ecc_en) {
50 ecc_enabled_units |=
51 NVGPU_GPU_FLAGS_ECC_ENABLED_SM_LRF;
52 }
53 }
54
55 /* SM SHM */
56 if (gr_fecs_feature_override_ecc_sm_shm_override_v(
57 fecs_feature_override_ecc)) {
58 if (gr_fecs_feature_override_ecc_sm_shm_v(
59 fecs_feature_override_ecc)) {
60 ecc_enabled_units |=
61 NVGPU_GPU_FLAGS_ECC_ENABLED_SM_SHM;
62 }
63 } else {
64 if (opt_ecc_en) {
65 ecc_enabled_units |=
66 NVGPU_GPU_FLAGS_ECC_ENABLED_SM_SHM;
67 }
68 }
69
70 /* TEX */
71 if (gr_fecs_feature_override_ecc_tex_override_v(
72 fecs_feature_override_ecc)) {
73 if (gr_fecs_feature_override_ecc_tex_v(
74 fecs_feature_override_ecc)) {
75 ecc_enabled_units |=
76 NVGPU_GPU_FLAGS_ECC_ENABLED_TEX;
77 }
78 } else {
79 if (opt_ecc_en) {
80 ecc_enabled_units |=
81 NVGPU_GPU_FLAGS_ECC_ENABLED_TEX;
82 }
83 }
84
85 /* LTC */
86 if (gr_fecs_feature_override_ecc_ltc_override_v(
87 fecs_feature_override_ecc)) {
88 if (gr_fecs_feature_override_ecc_ltc_v(
89 fecs_feature_override_ecc)) {
90 ecc_enabled_units |=
91 NVGPU_GPU_FLAGS_ECC_ENABLED_LTC;
92 }
93 } else {
94 if (opt_ecc_en) {
95 ecc_enabled_units |=
96 NVGPU_GPU_FLAGS_ECC_ENABLED_LTC;
97 }
98 }
99 }
100
101 return ecc_enabled_units;
102}
103
104int gp10b_init_gpu_characteristics(struct gk20a *g)
105{
106 gk20a_init_gpu_characteristics(g);
107 g->gpu_characteristics.flags |= gp10b_detect_ecc_enabled_units(g);
108
109 return 0;
110}
diff --git a/drivers/gpu/nvgpu/gp10b/gp10b.h b/drivers/gpu/nvgpu/gp10b/gp10b.h
new file mode 100644
index 00000000..263f3cbe
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp10b/gp10b.h
@@ -0,0 +1,26 @@
1/*
2 * GP10B Graphics
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 * 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#ifndef GP10B_H
20#define GP10B_H
21
22#include "gk20a/gk20a.h"
23
24int gp10b_init_gpu_characteristics(struct gk20a *g);
25
26#endif /* GP10B_H */
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index 4f67cb09..427936c7 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -41,6 +41,8 @@
41#include "gm20b/clk_gm20b.h" 41#include "gm20b/clk_gm20b.h"
42#include <linux/tegra-fuse.h> 42#include <linux/tegra-fuse.h>
43 43
44#include "gp10b.h"
45
44#define FUSE_OPT_PRIV_SEC_EN_0 0x264 46#define FUSE_OPT_PRIV_SEC_EN_0 0x264
45#define PRIV_SECURITY_ENABLED 0x01 47#define PRIV_SECURITY_ENABLED 0x01
46 48
@@ -153,6 +155,7 @@ int gp10b_init_hal(struct gk20a *g)
153 gp10b_init_cde_ops(gops); 155 gp10b_init_cde_ops(gops);
154 gp10b_init_therm_ops(gops); 156 gp10b_init_therm_ops(gops);
155 gops->name = "gp10b"; 157 gops->name = "gp10b";
158 gops->chip_init_gpu_characteristics = gp10b_init_gpu_characteristics;
156 159
157 c->twod_class = FERMI_TWOD_A; 160 c->twod_class = FERMI_TWOD_A;
158 c->threed_class = PASCAL_A; 161 c->threed_class = PASCAL_A;
diff --git a/drivers/gpu/nvgpu/gp10b/hw_fuse_gp10b.h b/drivers/gpu/nvgpu/gp10b/hw_fuse_gp10b.h
index b6b68718..ae524ce5 100644
--- a/drivers/gpu/nvgpu/gp10b/hw_fuse_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/hw_fuse_gp10b.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014-2015, 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,
@@ -126,4 +126,12 @@ static inline u32 fuse_status_opt_fbp_idx_v(u32 r, u32 i)
126{ 126{
127 return (r >> (0 + i*0)) & 0x1; 127 return (r >> (0 + i*0)) & 0x1;
128} 128}
129static inline u32 fuse_opt_ecc_en_r(void)
130{
131 return 0x00021228;
132}
133static inline u32 fuse_opt_feature_fuses_override_disable_r(void)
134{
135 return 0x000213f0;
136}
129#endif 137#endif
diff --git a/drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h
index 26578bb5..b3fd704b 100644
--- a/drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/hw_gr_gp10b.h
@@ -1486,6 +1486,38 @@ static inline u32 gr_fecs_feature_override_ecc_r(void)
1486{ 1486{
1487 return 0x00409658; 1487 return 0x00409658;
1488} 1488}
1489static inline u32 gr_fecs_feature_override_ecc_sm_lrf_override_v(u32 r)
1490{
1491 return (r >> 3) & 0x1;
1492}
1493static inline u32 gr_fecs_feature_override_ecc_sm_shm_override_v(u32 r)
1494{
1495 return (r >> 7) & 0x1;
1496}
1497static inline u32 gr_fecs_feature_override_ecc_tex_override_v(u32 r)
1498{
1499 return (r >> 11) & 0x1;
1500}
1501static inline u32 gr_fecs_feature_override_ecc_ltc_override_v(u32 r)
1502{
1503 return (r >> 15) & 0x1;
1504}
1505static inline u32 gr_fecs_feature_override_ecc_sm_lrf_v(u32 r)
1506{
1507 return (r >> 0) & 0x1;
1508}
1509static inline u32 gr_fecs_feature_override_ecc_sm_shm_v(u32 r)
1510{
1511 return (r >> 4) & 0x1;
1512}
1513static inline u32 gr_fecs_feature_override_ecc_tex_v(u32 r)
1514{
1515 return (r >> 8) & 0x1;
1516}
1517static inline u32 gr_fecs_feature_override_ecc_ltc_v(u32 r)
1518{
1519 return (r >> 12) & 0x1;
1520}
1489static inline u32 gr_gpc0_gpccs_ctxsw_idlestate_r(void) 1521static inline u32 gr_gpc0_gpccs_ctxsw_idlestate_r(void)
1490{ 1522{
1491 return 0x00502420; 1523 return 0x00502420;
diff --git a/include/uapi/linux/nvgpu-t18x.h b/include/uapi/linux/nvgpu-t18x.h
index b2a75143..6116ec61 100644
--- a/include/uapi/linux/nvgpu-t18x.h
+++ b/include/uapi/linux/nvgpu-t18x.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * NVGPU Public Interface Header 2 * NVGPU Public Interface Header
3 * 3 *
4 * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2011-2016, 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,
@@ -43,6 +43,21 @@
43#define NVGPU_ALLOC_OBJ_FLAGS_GFXP (1 << 1) 43#define NVGPU_ALLOC_OBJ_FLAGS_GFXP (1 << 1)
44#define NVGPU_ALLOC_OBJ_FLAGS_CILP (1 << 2) 44#define NVGPU_ALLOC_OBJ_FLAGS_CILP (1 << 2)
45 45
46/* SM LRF ECC is enabled */
47#define NVGPU_GPU_FLAGS_ECC_ENABLED_SM_LRF (1ULL << 60)
48/* SM SHM ECC is enabled */
49#define NVGPU_GPU_FLAGS_ECC_ENABLED_SM_SHM (1ULL << 61)
50/* TEX ECC is enabled */
51#define NVGPU_GPU_FLAGS_ECC_ENABLED_TEX (1ULL << 62)
52/* L2 ECC is enabled */
53#define NVGPU_GPU_FLAGS_ECC_ENABLED_LTC (1ULL << 63)
54/* All types of ECC are enabled */
55#define NVGPU_GPU_FLAGS_ALL_ECC_ENABLED \
56 (NVGPU_GPU_FLAGS_ECC_ENABLED_SM_LRF | \
57 NVGPU_GPU_FLAGS_ECC_ENABLED_SM_SHM | \
58 NVGPU_GPU_FLAGS_ECC_ENABLED_TEX | \
59 NVGPU_GPU_FLAGS_ECC_ENABLED_LTC)
60
46#endif /* _UAPI__LINUX_NVGPU_T18X_IOCTL_H_ */ 61#endif /* _UAPI__LINUX_NVGPU_T18X_IOCTL_H_ */
47 62
48 63