gpu: nvgpu: add user API to get read-only syncpoint address map

Add User space API NVGPU_AS_IOCTL_GET_SYNC_RO_MAP to get read-only syncpoint
address map in user space

We already map whole syncpoint shim to each address space with base address
being vm->syncpt_ro_map_gpu_va

This new API exposes this base GPU_VA address of syncpoint map, and unit size
of each syncpoint to user space.
User space can then calculate address of each syncpoint as
syncpoint_address = base_gpu_va + (syncpoint_id * syncpoint_unit_size)

Note that this syncpoint address is read_only, and should be only used for
inserting semaphore acquires.
Adding semaphore release with this address would result in MMU_FAULT

Define new HAL g->ops.fifo.get_sync_ro_map and set this for all GPUs supported
on Xavier SoC

Bug 200327559

Change-Id: Ica0db48fc28fdd0ff2a5eb09574dac843dc5e4fd
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1649365
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2018-01-16 03:07:37 -08:00
committed by mobile promotions
parent 0c8deb74af
commit f0cbe19b12
16 changed files with 167 additions and 46 deletions

View File

@@ -1,7 +1,7 @@
/*
* GK20A Address Spaces
*
* Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2011-2018, 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,
@@ -256,6 +256,33 @@ static int gk20a_as_ioctl_get_va_regions(
return 0;
}
static int nvgpu_as_ioctl_get_sync_ro_map(
struct gk20a_as_share *as_share,
struct nvgpu_as_get_sync_ro_map_args *args)
{
#ifdef CONFIG_TEGRA_GK20A_NVHOST
struct vm_gk20a *vm = as_share->vm;
struct gk20a *g = gk20a_from_vm(vm);
u64 base_gpuva;
u32 sync_size;
int err = 0;
if (!g->ops.fifo.get_sync_ro_map)
return -EINVAL;
err = g->ops.fifo.get_sync_ro_map(vm, &base_gpuva, &sync_size);
if (err)
return err;
args->base_gpuva = base_gpuva;
args->sync_size = sync_size;
return err;
#else
return -EINVAL;
#endif
}
int gk20a_as_dev_open(struct inode *inode, struct file *filp)
{
struct nvgpu_os_linux *l;
@@ -367,6 +394,10 @@ long gk20a_as_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
err = gk20a_as_ioctl_map_buffer_batch(as_share,
(struct nvgpu_as_map_buffer_batch_args *)buf);
break;
case NVGPU_AS_IOCTL_GET_SYNC_RO_MAP:
err = nvgpu_as_ioctl_get_sync_ro_map(as_share,
(struct nvgpu_as_get_sync_ro_map_args *)buf);
break;
default:
err = -ENOTTY;
break;