From 3e431e26c5c3aba6da8a6555ec3d7b7df53f534a Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Mon, 16 May 2016 11:33:38 +0300 Subject: gpu: nvgpu: add PRAMIN support for mem accessors To support vidmem, implement a way to access buffers via the PRAMIN window instead of just kernel-mapped sysmem buffers for iGPU as of now. Depending on the buffer aperture, choose between the two access types in the buffer memory accessor functions. vmap()/vunmap() pairs are no-ops for buffers that can't be cpu-mapped. Two uses of DMA_ATTR_READ_ONLY are removed in the ucode loading path to support writing to them too via the indirection in addition to cpu. JIRA DNVGPU-23 Change-Id: I282dba6741c6b8224bc12e69c1fb3936bde7e6ed Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1141314 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index d943b231..c58a4fec 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -40,10 +40,17 @@ outer_flush_range(pa, pa + (size_t)(size)); \ } while (0) +enum gk20a_aperture { + APERTURE_INVALID, /* e.g., unallocated */ + APERTURE_SYSMEM, + APERTURE_VIDMEM +}; + struct mem_desc { void *cpu_va; struct page **pages; struct sg_table *sgt; + enum gk20a_aperture aperture; size_t size; u64 gpu_va; }; @@ -357,6 +364,14 @@ struct mm_gk20a { bool vidmem_is_vidmem; struct mem_desc sysmem_flush; + + u32 pramin_base; + spinlock_t pramin_base_lock; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) + u32 force_pramin; /* via debugfs */ +#else + bool force_pramin; /* via debugfs */ +#endif }; int gk20a_mm_init(struct mm_gk20a *mm); -- cgit v1.2.2