diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/sysfs.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c index afa08fc4..6709285d 100644 --- a/drivers/gpu/nvgpu/common/linux/sysfs.c +++ b/drivers/gpu/nvgpu/common/linux/sysfs.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "platform_gk20a.h" | 28 | #include "platform_gk20a.h" |
29 | #include "gk20a/pmu_gk20a.h" | 29 | #include "gk20a/pmu_gk20a.h" |
30 | #include "gk20a/gr_gk20a.h" | 30 | #include "gk20a/gr_gk20a.h" |
31 | #include "gv11b/gr_gv11b.h" | ||
31 | 32 | ||
32 | #define PTIMER_FP_FACTOR 1000000 | 33 | #define PTIMER_FP_FACTOR 1000000 |
33 | 34 | ||
@@ -990,6 +991,36 @@ static ssize_t gfxp_wfi_timeout_count_store(struct device *dev, | |||
990 | if (err) | 991 | if (err) |
991 | return err; | 992 | return err; |
992 | } | 993 | } |
994 | return count; | ||
995 | } | ||
996 | |||
997 | static ssize_t gfxp_wfi_timeout_unit_store(struct device *dev, | ||
998 | struct device_attribute *attr, const char *buf, size_t count) | ||
999 | { | ||
1000 | struct gk20a *g = get_gk20a(dev); | ||
1001 | struct gr_gk20a *gr = &g->gr; | ||
1002 | int err = -1; | ||
1003 | |||
1004 | if (count > 0 && buf[0] == 's') | ||
1005 | /* sysclk */ | ||
1006 | gr->gfxp_wfi_timeout_unit = GFXP_WFI_TIMEOUT_UNIT_SYSCLK; | ||
1007 | else | ||
1008 | /* usec */ | ||
1009 | gr->gfxp_wfi_timeout_unit = GFXP_WFI_TIMEOUT_UNIT_USEC; | ||
1010 | |||
1011 | if (g->ops.gr.init_preemption_state && g->power_on) { | ||
1012 | err = gk20a_busy(g); | ||
1013 | if (err) | ||
1014 | return err; | ||
1015 | |||
1016 | err = gr_gk20a_elpg_protected_call(g, | ||
1017 | g->ops.gr.init_preemption_state(g)); | ||
1018 | |||
1019 | gk20a_idle(g); | ||
1020 | |||
1021 | if (err) | ||
1022 | return err; | ||
1023 | } | ||
993 | 1024 | ||
994 | return count; | 1025 | return count; |
995 | } | 1026 | } |
@@ -1004,9 +1035,23 @@ static ssize_t gfxp_wfi_timeout_count_read(struct device *dev, | |||
1004 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 1035 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
1005 | } | 1036 | } |
1006 | 1037 | ||
1038 | static ssize_t gfxp_wfi_timeout_unit_read(struct device *dev, | ||
1039 | struct device_attribute *attr, char *buf) | ||
1040 | { | ||
1041 | struct gk20a *g = get_gk20a(dev); | ||
1042 | struct gr_gk20a *gr = &g->gr; | ||
1043 | |||
1044 | if (gr->gfxp_wfi_timeout_unit == GFXP_WFI_TIMEOUT_UNIT_USEC) | ||
1045 | return snprintf(buf, PAGE_SIZE, "usec\n"); | ||
1046 | else | ||
1047 | return snprintf(buf, PAGE_SIZE, "sysclk\n"); | ||
1048 | } | ||
1049 | |||
1007 | static DEVICE_ATTR(gfxp_wfi_timeout_count, (S_IRWXU|S_IRGRP|S_IROTH), | 1050 | static DEVICE_ATTR(gfxp_wfi_timeout_count, (S_IRWXU|S_IRGRP|S_IROTH), |
1008 | gfxp_wfi_timeout_count_read, gfxp_wfi_timeout_count_store); | 1051 | gfxp_wfi_timeout_count_read, gfxp_wfi_timeout_count_store); |
1009 | 1052 | ||
1053 | static DEVICE_ATTR(gfxp_wfi_timeout_unit, (S_IRWXU|S_IRGRP|S_IROTH), | ||
1054 | gfxp_wfi_timeout_unit_read, gfxp_wfi_timeout_unit_store); | ||
1010 | 1055 | ||
1011 | void nvgpu_remove_sysfs(struct device *dev) | 1056 | void nvgpu_remove_sysfs(struct device *dev) |
1012 | { | 1057 | { |
@@ -1045,6 +1090,7 @@ void nvgpu_remove_sysfs(struct device *dev) | |||
1045 | device_remove_file(dev, &dev_attr_czf_bypass); | 1090 | device_remove_file(dev, &dev_attr_czf_bypass); |
1046 | device_remove_file(dev, &dev_attr_pd_max_batches); | 1091 | device_remove_file(dev, &dev_attr_pd_max_batches); |
1047 | device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_count); | 1092 | device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_count); |
1093 | device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_unit); | ||
1048 | 1094 | ||
1049 | if (strcmp(dev_name(dev), "gpu.0")) { | 1095 | if (strcmp(dev_name(dev), "gpu.0")) { |
1050 | struct kobject *kobj = &dev->kobj; | 1096 | struct kobject *kobj = &dev->kobj; |
@@ -1094,6 +1140,7 @@ int nvgpu_create_sysfs(struct device *dev) | |||
1094 | error |= device_create_file(dev, &dev_attr_czf_bypass); | 1140 | error |= device_create_file(dev, &dev_attr_czf_bypass); |
1095 | error |= device_create_file(dev, &dev_attr_pd_max_batches); | 1141 | error |= device_create_file(dev, &dev_attr_pd_max_batches); |
1096 | error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_count); | 1142 | error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_count); |
1143 | error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_unit); | ||
1097 | 1144 | ||
1098 | if (strcmp(dev_name(dev), "gpu.0")) { | 1145 | if (strcmp(dev_name(dev), "gpu.0")) { |
1099 | struct kobject *kobj = &dev->kobj; | 1146 | struct kobject *kobj = &dev->kobj; |