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/as_gk20a.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/as_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/as_gk20a.c b/drivers/gpu/nvgpu/gk20a/as_gk20a.c index 038fa4c8..63569008 100644 --- a/drivers/gpu/nvgpu/gk20a/as_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/as_gk20a.c @@ -1,7 +1,7 @@ /* * GK20A Address Spaces * - * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -225,6 +225,31 @@ static int gk20a_as_ioctl_get_va_regions( return 0; } +static int gk20a_as_ioctl_get_buffer_compbits_info( + struct gk20a_as_share *as_share, + struct nvgpu_as_get_buffer_compbits_info_args *args) +{ + gk20a_dbg_fn(""); + return gk20a_vm_get_compbits_info(as_share->vm, + args->mapping_gva, + &args->compbits_win_size, + &args->compbits_win_ctagline, + &args->mapping_ctagline, + &args->flags); +} + +static int gk20a_as_ioctl_map_buffer_compbits( + struct gk20a_as_share *as_share, + struct nvgpu_as_map_buffer_compbits_args *args) +{ + gk20a_dbg_fn(""); + return gk20a_vm_map_compbits(as_share->vm, + args->mapping_gva, + &args->compbits_win_gva, + &args->mapping_iova, + args->flags); +} + int gk20a_as_dev_open(struct inode *inode, struct file *filp) { struct gk20a_as_share *as_share; @@ -334,6 +359,14 @@ long gk20a_as_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) err = gk20a_as_ioctl_get_va_regions(as_share, (struct nvgpu_as_get_va_regions_args *)buf); break; + case NVGPU_AS_IOCTL_GET_BUFFER_COMPBITS_INFO: + err = gk20a_as_ioctl_get_buffer_compbits_info(as_share, + (struct nvgpu_as_get_buffer_compbits_info_args *)buf); + break; + case NVGPU_AS_IOCTL_MAP_BUFFER_COMPBITS: + err = gk20a_as_ioctl_map_buffer_compbits(as_share, + (struct nvgpu_as_map_buffer_compbits_args *)buf); + break; default: dev_dbg(dev_from_gk20a(g), "unrecognized as ioctl: 0x%x", cmd); err = -ENOTTY; -- cgit v1.2.2