From 9984dff23326dbf28f89f2de23bc00edd4c519f9 Mon Sep 17 00:00:00 2001 From: Arto Merilainen Date: Wed, 9 Apr 2014 14:50:43 +0300 Subject: 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 Reviewed-on: http://git-master/r/401544 Tested-by: Terje Bergstrom Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gm20b/ltc_gm20b.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'drivers') 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 @@ static int gm20b_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 */ @@ -49,6 +45,8 @@ static int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) u32 compbit_backing_size; + int err; + gk20a_dbg_fn(""); if (max_comptag_lines == 0) { @@ -83,17 +81,13 @@ static int gm20b_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