diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/sysfs.c | 47 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.h | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 29 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.h | 3 |
4 files changed, 71 insertions, 9 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; |
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h index 5c638a8d..3fcba678 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h | |||
@@ -377,6 +377,7 @@ struct gr_gk20a { | |||
377 | u32 czf_bypass; | 377 | u32 czf_bypass; |
378 | u32 pd_max_batches; | 378 | u32 pd_max_batches; |
379 | u32 gfxp_wfi_timeout_count; | 379 | u32 gfxp_wfi_timeout_count; |
380 | u32 gfxp_wfi_timeout_unit; | ||
380 | 381 | ||
381 | struct gr_ctx_buffer_desc global_ctx_buffer[NR_GLOBAL_CTX_BUF]; | 382 | struct gr_ctx_buffer_desc global_ctx_buffer[NR_GLOBAL_CTX_BUF]; |
382 | 383 | ||
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c index dee3b760..808cf19f 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c | |||
@@ -56,7 +56,7 @@ | |||
56 | #include <nvgpu/hw/gv11b/hw_therm_gv11b.h> | 56 | #include <nvgpu/hw/gv11b/hw_therm_gv11b.h> |
57 | #include <nvgpu/hw/gv11b/hw_fb_gv11b.h> | 57 | #include <nvgpu/hw/gv11b/hw_fb_gv11b.h> |
58 | 58 | ||
59 | #define GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT 1000 | 59 | #define GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT 100 |
60 | 60 | ||
61 | /* ecc scrubbing will done in 1 pri read cycle,but for safety used 10 retries */ | 61 | /* ecc scrubbing will done in 1 pri read cycle,but for safety used 10 retries */ |
62 | #define ECC_SCRUBBING_TIMEOUT_MAX 1000 | 62 | #define ECC_SCRUBBING_TIMEOUT_MAX 1000 |
@@ -1663,6 +1663,11 @@ void gr_gv11b_update_ctxsw_preemption_mode(struct gk20a *g, | |||
1663 | cbes_reserve), | 1663 | cbes_reserve), |
1664 | true); | 1664 | true); |
1665 | 1665 | ||
1666 | gr_gk20a_ctx_patch_write(g, gr_ctx, | ||
1667 | gr_fe_gfxp_wfi_timeout_r(), | ||
1668 | g->gr.gfxp_wfi_timeout_count, | ||
1669 | true); | ||
1670 | |||
1666 | gr_gk20a_ctx_patch_write_end(g, gr_ctx, true); | 1671 | gr_gk20a_ctx_patch_write_end(g, gr_ctx, true); |
1667 | } | 1672 | } |
1668 | 1673 | ||
@@ -4099,17 +4104,19 @@ int gr_gv11b_init_preemption_state(struct gk20a *g) | |||
4099 | { | 4104 | { |
4100 | u32 debug_2; | 4105 | u32 debug_2; |
4101 | struct gr_gk20a *gr = &g->gr; | 4106 | struct gr_gk20a *gr = &g->gr; |
4107 | u32 unit; | ||
4102 | 4108 | ||
4103 | nvgpu_log_fn(g, " "); | 4109 | nvgpu_log_fn(g, " "); |
4104 | 4110 | ||
4105 | gk20a_writel(g, gr_fe_gfxp_wfi_timeout_r(), | 4111 | if (gr->gfxp_wfi_timeout_unit == GFXP_WFI_TIMEOUT_UNIT_USEC) |
4106 | gr_fe_gfxp_wfi_timeout_count_f( | 4112 | unit = gr_debug_2_gfxp_wfi_timeout_unit_usec_f(); |
4107 | gr->gfxp_wfi_timeout_count)); | 4113 | else |
4114 | unit = gr_debug_2_gfxp_wfi_timeout_unit_sysclk_f(); | ||
4108 | 4115 | ||
4109 | debug_2 = gk20a_readl(g, gr_debug_2_r()); | 4116 | debug_2 = gk20a_readl(g, gr_debug_2_r()); |
4110 | debug_2 = set_field(debug_2, | 4117 | debug_2 = set_field(debug_2, |
4111 | gr_debug_2_gfxp_wfi_timeout_unit_m(), | 4118 | gr_debug_2_gfxp_wfi_timeout_unit_m(), |
4112 | gr_debug_2_gfxp_wfi_timeout_unit_usec_f()); | 4119 | unit); |
4113 | gk20a_writel(g, gr_debug_2_r(), debug_2); | 4120 | gk20a_writel(g, gr_debug_2_r(), debug_2); |
4114 | 4121 | ||
4115 | return 0; | 4122 | return 0; |
@@ -4117,14 +4124,18 @@ int gr_gv11b_init_preemption_state(struct gk20a *g) | |||
4117 | void gr_gv11b_init_gfxp_wfi_timeout_count(struct gk20a *g) | 4124 | void gr_gv11b_init_gfxp_wfi_timeout_count(struct gk20a *g) |
4118 | { | 4125 | { |
4119 | struct gr_gk20a *gr = &g->gr; | 4126 | struct gr_gk20a *gr = &g->gr; |
4120 | 4127 | gr->gfxp_wfi_timeout_unit = GFXP_WFI_TIMEOUT_UNIT_USEC; | |
4121 | gr->gfxp_wfi_timeout_count = GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT; | 4128 | gr->gfxp_wfi_timeout_count = GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT; |
4122 | } | 4129 | } |
4123 | 4130 | ||
4124 | unsigned long gr_gv11b_get_max_gfxp_wfi_timeout_count(struct gk20a *g) | 4131 | unsigned long gr_gv11b_get_max_gfxp_wfi_timeout_count(struct gk20a *g) |
4125 | { | 4132 | { |
4126 | /* 100 msec in usec count */ | 4133 | if (g->gr.gfxp_wfi_timeout_unit == GFXP_WFI_TIMEOUT_UNIT_USEC) |
4127 | return (100 * 1000UL); | 4134 | /* 100 msec in usec count */ |
4135 | return (100UL * 1000UL); | ||
4136 | else | ||
4137 | /* 100 msec for 1GHz clock */ | ||
4138 | return (100UL * 1000UL * 1000UL); | ||
4128 | } | 4139 | } |
4129 | 4140 | ||
4130 | static int gr_gv11b_ecc_scrub_is_done(struct gk20a *g, | 4141 | static int gr_gv11b_ecc_scrub_is_done(struct gk20a *g, |
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h index 2f8d2e17..0f42e795 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h | |||
@@ -34,6 +34,9 @@ | |||
34 | #define ZBC_STENCIL_CLEAR_FMT_INVAILD 0 | 34 | #define ZBC_STENCIL_CLEAR_FMT_INVAILD 0 |
35 | #define ZBC_STENCIL_CLEAR_FMT_U8 1 | 35 | #define ZBC_STENCIL_CLEAR_FMT_U8 1 |
36 | 36 | ||
37 | #define GFXP_WFI_TIMEOUT_UNIT_SYSCLK 0 | ||
38 | #define GFXP_WFI_TIMEOUT_UNIT_USEC 1 | ||
39 | |||
37 | struct gk20a; | 40 | struct gk20a; |
38 | struct gr_gk20a; | 41 | struct gr_gk20a; |
39 | struct zbc_entry; | 42 | struct zbc_entry; |