summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/as_gk20a.c
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2015-03-19 15:28:34 -0400
committerIshan Mittal <imittal@nvidia.com>2015-05-18 02:03:19 -0400
commit520ff00e870eadc98a50f58ecd514ced53a8612f (patch)
tree6822d8ad2a51f98c2df421ba9cc7727e06757fcb /drivers/gpu/nvgpu/gk20a/as_gk20a.c
parent069accc8571716dc616c9f96776d54bf657afaee (diff)
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 <skiminki@nvidia.com> Reviewed-on: http://git-master/r/719710 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/as_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/as_gk20a.c35
1 files changed, 34 insertions, 1 deletions
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 @@
1/* 1/*
2 * GK20A Address Spaces 2 * GK20A Address Spaces
3 * 3 *
4 * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -225,6 +225,31 @@ static int gk20a_as_ioctl_get_va_regions(
225 return 0; 225 return 0;
226} 226}
227 227
228static int gk20a_as_ioctl_get_buffer_compbits_info(
229 struct gk20a_as_share *as_share,
230 struct nvgpu_as_get_buffer_compbits_info_args *args)
231{
232 gk20a_dbg_fn("");
233 return gk20a_vm_get_compbits_info(as_share->vm,
234 args->mapping_gva,
235 &args->compbits_win_size,
236 &args->compbits_win_ctagline,
237 &args->mapping_ctagline,
238 &args->flags);
239}
240
241static int gk20a_as_ioctl_map_buffer_compbits(
242 struct gk20a_as_share *as_share,
243 struct nvgpu_as_map_buffer_compbits_args *args)
244{
245 gk20a_dbg_fn("");
246 return gk20a_vm_map_compbits(as_share->vm,
247 args->mapping_gva,
248 &args->compbits_win_gva,
249 &args->mapping_iova,
250 args->flags);
251}
252
228int gk20a_as_dev_open(struct inode *inode, struct file *filp) 253int gk20a_as_dev_open(struct inode *inode, struct file *filp)
229{ 254{
230 struct gk20a_as_share *as_share; 255 struct gk20a_as_share *as_share;
@@ -334,6 +359,14 @@ long gk20a_as_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
334 err = gk20a_as_ioctl_get_va_regions(as_share, 359 err = gk20a_as_ioctl_get_va_regions(as_share,
335 (struct nvgpu_as_get_va_regions_args *)buf); 360 (struct nvgpu_as_get_va_regions_args *)buf);
336 break; 361 break;
362 case NVGPU_AS_IOCTL_GET_BUFFER_COMPBITS_INFO:
363 err = gk20a_as_ioctl_get_buffer_compbits_info(as_share,
364 (struct nvgpu_as_get_buffer_compbits_info_args *)buf);
365 break;
366 case NVGPU_AS_IOCTL_MAP_BUFFER_COMPBITS:
367 err = gk20a_as_ioctl_map_buffer_compbits(as_share,
368 (struct nvgpu_as_map_buffer_compbits_args *)buf);
369 break;
337 default: 370 default:
338 dev_dbg(dev_from_gk20a(g), "unrecognized as ioctl: 0x%x", cmd); 371 dev_dbg(dev_from_gk20a(g), "unrecognized as ioctl: 0x%x", cmd);
339 err = -ENOTTY; 372 err = -ENOTTY;