summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-11-07 14:01:26 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-13 13:56:54 -0500
commit8e611fb654e3f13258cd481cfd33d35d8d0fb8bb (patch)
treede5ed1ab307e98e4dd917a34b9e9bd75dddab96e
parente728fbecba0389c084bd52f6f6500d66982427fb (diff)
gpu: nvgpu: Hard code map_buffer_batch_limit
Add a hard coded #define for map_buffer_batch_limit and use that insted of querying from GPU characteristics. Also add an nvgpu_is_enabled() flag for disabling batch mapping, and set map_buffer_batch_limit to zero if batch mapping is disabled. JIRA NVGPU-388 Change-Id: Ic91feea638d0f47c5c22321886cfc75e97259dc3 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1593690 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_as.c5
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_as.h4
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c3
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c3
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/enabled.h2
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c2
6 files changed, 13 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_as.c b/drivers/gpu/nvgpu/common/linux/ioctl_as.c
index f23dc53c..848fee04 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_as.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_as.c
@@ -112,7 +112,6 @@ static int gk20a_as_ioctl_map_buffer_batch(
112 struct gk20a_as_share *as_share, 112 struct gk20a_as_share *as_share,
113 struct nvgpu_as_map_buffer_batch_args *args) 113 struct nvgpu_as_map_buffer_batch_args *args)
114{ 114{
115 struct gk20a *g = as_share->vm->mm->g;
116 u32 i; 115 u32 i;
117 int err = 0; 116 int err = 0;
118 117
@@ -127,8 +126,8 @@ static int gk20a_as_ioctl_map_buffer_batch(
127 126
128 gk20a_dbg_fn(""); 127 gk20a_dbg_fn("");
129 128
130 if (args->num_unmaps > g->gpu_characteristics.map_buffer_batch_limit || 129 if (args->num_unmaps > NVGPU_IOCTL_AS_MAP_BUFFER_BATCH_LIMIT ||
131 args->num_maps > g->gpu_characteristics.map_buffer_batch_limit) 130 args->num_maps > NVGPU_IOCTL_AS_MAP_BUFFER_BATCH_LIMIT)
132 return -EINVAL; 131 return -EINVAL;
133 132
134 nvgpu_vm_mapping_batch_start(&batch); 133 nvgpu_vm_mapping_batch_start(&batch);
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_as.h b/drivers/gpu/nvgpu/common/linux/ioctl_as.h
index ae6690a1..b3de3782 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_as.h
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_as.h
@@ -18,6 +18,10 @@
18struct inode; 18struct inode;
19struct file; 19struct file;
20 20
21/* MAP_BUFFER_BATCH_LIMIT: the upper limit for num_unmaps and
22 * num_maps */
23#define NVGPU_IOCTL_AS_MAP_BUFFER_BATCH_LIMIT 256
24
21/* struct file_operations driver interface */ 25/* struct file_operations driver interface */
22int gk20a_as_dev_open(struct inode *inode, struct file *filp); 26int gk20a_as_dev_open(struct inode *inode, struct file *filp);
23int gk20a_as_dev_release(struct inode *inode, struct file *filp); 27int gk20a_as_dev_release(struct inode *inode, struct file *filp);
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index 3c6b1b26..b77855f4 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -34,6 +34,7 @@
34 34
35#include "ioctl_ctrl.h" 35#include "ioctl_ctrl.h"
36#include "ioctl_dbg.h" 36#include "ioctl_dbg.h"
37#include "ioctl_as.h"
37#ifdef CONFIG_TEGRA_19x_GPU 38#ifdef CONFIG_TEGRA_19x_GPU
38#include "common/linux/ioctl_ctrl_t19x.h" 39#include "common/linux/ioctl_ctrl_t19x.h"
39#endif 40#endif
@@ -209,6 +210,8 @@ gk20a_ctrl_ioctl_gpu_characteristics(
209 pgpu->impl = g->params.gpu_impl; 210 pgpu->impl = g->params.gpu_impl;
210 pgpu->rev = g->params.gpu_rev; 211 pgpu->rev = g->params.gpu_rev;
211 pgpu->reg_ops_limit = NVGPU_IOCTL_DBG_REG_OPS_LIMIT; 212 pgpu->reg_ops_limit = NVGPU_IOCTL_DBG_REG_OPS_LIMIT;
213 pgpu->map_buffer_batch_limit = nvgpu_is_enabled(g, NVGPU_SUPPORT_MAP_BUFFER_BATCH) ?
214 NVGPU_IOCTL_AS_MAP_BUFFER_BATCH_LIMIT : 0;
212 pgpu->twod_class = g->ops.get_litter_value(g, GPU_LIT_TWOD_CLASS); 215 pgpu->twod_class = g->ops.get_litter_value(g, GPU_LIT_TWOD_CLASS);
213 pgpu->threed_class = g->ops.get_litter_value(g, GPU_LIT_THREED_CLASS); 216 pgpu->threed_class = g->ops.get_litter_value(g, GPU_LIT_THREED_CLASS);
214 pgpu->compute_class = g->ops.get_litter_value(g, GPU_LIT_COMPUTE_CLASS); 217 pgpu->compute_class = g->ops.get_litter_value(g, GPU_LIT_COMPUTE_CLASS);
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 2d7266ce..1d594d29 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -397,6 +397,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
397 397
398 __nvgpu_set_enabled(g, NVGPU_SUPPORT_PARTIAL_MAPPINGS, true); 398 __nvgpu_set_enabled(g, NVGPU_SUPPORT_PARTIAL_MAPPINGS, true);
399 __nvgpu_set_enabled(g, NVGPU_SUPPORT_MAP_DIRECT_KIND_CTRL, true); 399 __nvgpu_set_enabled(g, NVGPU_SUPPORT_MAP_DIRECT_KIND_CTRL, true);
400 __nvgpu_set_enabled(g, NVGPU_SUPPORT_MAP_BUFFER_BATCH, true);
400 401
401 if (IS_ENABLED(CONFIG_SYNC)) 402 if (IS_ENABLED(CONFIG_SYNC))
402 __nvgpu_set_enabled(g, NVGPU_SUPPORT_SYNC_FENCE_FDS, true); 403 __nvgpu_set_enabled(g, NVGPU_SUPPORT_SYNC_FENCE_FDS, true);
@@ -464,8 +465,6 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
464 gpu->cbc_cache_line_size = g->gr.cacheline_size; 465 gpu->cbc_cache_line_size = g->gr.cacheline_size;
465 gpu->cbc_comptags_per_line = g->gr.comptags_per_cacheline; 466 gpu->cbc_comptags_per_line = g->gr.comptags_per_cacheline;
466 467
467 gpu->map_buffer_batch_limit = 256;
468
469 if (g->ops.clk.get_maxrate) 468 if (g->ops.clk.get_maxrate)
470 gpu->max_freq = g->ops.clk.get_maxrate(&g->clk); 469 gpu->max_freq = g->ops.clk.get_maxrate(&g->clk);
471 470
diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
index f2b5dbf7..ad5b3db3 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
@@ -66,6 +66,8 @@ struct gk20a;
66#define NVGPU_SUPPORT_SPARSE_ALLOCS 23 66#define NVGPU_SUPPORT_SPARSE_ALLOCS 23
67/* Direct PTE kind control is supported (map_buffer_ex) */ 67/* Direct PTE kind control is supported (map_buffer_ex) */
68#define NVGPU_SUPPORT_MAP_DIRECT_KIND_CTRL 24 68#define NVGPU_SUPPORT_MAP_DIRECT_KIND_CTRL 24
69/* Support batch mapping */
70#define NVGPU_SUPPORT_MAP_BUFFER_BATCH 25
69 71
70/* 72/*
71 * Host flags 73 * Host flags
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index c753fd97..4a85ee71 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -368,7 +368,7 @@ int vgpu_init_gpu_characteristics(struct gk20a *g)
368 return err; 368 return err;
369 369
370 g->gpu_characteristics.max_freq = priv->constants.max_freq; 370 g->gpu_characteristics.max_freq = priv->constants.max_freq;
371 g->gpu_characteristics.map_buffer_batch_limit = 0; 371 __nvgpu_set_enabled(g, NVGPU_SUPPORT_MAP_BUFFER_BATCH, false);
372 372
373 /* features vgpu does not support */ 373 /* features vgpu does not support */
374 __nvgpu_set_enabled(g, NVGPU_SUPPORT_RESCHEDULE_RUNLIST, false); 374 __nvgpu_set_enabled(g, NVGPU_SUPPORT_RESCHEDULE_RUNLIST, false);