diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2018-08-17 17:31:11 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-07 00:33:30 -0400 |
commit | 034e23c197541e0e8ac6a4d95b1d3b6d1be885cd (patch) | |
tree | 0568a16cb6b5eddc52a1e5aa070b471fe7a0845d | |
parent | c4ac750e985dddebe25308c7f9bd0a27a98feaa8 (diff) |
gpu: nvgpu: add gpu_powered_on sysfs
Add sysfs to indicate if GPU has ever been powered on.
This allows an application to avoid booting dGPU, when there is no
need for it. For instance the fan controller can check this value,
and refrain from booting the GPU, only to check the temperature.
This will save power, and also avoid locking some registers which
currently prevent from using VBIOS update tool.
Bug 200408936
Change-Id: I6344001e91e9eee8762ff8b227ca6698d8c6786f
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1802098
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/sysfs.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c index 5eef8bfa..9e48e45d 100644 --- a/drivers/gpu/nvgpu/os/linux/sysfs.c +++ b/drivers/gpu/nvgpu/os/linux/sysfs.c | |||
@@ -301,6 +301,17 @@ static DEVICE_ATTR(ptimer_src_freq, | |||
301 | NULL); | 301 | NULL); |
302 | 302 | ||
303 | 303 | ||
304 | static ssize_t gpu_powered_on_show(struct device *dev, | ||
305 | struct device_attribute *attr, | ||
306 | char *buf) | ||
307 | { | ||
308 | struct gk20a *g = get_gk20a(dev); | ||
309 | |||
310 | return snprintf(buf, PAGE_SIZE, "%u\n", g->power_on); | ||
311 | } | ||
312 | |||
313 | static DEVICE_ATTR(gpu_powered_on, S_IRUGO, gpu_powered_on_show, NULL); | ||
314 | |||
304 | #if defined(CONFIG_PM) | 315 | #if defined(CONFIG_PM) |
305 | static ssize_t railgate_enable_store(struct device *dev, | 316 | static ssize_t railgate_enable_store(struct device *dev, |
306 | struct device_attribute *attr, const char *buf, size_t count) | 317 | struct device_attribute *attr, const char *buf, size_t count) |
@@ -1234,6 +1245,7 @@ void nvgpu_remove_sysfs(struct device *dev) | |||
1234 | device_remove_file(dev, &dev_attr_pd_max_batches); | 1245 | device_remove_file(dev, &dev_attr_pd_max_batches); |
1235 | device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_count); | 1246 | device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_count); |
1236 | device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_unit); | 1247 | device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_unit); |
1248 | device_remove_file(dev, &dev_attr_gpu_powered_on); | ||
1237 | 1249 | ||
1238 | device_remove_file(dev, &dev_attr_comptag_mem_deduct); | 1250 | device_remove_file(dev, &dev_attr_comptag_mem_deduct); |
1239 | 1251 | ||
@@ -1288,6 +1300,7 @@ int nvgpu_create_sysfs(struct device *dev) | |||
1288 | error |= device_create_file(dev, &dev_attr_pd_max_batches); | 1300 | error |= device_create_file(dev, &dev_attr_pd_max_batches); |
1289 | error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_count); | 1301 | error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_count); |
1290 | error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_unit); | 1302 | error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_unit); |
1303 | error |= device_create_file(dev, &dev_attr_gpu_powered_on); | ||
1291 | 1304 | ||
1292 | error |= device_create_file(dev, &dev_attr_comptag_mem_deduct); | 1305 | error |= device_create_file(dev, &dev_attr_comptag_mem_deduct); |
1293 | 1306 | ||