diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/sysfs.c | 29 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.h | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 24 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_gr_gp10b.h | 4 |
4 files changed, 52 insertions, 6 deletions
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, | |||
927 | 927 | ||
928 | static DEVICE_ATTR(czf_bypass, ROOTRW, czf_bypass_read, czf_bypass_store); | 928 | static DEVICE_ATTR(czf_bypass, ROOTRW, czf_bypass_read, czf_bypass_store); |
929 | 929 | ||
930 | static ssize_t pd_max_batches_store(struct device *dev, | ||
931 | struct device_attribute *attr, const char *buf, size_t count) | ||
932 | { | ||
933 | struct gk20a *g = get_gk20a(dev); | ||
934 | unsigned long val; | ||
935 | |||
936 | if (kstrtoul(buf, 10, &val) < 0) | ||
937 | return -EINVAL; | ||
938 | |||
939 | if (val > 64) | ||
940 | return -EINVAL; | ||
941 | |||
942 | g->gr.pd_max_batches = val; | ||
943 | |||
944 | return count; | ||
945 | } | ||
946 | |||
947 | static ssize_t pd_max_batches_read(struct device *dev, | ||
948 | struct device_attribute *attr, char *buf) | ||
949 | { | ||
950 | struct gk20a *g = get_gk20a(dev); | ||
951 | |||
952 | return sprintf(buf, "%d\n", g->gr.pd_max_batches); | ||
953 | } | ||
954 | |||
955 | static DEVICE_ATTR(pd_max_batches, ROOTRW, pd_max_batches_read, pd_max_batches_store); | ||
956 | |||
930 | 957 | ||
931 | void nvgpu_remove_sysfs(struct device *dev) | 958 | void nvgpu_remove_sysfs(struct device *dev) |
932 | { | 959 | { |
@@ -961,6 +988,7 @@ void nvgpu_remove_sysfs(struct device *dev) | |||
961 | #endif | 988 | #endif |
962 | 989 | ||
963 | device_remove_file(dev, &dev_attr_czf_bypass); | 990 | device_remove_file(dev, &dev_attr_czf_bypass); |
991 | device_remove_file(dev, &dev_attr_pd_max_batches); | ||
964 | 992 | ||
965 | if (strcmp(dev_name(dev), "gpu.0")) { | 993 | if (strcmp(dev_name(dev), "gpu.0")) { |
966 | struct kobject *kobj = &dev->kobj; | 994 | struct kobject *kobj = &dev->kobj; |
@@ -1006,6 +1034,7 @@ int nvgpu_create_sysfs(struct device *dev) | |||
1006 | #endif | 1034 | #endif |
1007 | 1035 | ||
1008 | error |= device_create_file(dev, &dev_attr_czf_bypass); | 1036 | error |= device_create_file(dev, &dev_attr_czf_bypass); |
1037 | error |= device_create_file(dev, &dev_attr_pd_max_batches); | ||
1009 | 1038 | ||
1010 | if (strcmp(dev_name(dev), "gpu.0")) { | 1039 | if (strcmp(dev_name(dev), "gpu.0")) { |
1011 | struct kobject *kobj = &dev->kobj; | 1040 | struct kobject *kobj = &dev->kobj; |
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h index 400b7feb..42296084 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h | |||
@@ -322,6 +322,7 @@ struct gr_gk20a { | |||
322 | u32 alpha_cb_size; | 322 | u32 alpha_cb_size; |
323 | u32 timeslice_mode; | 323 | u32 timeslice_mode; |
324 | u32 czf_bypass; | 324 | u32 czf_bypass; |
325 | u32 pd_max_batches; | ||
325 | 326 | ||
326 | struct gr_ctx_buffer_desc global_ctx_buffer[NR_GLOBAL_CTX_BUF]; | 327 | struct gr_ctx_buffer_desc global_ctx_buffer[NR_GLOBAL_CTX_BUF]; |
327 | 328 | ||
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 74af9817..ee7118e7 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |||
@@ -420,9 +420,15 @@ int gr_gp10b_commit_global_cb_manager(struct gk20a *g, | |||
420 | gr_gpc0_ppc0_cbm_beta_cb_size_v_granularity_v()) / | 420 | gr_gpc0_ppc0_cbm_beta_cb_size_v_granularity_v()) / |
421 | gr_pd_ab_dist_cfg1_max_output_granularity_v(); | 421 | gr_pd_ab_dist_cfg1_max_output_granularity_v(); |
422 | 422 | ||
423 | gr_gk20a_ctx_patch_write(g, ch_ctx, gr_pd_ab_dist_cfg1_r(), | 423 | if (g->gr.pd_max_batches) { |
424 | gr_pd_ab_dist_cfg1_max_output_f(pd_ab_max_output) | | 424 | gr_gk20a_ctx_patch_write(g, ch_ctx, gr_pd_ab_dist_cfg1_r(), |
425 | gr_pd_ab_dist_cfg1_max_batches_init_f(), patch); | 425 | gr_pd_ab_dist_cfg1_max_output_f(pd_ab_max_output) | |
426 | gr_pd_ab_dist_cfg1_max_batches_f(g->gr.pd_max_batches), patch); | ||
427 | } else { | ||
428 | gr_gk20a_ctx_patch_write(g, ch_ctx, gr_pd_ab_dist_cfg1_r(), | ||
429 | gr_pd_ab_dist_cfg1_max_output_f(pd_ab_max_output) | | ||
430 | gr_pd_ab_dist_cfg1_max_batches_init_f(), patch); | ||
431 | } | ||
426 | 432 | ||
427 | attrib_offset_in_chunk = alpha_offset_in_chunk + | 433 | attrib_offset_in_chunk = alpha_offset_in_chunk + |
428 | gr->tpc_count * gr->alpha_cb_size; | 434 | gr->tpc_count * gr->alpha_cb_size; |
@@ -751,9 +757,15 @@ void gr_gp10b_set_alpha_circular_buffer_size(struct gk20a *g, u32 data) | |||
751 | gr_gpc0_ppc0_cbm_alpha_cb_size_v_granularity_v() / | 757 | gr_gpc0_ppc0_cbm_alpha_cb_size_v_granularity_v() / |
752 | gr_pd_ab_dist_cfg1_max_output_granularity_v(); | 758 | gr_pd_ab_dist_cfg1_max_output_granularity_v(); |
753 | 759 | ||
754 | gk20a_writel(g, gr_pd_ab_dist_cfg1_r(), | 760 | if (g->gr.pd_max_batches) { |
755 | gr_pd_ab_dist_cfg1_max_output_f(pd_ab_max_output) | | 761 | gk20a_writel(g, gr_pd_ab_dist_cfg1_r(), |
756 | gr_pd_ab_dist_cfg1_max_batches_init_f()); | 762 | gr_pd_ab_dist_cfg1_max_output_f(pd_ab_max_output) | |
763 | gr_pd_ab_dist_cfg1_max_batches_f(g->gr.pd_max_batches)); | ||
764 | } else { | ||
765 | gk20a_writel(g, gr_pd_ab_dist_cfg1_r(), | ||
766 | gr_pd_ab_dist_cfg1_max_output_f(pd_ab_max_output) | | ||
767 | gr_pd_ab_dist_cfg1_max_batches_init_f()); | ||
768 | } | ||
757 | 769 | ||
758 | for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) { | 770 | for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) { |
759 | stride = gpc_stride * gpc_index; | 771 | stride = gpc_stride * gpc_index; |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_gr_gp10b.h b/drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_gr_gp10b.h index fe902cbb..e56923c6 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_gr_gp10b.h +++ b/drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_gr_gp10b.h | |||
@@ -1662,6 +1662,10 @@ static inline u32 gr_pd_ab_dist_cfg1_r(void) | |||
1662 | { | 1662 | { |
1663 | return 0x004064c4; | 1663 | return 0x004064c4; |
1664 | } | 1664 | } |
1665 | static inline u32 gr_pd_ab_dist_cfg1_max_batches_f(u32 v) | ||
1666 | { | ||
1667 | return (v & 0xffff) << 0; | ||
1668 | } | ||
1665 | static inline u32 gr_pd_ab_dist_cfg1_max_batches_init_f(void) | 1669 | static inline u32 gr_pd_ab_dist_cfg1_max_batches_init_f(void) |
1666 | { | 1670 | { |
1667 | return 0xffff; | 1671 | return 0xffff; |