summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2015-05-04 11:41:23 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2015-11-18 12:45:07 -0500
commit9d2c9072c8b9a7742db3974d6027df9d44e0953f (patch)
tree15ed7e5a3495db6032b43381641d102837decfad /drivers/gpu/nvgpu/vgpu
parent503d3a0b1002685e65efb8b99a2362117ee62104 (diff)
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 <skiminki@nvidia.com> Reviewed-on: http://git-master/r/738558 Reviewed-on: http://git-master/r/833253 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu')
-rw-r--r--drivers/gpu/nvgpu/vgpu/mm_vgpu.c10
1 files changed, 9 insertions, 1 deletions
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)
267 267
268/* address space interfaces for the gk20a module */ 268/* address space interfaces for the gk20a module */
269static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, 269static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share,
270 u32 big_page_size) 270 u32 big_page_size, u32 flags)
271{ 271{
272 struct gk20a_as *as = as_share->as; 272 struct gk20a_as *as = as_share->as;
273 struct gk20a *g = gk20a_from_as(as); 273 struct gk20a *g = gk20a_from_as(as);
@@ -280,6 +280,8 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share,
280 kernel_vma_start, kernel_vma_limit; 280 kernel_vma_start, kernel_vma_limit;
281 char name[32]; 281 char name[32];
282 int err, i; 282 int err, i;
283 const bool userspace_managed =
284 (flags & NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED) != 0;
283 285
284 /* note: keep the page sizes sorted lowest to highest here */ 286 /* note: keep the page sizes sorted lowest to highest here */
285 u32 gmmu_page_sizes[gmmu_nr_page_sizes] = { 287 u32 gmmu_page_sizes[gmmu_nr_page_sizes] = {
@@ -290,6 +292,12 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share,
290 292
291 gk20a_dbg_fn(""); 293 gk20a_dbg_fn("");
292 294
295 if (userspace_managed) {
296 gk20a_err(dev_from_gk20a(g),
297 "userspace-managed address spaces not yet supported");
298 return -ENOSYS;
299 }
300
293 big_page_size = gmmu_page_sizes[gmmu_page_size_big]; 301 big_page_size = gmmu_page_sizes[gmmu_page_size_big];
294 302
295 vm = kzalloc(sizeof(*vm), GFP_KERNEL); 303 vm = kzalloc(sizeof(*vm), GFP_KERNEL);