From 33f192b2f781007fb7f9598613ce3811f3f39237 Mon Sep 17 00:00:00 2001 From: Sandeep Shinde Date: Thu, 24 Aug 2017 12:12:42 +0530 Subject: gpu: nvgpu: Add pd_max_batches sysfs node for gp10b Add a new sysfs node pd_max_batches for setting max batches value in NV_PGRAPH_PRI_PD_AB_DIST_CONFIG_1_MAX_BATCHES register which controls max number of batches per alpha-beta transition stored in PD. Bug 1927124 Change-Id: I2817f2d70dab348d8b0b8ba19bf1e9b9d23ca907 Signed-off-by: Sandeep Shinde Reviewed-on: https://git-master.nvidia.com/r/1544104 Reviewed-by: Bharat Nihalani (cherry picked from commit aa4daddda23aa44a84464200f497eac802a8e6ce) Reviewed-on: https://git-master.nvidia.com/r/1543355 Reviewed-by: svc-mobile-coverity Reviewed-by: svccoveritychecker Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/linux/sysfs.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c index 1b59c480..7b614023 100644 --- a/drivers/gpu/nvgpu/common/linux/sysfs.c +++ b/drivers/gpu/nvgpu/common/linux/sysfs.c @@ -927,6 +927,33 @@ static ssize_t czf_bypass_read(struct device *dev, static DEVICE_ATTR(czf_bypass, ROOTRW, czf_bypass_read, czf_bypass_store); +static ssize_t pd_max_batches_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct gk20a *g = get_gk20a(dev); + unsigned long val; + + if (kstrtoul(buf, 10, &val) < 0) + return -EINVAL; + + if (val > 64) + return -EINVAL; + + g->gr.pd_max_batches = val; + + return count; +} + +static ssize_t pd_max_batches_read(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct gk20a *g = get_gk20a(dev); + + return sprintf(buf, "%d\n", g->gr.pd_max_batches); +} + +static DEVICE_ATTR(pd_max_batches, ROOTRW, pd_max_batches_read, pd_max_batches_store); + void nvgpu_remove_sysfs(struct device *dev) { @@ -961,6 +988,7 @@ void nvgpu_remove_sysfs(struct device *dev) #endif device_remove_file(dev, &dev_attr_czf_bypass); + device_remove_file(dev, &dev_attr_pd_max_batches); if (strcmp(dev_name(dev), "gpu.0")) { struct kobject *kobj = &dev->kobj; @@ -1006,6 +1034,7 @@ int nvgpu_create_sysfs(struct device *dev) #endif error |= device_create_file(dev, &dev_attr_czf_bypass); + error |= device_create_file(dev, &dev_attr_pd_max_batches); if (strcmp(dev_name(dev), "gpu.0")) { struct kobject *kobj = &dev->kobj; -- cgit v1.2.2