From d4586cc3ab132fd03dce731e1e053bd70d9122cf Mon Sep 17 00:00:00 2001 From: Arto Merilainen Date: Wed, 9 Apr 2014 14:50:43 +0300 Subject: 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 --- drivers/gpu/nvgpu/gk20a/ltc_gk20a.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/ltc_gk20a.c') 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 @@ static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) { - struct device *d = dev_from_gk20a(g); - DEFINE_DMA_ATTRS(attrs); - dma_addr_t iova; - /* max memory size (MB) to cover */ u32 max_size = gr->max_comptag_mem; /* one tag line covers 128KB */ @@ -50,6 +46,8 @@ static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) u32 compbit_backing_size; + int err; + gk20a_dbg_fn(""); if (max_comptag_lines == 0) { @@ -84,17 +82,13 @@ static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) gk20a_dbg_info("max comptag lines : %d", max_comptag_lines); - dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); - gr->compbit_store.size = compbit_backing_size; - gr->compbit_store.pages = dma_alloc_attrs(d, gr->compbit_store.size, - &iova, GFP_KERNEL, &attrs); - if (!gr->compbit_store.pages) { - gk20a_err(dev_from_gk20a(g), "failed to allocate" - "backing store for compbit : size %d", - compbit_backing_size); - return -ENOMEM; - } - gr->compbit_store.base_iova = iova; + if (IS_ENABLED(CONFIG_GK20A_PHYS_PAGE_TABLES)) + err = gk20a_ltc_alloc_phys_cbc(g, compbit_backing_size); + else + err = gk20a_ltc_alloc_virt_cbc(g, compbit_backing_size); + + if (err) + return err; gk20a_allocator_init(&gr->comp_tags, "comptag", 1, /* start */ -- cgit v1.2.2