diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/sysfs.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c index 7b614023..6897fae8 100644 --- a/drivers/gpu/nvgpu/common/linux/sysfs.c +++ b/drivers/gpu/nvgpu/common/linux/sysfs.c | |||
@@ -954,6 +954,52 @@ static ssize_t pd_max_batches_read(struct device *dev, | |||
954 | 954 | ||
955 | static DEVICE_ATTR(pd_max_batches, ROOTRW, pd_max_batches_read, pd_max_batches_store); | 955 | static DEVICE_ATTR(pd_max_batches, ROOTRW, pd_max_batches_read, pd_max_batches_store); |
956 | 956 | ||
957 | static ssize_t gfxp_wfi_timeout_count_store(struct device *dev, | ||
958 | struct device_attribute *attr, const char *buf, size_t count) | ||
959 | { | ||
960 | struct gk20a *g = get_gk20a(dev); | ||
961 | struct gr_gk20a *gr = &g->gr; | ||
962 | unsigned long val = 0; | ||
963 | int err = -1; | ||
964 | |||
965 | if (kstrtoul(buf, 10, &val) < 0) | ||
966 | return -EINVAL; | ||
967 | |||
968 | if (val >= 100*1000*1000) /* 100ms @ 1Ghz */ | ||
969 | return -EINVAL; | ||
970 | |||
971 | gr->gfxp_wfi_timeout_count = val; | ||
972 | |||
973 | if (g->ops.gr.init_preemption_state && g->power_on) { | ||
974 | err = gk20a_busy(g); | ||
975 | if (err) | ||
976 | return err; | ||
977 | |||
978 | err = gr_gk20a_elpg_protected_call(g, | ||
979 | g->ops.gr.init_preemption_state(g)); | ||
980 | |||
981 | gk20a_idle(g); | ||
982 | |||
983 | if (err) | ||
984 | return err; | ||
985 | } | ||
986 | |||
987 | return count; | ||
988 | } | ||
989 | |||
990 | static ssize_t gfxp_wfi_timeout_count_read(struct device *dev, | ||
991 | struct device_attribute *attr, char *buf) | ||
992 | { | ||
993 | struct gk20a *g = get_gk20a(dev); | ||
994 | struct gr_gk20a *gr = &g->gr; | ||
995 | u32 val = gr->gfxp_wfi_timeout_count; | ||
996 | |||
997 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | ||
998 | } | ||
999 | |||
1000 | static DEVICE_ATTR(gfxp_wfi_timeout_count, (S_IRWXU|S_IRGRP|S_IROTH), | ||
1001 | gfxp_wfi_timeout_count_read, gfxp_wfi_timeout_count_store); | ||
1002 | |||
957 | 1003 | ||
958 | void nvgpu_remove_sysfs(struct device *dev) | 1004 | void nvgpu_remove_sysfs(struct device *dev) |
959 | { | 1005 | { |
@@ -989,6 +1035,7 @@ void nvgpu_remove_sysfs(struct device *dev) | |||
989 | 1035 | ||
990 | device_remove_file(dev, &dev_attr_czf_bypass); | 1036 | device_remove_file(dev, &dev_attr_czf_bypass); |
991 | device_remove_file(dev, &dev_attr_pd_max_batches); | 1037 | device_remove_file(dev, &dev_attr_pd_max_batches); |
1038 | device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_count); | ||
992 | 1039 | ||
993 | if (strcmp(dev_name(dev), "gpu.0")) { | 1040 | if (strcmp(dev_name(dev), "gpu.0")) { |
994 | struct kobject *kobj = &dev->kobj; | 1041 | struct kobject *kobj = &dev->kobj; |
@@ -1035,6 +1082,7 @@ int nvgpu_create_sysfs(struct device *dev) | |||
1035 | 1082 | ||
1036 | error |= device_create_file(dev, &dev_attr_czf_bypass); | 1083 | error |= device_create_file(dev, &dev_attr_czf_bypass); |
1037 | error |= device_create_file(dev, &dev_attr_pd_max_batches); | 1084 | error |= device_create_file(dev, &dev_attr_pd_max_batches); |
1085 | error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_count); | ||
1038 | 1086 | ||
1039 | if (strcmp(dev_name(dev), "gpu.0")) { | 1087 | if (strcmp(dev_name(dev), "gpu.0")) { |
1040 | struct kobject *kobj = &dev->kobj; | 1088 | struct kobject *kobj = &dev->kobj; |