From afa31cdd8cc6bb04faeed30b2cc30f5e6be888b5 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 3 Jul 2017 16:40:44 +0530 Subject: gpu: nvgpu: add support for L3 cache allocation of buffers Add gv11b implementation of gpu_phys_addr() that checks the t19x GMMU attributes struct to determine if L3 allocation should be enabled. If L3 alloc is enabled then a special physical address bit is set. Add flag NVGPU_AS_MAP_BUFFER_FLAGS_L3_ALLOC to struct nvgpu_as_map_buffer_ex_args so that User space can add a hint to allocate buffer in L3 cache Jira GPUT19X-10 Bug 200279508 Change-Id: I1bb9876a670b252980922aa50e3e69b802be137f Signed-off-by: Deepak Nibade Reviewed-on: https://git-master/r/1512602 GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu --- drivers/gpu/nvgpu/gv11b/mm_gv11b.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'drivers/gpu/nvgpu/gv11b/mm_gv11b.c') diff --git a/drivers/gpu/nvgpu/gv11b/mm_gv11b.c b/drivers/gpu/nvgpu/gv11b/mm_gv11b.c index 9d1e0f25..cc8dafa3 100644 --- a/drivers/gpu/nvgpu/gv11b/mm_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/mm_gv11b.c @@ -23,6 +23,8 @@ #include +#define NVGPU_L3_ALLOC_BIT 36 + static bool gv11b_mm_is_bar1_supported(struct gk20a *g) { return false; @@ -61,6 +63,20 @@ void gv11b_mm_l2_flush(struct gk20a *g, bool invalidate) g->ops.mm.fb_flush(g); } +/* + * On Volta the GPU determines whether to do L3 allocation for a mapping by + * checking bit 36 of the phsyical address. So if a mapping should allocte lines + * in the L3 this bit must be set. + */ +u64 gv11b_gpu_phys_addr(struct gk20a *g, + struct nvgpu_gmmu_attrs *attrs, u64 phys) +{ + if (attrs->t19x_attrs.l3_alloc) + return phys | NVGPU_L3_ALLOC_BIT; + + return phys; +} + void gv11b_init_mm(struct gpu_ops *gops) { gp10b_init_mm(gops); @@ -69,4 +85,5 @@ void gv11b_init_mm(struct gpu_ops *gops) gops->mm.init_mm_setup_hw = gk20a_init_mm_setup_hw; gops->mm.mmu_fault_pending = gv11b_mm_mmu_fault_pending; gops->mm.l2_flush = gv11b_mm_l2_flush; + gops->mm.gpu_phys_addr = gv11b_gpu_phys_addr; } -- cgit v1.2.2