summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c
diff options
context:
space:
mode:
authorArto Merilainen <amerilainen@nvidia.com>2014-04-09 07:50:43 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:42 -0400
commit9984dff23326dbf28f89f2de23bc00edd4c519f9 (patch)
treedb992832a436cd90b8cca42beaaab27a953615ea /drivers/gpu/nvgpu/gm20b/ltc_gm20b.c
parent07a90307b09ee44701ed54af21fd234eba029986 (diff)
gpu: nvgpu: gm20b: Alloc phys mem for CBC in sim
CBC frontdoor access works incorrectly in the simulator if CBC is allocated from IOVA. This patch makes CBC allocation to happen from physical memory if are running in simulator. Bug 1409151 Change-Id: Ide08f4eab6911adc5737001c6d751ee227fec8f9 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/401544 Tested-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/ltc_gm20b.c')
-rw-r--r--drivers/gpu/nvgpu/gm20b/ltc_gm20b.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c
index 305e28c2..07d405b2 100644
--- a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c
@@ -26,10 +26,6 @@
26 26
27static int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) 27static int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
28{ 28{
29 struct device *d = dev_from_gk20a(g);
30 DEFINE_DMA_ATTRS(attrs);
31 dma_addr_t iova;
32
33 /* max memory size (MB) to cover */ 29 /* max memory size (MB) to cover */
34 u32 max_size = gr->max_comptag_mem; 30 u32 max_size = gr->max_comptag_mem;
35 /* one tag line covers 128KB */ 31 /* one tag line covers 128KB */
@@ -49,6 +45,8 @@ static int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
49 45
50 u32 compbit_backing_size; 46 u32 compbit_backing_size;
51 47
48 int err;
49
52 gk20a_dbg_fn(""); 50 gk20a_dbg_fn("");
53 51
54 if (max_comptag_lines == 0) { 52 if (max_comptag_lines == 0) {
@@ -83,17 +81,13 @@ static int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
83 gk20a_dbg_info("max comptag lines : %d", 81 gk20a_dbg_info("max comptag lines : %d",
84 max_comptag_lines); 82 max_comptag_lines);
85 83
86 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); 84 if (IS_ENABLED(CONFIG_GK20A_PHYS_PAGE_TABLES))
87 gr->compbit_store.size = compbit_backing_size; 85 err = gk20a_ltc_alloc_phys_cbc(g, compbit_backing_size);
88 gr->compbit_store.pages = dma_alloc_attrs(d, gr->compbit_store.size, 86 else
89 &iova, GFP_KERNEL, &attrs); 87 err = gk20a_ltc_alloc_virt_cbc(g, compbit_backing_size);
90 if (!gr->compbit_store.pages) { 88
91 gk20a_err(dev_from_gk20a(g), "failed to allocate" 89 if (err)
92 "backing store for compbit : size %d", 90 return err;
93 compbit_backing_size);
94 return -ENOMEM;
95 }
96 gr->compbit_store.base_iova = iova;
97 91
98 gk20a_allocator_init(&gr->comp_tags, "comptag", 92 gk20a_allocator_init(&gr->comp_tags, "comptag",
99 1, /* start */ 93 1, /* start */