summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/ecc_gp10b.c
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-06-26 20:37:40 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-19 19:43:58 -0400
commit7f14aafc2c02eb0fab458324d0ba91a7fdea3086 (patch)
treecda9f48839fbde3444fde521a9b0069eb06cd81a /drivers/gpu/nvgpu/gp10b/ecc_gp10b.c
parent5ff1b3fe5a30c926e59a55ad25dd4daf430c8579 (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/gp10b/ecc_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/ecc_gp10b.c106
1 files changed, 106 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/ecc_gp10b.c b/drivers/gpu/nvgpu/gp10b/ecc_gp10b.c
new file mode 100644
index 00000000..cf95c0d7
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp10b/ecc_gp10b.c
@@ -0,0 +1,106 @@
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 "gp10b/ecc_gp10b.h"
27
28int gp10b_ecc_init(struct gk20a *g)
29{
30 int err = 0;
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(sm_shm_ecc_sec_count);
42 if (err != 0) {
43 goto done;
44 }
45 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(sm_shm_ecc_sed_count);
46 if (err != 0) {
47 goto done;
48 }
49 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(sm_shm_ecc_ded_count);
50 if (err != 0) {
51 goto done;
52 }
53
54 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(tex_ecc_total_sec_pipe0_count);
55 if (err != 0) {
56 goto done;
57 }
58 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(tex_ecc_total_ded_pipe0_count);
59 if (err != 0) {
60 goto done;
61 }
62
63 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(tex_unique_ecc_sec_pipe0_count);
64 if (err != 0) {
65 goto done;
66 }
67 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(tex_unique_ecc_ded_pipe0_count);
68 if (err != 0) {
69 goto done;
70 }
71
72 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(tex_ecc_total_sec_pipe1_count);
73 if (err != 0) {
74 goto done;
75 }
76 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(tex_ecc_total_ded_pipe1_count);
77 if (err != 0) {
78 goto done;
79 }
80
81 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(tex_unique_ecc_sec_pipe1_count);
82 if (err != 0) {
83 goto done;
84 }
85 err = NVGPU_ECC_COUNTER_INIT_PER_TPC(tex_unique_ecc_ded_pipe1_count);
86 if (err != 0) {
87 goto done;
88 }
89
90 err = NVGPU_ECC_COUNTER_INIT_PER_LTS(ecc_sec_count);
91 if (err != 0) {
92 goto done;
93 }
94 err = NVGPU_ECC_COUNTER_INIT_PER_LTS(ecc_ded_count);
95 if (err != 0) {
96 goto done;
97 }
98
99done:
100 if (err != 0) {
101 nvgpu_err(g, "ecc counter allocate failed, err=%d", err);
102 nvgpu_ecc_free(g);
103 }
104
105 return err;
106}