From 520ff00e870eadc98a50f58ecd514ced53a8612f Mon Sep 17 00:00:00 2001 From: Sami Kiminki Date: Thu, 19 Mar 2015 21:28:34 +0200 Subject: gpu: nvgpu: Implement compbits mapping Implement NVGPU_AS_IOCTL_GET_BUFFER_COMPBITS_INFO for requesting info on compbits-mappable buffers; and NVGPU_AS_IOCTL_MAP_BUFFER_COMPBITS, which enables mapping compbits to the GPU address space of said buffers. This, subsequently, enables moving comptag swizzling from GPU to CDEH/CDEV formats to userspace. Compbits mapping is conservative and it may map more than what is strictly needed. This is because two reasons: 1) mapping must be done on small page alignment (4kB), and 2) GPU comptags are swizzled all around the aggregate cache line, which means that the whole cache line must be visible even if only some comptag lines are required from it. Cache line size is not necessarily a multiple of the small page size. Bug 200077571 Change-Id: I5ae88fe6b616e5ea37d3bff0dff46c07e9c9267e Signed-off-by: Sami Kiminki Reviewed-on: http://git-master/r/719710 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 19 +++++++++++++++++++ 1 file changed, 19 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 0ff11d09..e07b95fe 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -186,7 +186,13 @@ struct mapped_buffer_node { u32 ctag_offset; u32 ctag_lines; u32 ctag_allocated_lines; + + /* For comptag mapping, these are the mapping window parameters */ bool ctags_mappable; + u64 ctag_map_win_addr; /* non-zero if mapped */ + u64 ctag_map_win_size; /* non-zero if ctags_mappable */ + u32 ctag_map_win_ctagline; /* ctagline at win start, set if + * ctags_mappable */ u32 flags; u32 kind; @@ -504,6 +510,19 @@ u64 gk20a_vm_map(struct vm_gk20a *vm, u64 buffer_offset, u64 mapping_size); +int gk20a_vm_get_compbits_info(struct vm_gk20a *vm, + u64 mapping_gva, + u64 *compbits_win_size, + u32 *compbits_win_ctagline, + u32 *mapping_ctagline, + u32 *flags); + +int gk20a_vm_map_compbits(struct vm_gk20a *vm, + u64 mapping_gva, + u64 *compbits_win_gva, + u64 *mapping_iova, + u32 flags); + /* unmap handle from kernel */ void gk20a_vm_unmap(struct vm_gk20a *vm, u64 offset); -- cgit v1.2.2