From 80197d2c9daa8e2320cc0b15741904eb3c1b9ba7 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Mon, 5 Jun 2017 17:40:44 +0300 Subject: gpu: nvgpu: split vidmem_is_vidmem As the vidmem_is_vidmem flag has got two separate meanings in one bit, split it in two bits into the enabled() API: Add NVGPU_MM_HONORS_APERTURE bit, which is the same as vidmem_is_vidmem with its original meaning, and use it to test which aperture bits to write to hardware. Add NVGPU_MM_UNIFIED_MEMORY bit, which has the opposite meaning: that the GPU shares the SoC memory. When this flag is false, the GPU has its own local video memory. Jira NVGPU-86 Change-Id: I2d0bed3b1ede5a712be99323d3035b154bb23c3a Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1496080 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 7 +++++-- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 2 -- drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 08e2e9cc..ec020d5f 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -665,7 +665,8 @@ int gk20a_init_mm_setup_sw(struct gk20a *g) * this requires fixed allocations in vidmem which must be * allocated before all other buffers */ - if (g->ops.pmu.alloc_blob_space && g->mm.vidmem_is_vidmem) { + if (g->ops.pmu.alloc_blob_space + && !nvgpu_is_enabled(g, NVGPU_MM_UNIFIED_MEMORY)) { err = g->ops.pmu.alloc_blob_space(g, 0, &g->acr.ucode_blob); if (err) return err; @@ -1234,10 +1235,12 @@ enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g, struct dma_buf *dmabuf) { struct gk20a *buf_owner = gk20a_vidmem_buf_owner(dmabuf); + bool unified_memory = nvgpu_is_enabled(g, NVGPU_MM_UNIFIED_MEMORY); + if (buf_owner == NULL) { /* Not nvgpu-allocated, assume system memory */ return APERTURE_SYSMEM; - } else if (WARN_ON(buf_owner == g && !g->mm.vidmem_is_vidmem)) { + } else if (WARN_ON(buf_owner == g && unified_memory)) { /* Looks like our video memory, but this gpu doesn't support * it. Warn about a bug and bail out */ nvgpu_warn(g, diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index 5d90cbf6..94342818 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -256,8 +256,6 @@ struct mm_gk20a { bool disable_bigpage; #endif bool has_physical_mode; - /* false if vidmem aperture actually points to sysmem */ - bool vidmem_is_vidmem; struct nvgpu_mem sysmem_flush; diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index 452b868d..9499f91a 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h @@ -215,8 +215,10 @@ struct gk20a_platform { /* soc name for finding firmware files */ const char *soc_name; - /* if vidmem aperture actually points to vidmem*/ - bool vidmem_is_vidmem; + /* false if vidmem aperture actually points to sysmem */ + bool honors_aperture; + /* unified or split memory with separate vidmem? */ + bool unified_memory; /* minimum supported VBIOS version */ u32 vbios_min_version; -- cgit v1.2.2