From 9d2c9072c8b9a7742db3974d6027df9d44e0953f Mon Sep 17 00:00:00 2001 From: Sami Kiminki Date: Mon, 4 May 2015 18:41:23 +0300 Subject: gpu: nvgpu: User-space managed address space support Implement NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED, which enables creating userspace-managed GPU address spaces. When an address space is marked as userspace-managed, the following changes are in effect: - Only fixed-address mappings are allowed. - VA space allocation for fixed-address mappings is not required, except to mark space as sparse. - Maps and unmaps are always immediate. In particular, the mapping ref increments at kickoffs and decrements at job completion are skipped. Bug 1614735 Bug 1623949 Bug 1660392 Change-Id: I834fe19b3f65e9b02c268952383eddee0e465759 Signed-off-by: Sami Kiminki Reviewed-on: http://git-master/r/738558 Reviewed-on: http://git-master/r/833253 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/vgpu') diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index c36b135c..bfaacff5 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c @@ -267,7 +267,7 @@ u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size) /* address space interfaces for the gk20a module */ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, - u32 big_page_size) + u32 big_page_size, u32 flags) { struct gk20a_as *as = as_share->as; struct gk20a *g = gk20a_from_as(as); @@ -280,6 +280,8 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, kernel_vma_start, kernel_vma_limit; char name[32]; int err, i; + const bool userspace_managed = + (flags & NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED) != 0; /* note: keep the page sizes sorted lowest to highest here */ u32 gmmu_page_sizes[gmmu_nr_page_sizes] = { @@ -290,6 +292,12 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, gk20a_dbg_fn(""); + if (userspace_managed) { + gk20a_err(dev_from_gk20a(g), + "userspace-managed address spaces not yet supported"); + return -ENOSYS; + } + big_page_size = gmmu_page_sizes[gmmu_page_size_big]; vm = kzalloc(sizeof(*vm), GFP_KERNEL); -- cgit v1.2.2