summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/ltc_gk20a.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:05 -0400
commitd4586cc3ab132fd03dce731e1e053bd70d9122cf (patch)
tree47e340280b4d89a6e833661e01491d5721cbbc3e /drivers/gpu/nvgpu/gk20a/ltc_gk20a.c
parent3eedb0256d0fd1f2a26a9609d2c2e7baf8240306 (diff)
gpu: nvgpu: Alloc physical 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: Ia1d1ca35b5a0375f4707824df3ef06ad1b9117d4 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/ltc_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/ltc_gk20a.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c
index 74475d7a..f5c6d7e7 100644
--- a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c
@@ -27,10 +27,6 @@
27 27
28static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) 28static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
29{ 29{
30 struct device *d = dev_from_gk20a(g);
31 DEFINE_DMA_ATTRS(attrs);
32 dma_addr_t iova;
33
34 /* max memory size (MB) to cover */ 30 /* max memory size (MB) to cover */
35 u32 max_size = gr->max_comptag_mem; 31 u32 max_size = gr->max_comptag_mem;
36 /* one tag line covers 128KB */ 32 /* one tag line covers 128KB */
@@ -50,6 +46,8 @@ static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
50 46
51 u32 compbit_backing_size; 47 u32 compbit_backing_size;
52 48
49 int err;
50
53 gk20a_dbg_fn(""); 51 gk20a_dbg_fn("");
54 52
55 if (max_comptag_lines == 0) { 53 if (max_comptag_lines == 0) {
@@ -84,17 +82,13 @@ static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
84 gk20a_dbg_info("max comptag lines : %d", 82 gk20a_dbg_info("max comptag lines : %d",
85 max_comptag_lines); 83 max_comptag_lines);
86 84
87 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); 85 if (IS_ENABLED(CONFIG_GK20A_PHYS_PAGE_TABLES))
88 gr->compbit_store.size = compbit_backing_size; 86 err = gk20a_ltc_alloc_phys_cbc(g, compbit_backing_size);
89 gr->compbit_store.pages = dma_alloc_attrs(d, gr->compbit_store.size, 87 else
90 &iova, GFP_KERNEL, &attrs); 88 err = gk20a_ltc_alloc_virt_cbc(g, compbit_backing_size);
91 if (!gr->compbit_store.pages) { 89
92 gk20a_err(dev_from_gk20a(g), "failed to allocate" 90 if (err)
93 "backing store for compbit : size %d", 91 return err;
94 compbit_backing_size);
95 return -ENOMEM;
96 }
97 gr->compbit_store.base_iova = iova;
98 92
99 gk20a_allocator_init(&gr->comp_tags, "comptag", 93 gk20a_allocator_init(&gr->comp_tags, "comptag",
100 1, /* start */ 94 1, /* start */