diff options
author | Richard Zhao <rizhao@nvidia.com> | 2018-06-26 20:37:40 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-07-19 19:43:58 -0400 |
commit | 7f14aafc2c02eb0fab458324d0ba91a7fdea3086 (patch) | |
tree | cda9f48839fbde3444fde521a9b0069eb06cd81a /drivers/gpu/nvgpu/gv11b/ecc_gv11b.c | |
parent | 5ff1b3fe5a30c926e59a55ad25dd4daf430c8579 (diff) |
gpu: nvgpu: rework ecc structure and sysfs
- create common file common/ecc.c which include common functions for add
ecc counters and remove counters.
- common code will create a list of all counter which make it easier to
iterate all counters.
- Add chip specific file for adding ecc counters.
- add linux specific file os/linux/ecc_sysfs.c to export counters to
sysfs.
- remove obsolete code
- MISRA violation for using snprintf is not solved, tracking with
jira NVGPU-859
Jira NVGPUT-115
Change-Id: I1905c43c5c9b2b131199807533dee8e63ddc12f4
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1763536
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b/ecc_gv11b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/ecc_gv11b.c | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/ecc_gv11b.c b/drivers/gpu/nvgpu/gv11b/ecc_gv11b.c new file mode 100644 index 00000000..6e29bf94 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/ecc_gv11b.c | |||
@@ -0,0 +1,181 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, 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 | |||
23 | #include <nvgpu/ecc.h> | ||
24 | |||
25 | #include "gk20a/gk20a.h" | ||
26 | #include "gv11b/ecc_gv11b.h" | ||
27 | |||
28 | int gv11b_ecc_init(struct gk20a *g) | ||
29 | { | ||
30 | int err; | ||
31 | |||
32 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC(sm_lrf_ecc_single_err_count); | ||
33 | if (err != 0) { | ||
34 | goto done; | ||
35 | } | ||
36 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC(sm_lrf_ecc_double_err_count); | ||
37 | if (err != 0) { | ||
38 | goto done; | ||
39 | } | ||
40 | |||
41 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC( | ||
42 | sm_l1_tag_ecc_corrected_err_count); | ||
43 | if (err != 0) { | ||
44 | goto done; | ||
45 | } | ||
46 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC( | ||
47 | sm_l1_tag_ecc_uncorrected_err_count); | ||
48 | if (err != 0) { | ||
49 | goto done; | ||
50 | } | ||
51 | |||
52 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC( | ||
53 | sm_cbu_ecc_corrected_err_count); | ||
54 | if (err != 0) { | ||
55 | goto done; | ||
56 | } | ||
57 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC( | ||
58 | sm_cbu_ecc_uncorrected_err_count); | ||
59 | if (err != 0) { | ||
60 | goto done; | ||
61 | } | ||
62 | |||
63 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC( | ||
64 | sm_l1_data_ecc_corrected_err_count); | ||
65 | if (err != 0) { | ||
66 | goto done; | ||
67 | } | ||
68 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC( | ||
69 | sm_l1_data_ecc_uncorrected_err_count); | ||
70 | if (err != 0) { | ||
71 | goto done; | ||
72 | } | ||
73 | |||
74 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC( | ||
75 | sm_icache_ecc_corrected_err_count); | ||
76 | if (err != 0) { | ||
77 | goto done; | ||
78 | } | ||
79 | err = NVGPU_ECC_COUNTER_INIT_PER_TPC( | ||
80 | sm_icache_ecc_uncorrected_err_count); | ||
81 | if (err != 0) { | ||
82 | goto done; | ||
83 | } | ||
84 | |||
85 | err = NVGPU_ECC_COUNTER_INIT_PER_GPC( | ||
86 | gcc_l15_ecc_corrected_err_count); | ||
87 | if (err != 0) { | ||
88 | goto done; | ||
89 | } | ||
90 | err = NVGPU_ECC_COUNTER_INIT_PER_GPC( | ||
91 | gcc_l15_ecc_uncorrected_err_count); | ||
92 | if (err != 0) { | ||
93 | goto done; | ||
94 | } | ||
95 | |||
96 | err = NVGPU_ECC_COUNTER_INIT_PER_LTS(ecc_sec_count); | ||
97 | if (err != 0) { | ||
98 | goto done; | ||
99 | } | ||
100 | err = NVGPU_ECC_COUNTER_INIT_PER_LTS(ecc_ded_count); | ||
101 | if (err != 0) { | ||
102 | goto done; | ||
103 | } | ||
104 | |||
105 | err = NVGPU_ECC_COUNTER_INIT_GR(fecs_ecc_uncorrected_err_count); | ||
106 | if (err != 0) { | ||
107 | goto done; | ||
108 | } | ||
109 | err = NVGPU_ECC_COUNTER_INIT_GR(fecs_ecc_corrected_err_count); | ||
110 | if (err != 0) { | ||
111 | goto done; | ||
112 | } | ||
113 | |||
114 | err = NVGPU_ECC_COUNTER_INIT_PER_GPC( | ||
115 | gpccs_ecc_uncorrected_err_count); | ||
116 | if (err != 0) { | ||
117 | goto done; | ||
118 | } | ||
119 | err = NVGPU_ECC_COUNTER_INIT_PER_GPC( | ||
120 | gpccs_ecc_corrected_err_count); | ||
121 | if (err != 0) { | ||
122 | goto done; | ||
123 | } | ||
124 | |||
125 | err = NVGPU_ECC_COUNTER_INIT_PER_GPC( | ||
126 | mmu_l1tlb_ecc_uncorrected_err_count); | ||
127 | if (err != 0) { | ||
128 | goto done; | ||
129 | } | ||
130 | err = NVGPU_ECC_COUNTER_INIT_PER_GPC( | ||
131 | mmu_l1tlb_ecc_corrected_err_count); | ||
132 | if (err != 0) { | ||
133 | goto done; | ||
134 | } | ||
135 | |||
136 | err = NVGPU_ECC_COUNTER_INIT_FB(mmu_l2tlb_ecc_uncorrected_err_count); | ||
137 | if (err != 0) { | ||
138 | goto done; | ||
139 | } | ||
140 | err = NVGPU_ECC_COUNTER_INIT_FB(mmu_l2tlb_ecc_corrected_err_count); | ||
141 | if (err != 0) { | ||
142 | goto done; | ||
143 | } | ||
144 | |||
145 | err = NVGPU_ECC_COUNTER_INIT_FB(mmu_hubtlb_ecc_uncorrected_err_count); | ||
146 | if (err != 0) { | ||
147 | goto done; | ||
148 | } | ||
149 | err = NVGPU_ECC_COUNTER_INIT_FB(mmu_hubtlb_ecc_corrected_err_count); | ||
150 | if (err != 0) { | ||
151 | goto done; | ||
152 | } | ||
153 | |||
154 | err = NVGPU_ECC_COUNTER_INIT_FB( | ||
155 | mmu_fillunit_ecc_uncorrected_err_count); | ||
156 | if (err != 0) { | ||
157 | goto done; | ||
158 | } | ||
159 | err = NVGPU_ECC_COUNTER_INIT_FB( | ||
160 | mmu_fillunit_ecc_corrected_err_count); | ||
161 | if (err != 0) { | ||
162 | goto done; | ||
163 | } | ||
164 | |||
165 | err = NVGPU_ECC_COUNTER_INIT_PMU(pmu_ecc_uncorrected_err_count); | ||
166 | if (err != 0) { | ||
167 | goto done; | ||
168 | } | ||
169 | err = NVGPU_ECC_COUNTER_INIT_PMU(pmu_ecc_corrected_err_count); | ||
170 | if (err != 0) { | ||
171 | goto done; | ||
172 | } | ||
173 | |||
174 | done: | ||
175 | if (err != 0) { | ||
176 | nvgpu_err(g, "ecc counter allocate failed, err=%d", err); | ||
177 | nvgpu_ecc_free(g); | ||
178 | } | ||
179 | |||
180 | return err; | ||
181 | } | ||