summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/gp10b.c
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 /drivers/gpu/nvgpu/gp10b/gp10b.c
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>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/gp10b.c110
1 files changed, 110 insertions, 0 deletions
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}