diff options
author | sujeet baranwal <sbaranwal@nvidia.com> | 2014-08-07 20:04:18 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:10:49 -0400 |
commit | 5db7a42055eb2239b5a3a597935c27ac0b920d3d (patch) | |
tree | 778d28ffd3e32200a6a3ff978c3ad02146281234 /drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |
parent | 42d37357f8b4d2f2433f43f951dcbc3978d9f949 (diff) |
gpu: sysfs mode for allowing access to registers
Through this sysfs entry, the register space becomes accessible.
This is be accessible root-only.
Bug 1523403
Change-Id: Ia46f130a0cfd8324c5b675d19e7cbfba9dcb17ca
Signed-off-by: sujeet baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/454198
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 97a0452c..7e0183ca 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -439,6 +439,36 @@ static ssize_t aelpg_enable_read(struct device *device, | |||
439 | static DEVICE_ATTR(aelpg_enable, ROOTRW, | 439 | static DEVICE_ATTR(aelpg_enable, ROOTRW, |
440 | aelpg_enable_read, aelpg_enable_store); | 440 | aelpg_enable_read, aelpg_enable_store); |
441 | 441 | ||
442 | |||
443 | static ssize_t allow_all_enable_read(struct device *device, | ||
444 | struct device_attribute *attr, char *buf) | ||
445 | { | ||
446 | struct platform_device *ndev = to_platform_device(device); | ||
447 | struct gk20a *g = get_gk20a(ndev); | ||
448 | return sprintf(buf, "%d\n", g->allow_all ? 1 : 0); | ||
449 | } | ||
450 | |||
451 | static ssize_t allow_all_enable_store(struct device *device, | ||
452 | struct device_attribute *attr, const char *buf, size_t count) | ||
453 | { | ||
454 | struct platform_device *ndev = to_platform_device(device); | ||
455 | struct gk20a *g = get_gk20a(ndev); | ||
456 | unsigned long val = 0; | ||
457 | int err; | ||
458 | |||
459 | if (kstrtoul(buf, 10, &val) < 0) | ||
460 | return -EINVAL; | ||
461 | |||
462 | err = gk20a_busy(g->dev); | ||
463 | g->allow_all = (val ? true : false); | ||
464 | gk20a_idle(g->dev); | ||
465 | |||
466 | return count; | ||
467 | } | ||
468 | |||
469 | static DEVICE_ATTR(allow_all, ROOTRW, | ||
470 | allow_all_enable_read, allow_all_enable_store); | ||
471 | |||
442 | #ifdef CONFIG_PM_RUNTIME | 472 | #ifdef CONFIG_PM_RUNTIME |
443 | static ssize_t force_idle_store(struct device *device, | 473 | static ssize_t force_idle_store(struct device *device, |
444 | struct device_attribute *attr, const char *buf, size_t count) | 474 | struct device_attribute *attr, const char *buf, size_t count) |
@@ -509,6 +539,7 @@ void gk20a_remove_sysfs(struct device *dev) | |||
509 | #endif | 539 | #endif |
510 | device_remove_file(dev, &dev_attr_aelpg_param); | 540 | device_remove_file(dev, &dev_attr_aelpg_param); |
511 | device_remove_file(dev, &dev_attr_aelpg_enable); | 541 | device_remove_file(dev, &dev_attr_aelpg_enable); |
542 | device_remove_file(dev, &dev_attr_allow_all); | ||
512 | 543 | ||
513 | if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) | 544 | if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) |
514 | sysfs_remove_link(&dev->kobj, dev_name(dev)); | 545 | sysfs_remove_link(&dev->kobj, dev_name(dev)); |
@@ -534,6 +565,7 @@ void gk20a_create_sysfs(struct platform_device *dev) | |||
534 | #endif | 565 | #endif |
535 | error |= device_create_file(&dev->dev, &dev_attr_aelpg_param); | 566 | error |= device_create_file(&dev->dev, &dev_attr_aelpg_param); |
536 | error |= device_create_file(&dev->dev, &dev_attr_aelpg_enable); | 567 | error |= device_create_file(&dev->dev, &dev_attr_aelpg_enable); |
568 | error |= device_create_file(&dev->dev, &dev_attr_allow_all); | ||
537 | 569 | ||
538 | if (g->host1x_dev && (dev->dev.parent != &g->host1x_dev->dev)) | 570 | if (g->host1x_dev && (dev->dev.parent != &g->host1x_dev->dev)) |
539 | error |= sysfs_create_link(&g->host1x_dev->dev.kobj, | 571 | error |= sysfs_create_link(&g->host1x_dev->dev.kobj, |