summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c')
-rw-r--r--drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c
index 97845035..8ca9dd30 100644
--- a/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c
+++ b/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c
@@ -27,11 +27,13 @@
27#include "tegra/linux/clk.h" 27#include "tegra/linux/clk.h"
28 28
29#include "gp10b/platform_gp10b.h" 29#include "gp10b/platform_gp10b.h"
30#include "tegra/linux/platform_gp10b_tegra.h"
30 31
31#include "tegra/linux/platform_gk20a_tegra.h" 32#include "tegra/linux/platform_gk20a_tegra.h"
32#include "gr_gv11b.h" 33#include "gr_gv11b.h"
33#include "nvgpu_gpuid_t19x.h" 34#include "nvgpu_gpuid_t19x.h"
34 35
36static void gr_gv11b_remove_sysfs(struct device *dev);
35 37
36static int gv11b_tegra_probe(struct device *dev) 38static int gv11b_tegra_probe(struct device *dev)
37{ 39{
@@ -57,6 +59,15 @@ static int gv11b_tegra_probe(struct device *dev)
57 return 0; 59 return 0;
58} 60}
59 61
62static int gv11b_tegra_remove(struct device *dev)
63{
64 gp10b_tegra_remove(dev);
65
66 gr_gv11b_remove_sysfs(dev);
67
68 return 0;
69}
70
60static bool gv11b_tegra_is_railgated(struct device *dev) 71static bool gv11b_tegra_is_railgated(struct device *dev)
61{ 72{
62 bool ret = false; 73 bool ret = false;
@@ -89,6 +100,7 @@ struct gk20a_platform t19x_gpu_tegra_platform = {
89 .ptimer_src_freq = 31250000, 100 .ptimer_src_freq = 31250000,
90 101
91 .probe = gv11b_tegra_probe, 102 .probe = gv11b_tegra_probe,
103 .remove = gv11b_tegra_remove,
92 104
93 /* power management callbacks */ 105 /* power management callbacks */
94 .suspend = gv11b_tegra_suspend, 106 .suspend = gv11b_tegra_suspend,
@@ -110,3 +122,50 @@ struct gk20a_platform t19x_gpu_tegra_platform = {
110 .reset_assert = gp10b_tegra_reset_assert, 122 .reset_assert = gp10b_tegra_reset_assert,
111 .reset_deassert = gp10b_tegra_reset_deassert, 123 .reset_deassert = gp10b_tegra_reset_deassert,
112}; 124};
125
126static struct device_attribute *dev_attr_sm_l1_tag_ecc_corrected_err_count_array;
127static struct device_attribute *dev_attr_sm_l1_tag_ecc_uncorrected_err_count_array;
128
129void gr_gv11b_create_sysfs(struct device *dev)
130{
131 struct gk20a *g = get_gk20a(dev);
132 int error = 0;
133 /* This stat creation function is called on GR init. GR can get
134 initialized multiple times but we only need to create the ECC
135 stats once. Therefore, add the following check to avoid
136 creating duplicate stat sysfs nodes. */
137 if (g->gr.t19x.ecc_stats.sm_l1_tag_corrected_err_count.counters != NULL)
138 return;
139
140 gr_gp10b_create_sysfs(dev);
141
142 error |= gr_gp10b_ecc_stat_create(dev,
143 0,
144 "sm_l1_tag_ecc_corrected_err_count",
145 &g->gr.t19x.ecc_stats.sm_l1_tag_corrected_err_count,
146 dev_attr_sm_l1_tag_ecc_corrected_err_count_array);
147
148 error |= gr_gp10b_ecc_stat_create(dev,
149 0,
150 "sm_l1_tag_ecc_uncorrected_err_count",
151 &g->gr.t19x.ecc_stats.sm_l1_tag_uncorrected_err_count,
152 dev_attr_sm_l1_tag_ecc_uncorrected_err_count_array);
153
154 if (error)
155 dev_err(dev, "Failed to create gv11b sysfs attributes!\n");
156}
157
158static void gr_gv11b_remove_sysfs(struct device *dev)
159{
160 struct gk20a *g = get_gk20a(dev);
161
162 gr_gp10b_ecc_stat_remove(dev,
163 0,
164 &g->gr.t19x.ecc_stats.sm_l1_tag_corrected_err_count,
165 dev_attr_sm_l1_tag_ecc_corrected_err_count_array);
166
167 gr_gp10b_ecc_stat_remove(dev,
168 0,
169 &g->gr.t19x.ecc_stats.sm_l1_tag_uncorrected_err_count,
170 dev_attr_sm_l1_tag_ecc_uncorrected_err_count_array);
171}