summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorArto Merilainen <amerilainen@nvidia.com>2014-04-09 21:15:32 +0300
committerGerrit Code Review <gerrit2@nvidia.com>2014-04-11 00:15:51 -0700
commit90e52d1bd0c614cbf1bfcbcc68a6999e1f25c1de (patch)
tree92ef0550cf77a5473c2e42799f7e990aa5c70cf9 /drivers
parent2a150d1bafd65c492a960c00d808b606d021b8e1 (diff)
gpu: nvgpu: Allow mapping backing store
Backing store sgt needs to be mapped to gpuva to enable CDE swizzling. This patch adds necessary code to create sgt during initialisation so that the sgt is available when needed. Bug 1409151 Change-Id: I9d4671386fe9204d780c2e286b5f9b2dd87af35a Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/ltc_common.c12
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ltc_common.c b/drivers/gpu/nvgpu/gk20a/ltc_common.c
index 2d2516d98ce9..8f9bd8c22968 100644
--- a/drivers/gpu/nvgpu/gk20a/ltc_common.c
+++ b/drivers/gpu/nvgpu/gk20a/ltc_common.c
@@ -220,8 +220,7 @@ static int gk20a_ltc_alloc_phys_cbc(struct gk20a *g,
*gr->compbit_store.pages = pages;
gr->compbit_store.base_iova = sg_phys(sgt->sgl);
gr->compbit_store.size = compbit_backing_size;
-
- kfree(sgt);
+ gr->compbit_store.sgt = sgt;
return 0;
@@ -241,6 +240,7 @@ static int gk20a_ltc_alloc_virt_cbc(struct gk20a *g,
struct gr_gk20a *gr = &g->gr;
DEFINE_DMA_ATTRS(attrs);
dma_addr_t iova;
+ int err;
dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs);
@@ -255,6 +255,14 @@ static int gk20a_ltc_alloc_virt_cbc(struct gk20a *g,
gr->compbit_store.base_iova = iova;
gr->compbit_store.size = compbit_backing_size;
+ err = gk20a_get_sgtable_from_pages(d,
+ &gr->compbit_store.sgt,
+ gr->compbit_store.pages, iova,
+ compbit_backing_size);
+ if (err) {
+ gk20a_err(dev_from_gk20a(g), "failed to allocate sgt for backing store");
+ return err;
+ }
return 0;
}
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
index d583849d90a5..e5d76f8f6969 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
@@ -157,6 +157,7 @@ struct gr_ctx_desc {
struct compbit_store_desc {
struct page **pages;
+ struct sg_table *sgt;
size_t size;
u64 base_iova;
};