summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSandeep Shinde <sashinde@nvidia.com>2017-08-24 02:42:42 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-07 23:07:13 -0400
commit33f192b2f781007fb7f9598613ce3811f3f39237 (patch)
treee0d559b108b97f01db020ec257b45eded289a02c /drivers/gpu
parent70c4496ca7add205f604c5c7fec8c16033394ba0 (diff)
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 <sashinde@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1544104 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> (cherry picked from commit aa4daddda23aa44a84464200f497eac802a8e6ce) Reviewed-on: https://git-master.nvidia.com/r/1543355 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/common/linux/sysfs.c29
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.c24
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/hw/gp10b/hw_gr_gp10b.h4
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
928static DEVICE_ATTR(czf_bypass, ROOTRW, czf_bypass_read, czf_bypass_store); 928static DEVICE_ATTR(czf_bypass, ROOTRW, czf_bypass_read, czf_bypass_store);
929 929
930static 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
947static 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
955static DEVICE_ATTR(pd_max_batches, ROOTRW, pd_max_batches_read, pd_max_batches_store);
956
930 957
931void nvgpu_remove_sysfs(struct device *dev) 958void 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}
1665static inline u32 gr_pd_ab_dist_cfg1_max_batches_f(u32 v)
1666{
1667 return (v & 0xffff) << 0;
1668}
1665static inline u32 gr_pd_ab_dist_cfg1_max_batches_init_f(void) 1669static inline u32 gr_pd_ab_dist_cfg1_max_batches_init_f(void)
1666{ 1670{
1667 return 0xffff; 1671 return 0xffff;