summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2014-05-05 04:25:49 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:19 -0400
commit9293a8b319e57c4c24f80ae7e3e11f99c3aaafca (patch)
tree624ccd35f4b533e9727856966e1177c7b839afe9 /drivers/gpu
parentc5466deaa18b0834f7e30dac2a362025b3976120 (diff)
gpu: nvgpu: Allow sysfs write only to root
Allow write access only to root to gk20a sysfs files. Bug 200001241 Change-Id: Ibafb84ed703dd32743b520e01a57ffc82f8b4ac4 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/405028 (cherry picked from commit dc0f977fe8fcacd260bf61ab658c166b004c1fcd) Reviewed-on: http://git-master/r/406898 Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com> Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
index 14629fbe..a5267eac 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
@@ -35,6 +35,7 @@
35 the resolution of ptimer. */ 35 the resolution of ptimer. */
36#define PTIMER_REF_FREQ_HZ 31250000 36#define PTIMER_REF_FREQ_HZ 31250000
37 37
38#define ROOTRW (S_IRWXU|S_IRGRP|S_IROTH)
38 39
39static ssize_t elcg_enable_store(struct device *device, 40static ssize_t elcg_enable_store(struct device *device,
40 struct device_attribute *attr, const char *buf, size_t count) 41 struct device_attribute *attr, const char *buf, size_t count)
@@ -73,7 +74,7 @@ static ssize_t elcg_enable_read(struct device *device,
73 return sprintf(buf, "%d\n", g->elcg_enabled ? 1 : 0); 74 return sprintf(buf, "%d\n", g->elcg_enabled ? 1 : 0);
74} 75}
75 76
76static DEVICE_ATTR(elcg_enable, S_IRWXUGO, elcg_enable_read, elcg_enable_store); 77static DEVICE_ATTR(elcg_enable, ROOTRW, elcg_enable_read, elcg_enable_store);
77 78
78static ssize_t blcg_enable_store(struct device *device, 79static ssize_t blcg_enable_store(struct device *device,
79 struct device_attribute *attr, const char *buf, size_t count) 80 struct device_attribute *attr, const char *buf, size_t count)
@@ -109,7 +110,8 @@ static ssize_t blcg_enable_read(struct device *device,
109 return sprintf(buf, "%d\n", g->blcg_enabled ? 1 : 0); 110 return sprintf(buf, "%d\n", g->blcg_enabled ? 1 : 0);
110} 111}
111 112
112static DEVICE_ATTR(blcg_enable, S_IRWXUGO, blcg_enable_read, blcg_enable_store); 113
114static DEVICE_ATTR(blcg_enable, ROOTRW, blcg_enable_read, blcg_enable_store);
113 115
114static ssize_t slcg_enable_store(struct device *device, 116static ssize_t slcg_enable_store(struct device *device,
115 struct device_attribute *attr, const char *buf, size_t count) 117 struct device_attribute *attr, const char *buf, size_t count)
@@ -151,7 +153,7 @@ static ssize_t slcg_enable_read(struct device *device,
151 return sprintf(buf, "%d\n", g->slcg_enabled ? 1 : 0); 153 return sprintf(buf, "%d\n", g->slcg_enabled ? 1 : 0);
152} 154}
153 155
154static DEVICE_ATTR(slcg_enable, S_IRWXUGO, slcg_enable_read, slcg_enable_store); 156static DEVICE_ATTR(slcg_enable, ROOTRW, slcg_enable_read, slcg_enable_store);
155 157
156static ssize_t ptimer_scale_factor_show(struct device *dev, 158static ssize_t ptimer_scale_factor_show(struct device *dev,
157 struct device_attribute *attr, 159 struct device_attribute *attr,
@@ -203,7 +205,7 @@ static ssize_t railgate_delay_show(struct device *dev,
203 struct gk20a_platform *platform = dev_get_drvdata(dev); 205 struct gk20a_platform *platform = dev_get_drvdata(dev);
204 return snprintf(buf, PAGE_SIZE, "%d\n", platform->railgate_delay); 206 return snprintf(buf, PAGE_SIZE, "%d\n", platform->railgate_delay);
205} 207}
206static DEVICE_ATTR(railgate_delay, S_IRWXUGO, railgate_delay_show, 208static DEVICE_ATTR(railgate_delay, ROOTRW, railgate_delay_show,
207 railgate_delay_store); 209 railgate_delay_store);
208 210
209static ssize_t clockgate_delay_store(struct device *dev, 211static ssize_t clockgate_delay_store(struct device *dev,
@@ -229,7 +231,7 @@ static ssize_t clockgate_delay_show(struct device *dev,
229 struct gk20a_platform *platform = dev_get_drvdata(dev); 231 struct gk20a_platform *platform = dev_get_drvdata(dev);
230 return snprintf(buf, PAGE_SIZE, "%d\n", platform->clockgate_delay); 232 return snprintf(buf, PAGE_SIZE, "%d\n", platform->clockgate_delay);
231} 233}
232static DEVICE_ATTR(clockgate_delay, S_IRWXUGO, clockgate_delay_show, 234static DEVICE_ATTR(clockgate_delay, ROOTRW, clockgate_delay_show,
233 clockgate_delay_store); 235 clockgate_delay_store);
234 236
235static ssize_t counters_show(struct device *dev, 237static ssize_t counters_show(struct device *dev,
@@ -305,7 +307,7 @@ static ssize_t elpg_enable_read(struct device *device,
305 return sprintf(buf, "%d\n", g->elpg_enabled ? 1 : 0); 307 return sprintf(buf, "%d\n", g->elpg_enabled ? 1 : 0);
306} 308}
307 309
308static DEVICE_ATTR(elpg_enable, S_IRWXUGO, elpg_enable_read, elpg_enable_store); 310static DEVICE_ATTR(elpg_enable, ROOTRW, elpg_enable_read, elpg_enable_store);
309 311
310void gk20a_remove_sysfs(struct device *dev) 312void gk20a_remove_sysfs(struct device *dev)
311{ 313{