summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-05-09 19:41:18 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-06 20:09:11 -0400
commitc2b63150cd947557b8d17637258b988459b8e0ec (patch)
tree5b15911b0b4799538ca98c9b6c1a31c0cbfe4a99 /drivers/gpu/nvgpu/gk20a
parent6bd7d22c0f248d0d29ea44b06798b247d0d2753a (diff)
gpu: nvgpu: Unify vm_init for vGPU and regular GPU
Unify the initialization routines for the vGPU and regular GPU paths. This helps avoid any further code divergence. This also assumes that the code running on the regular GPU essentially works for the vGPU. The only addition is that the regular GPU path calls an API in the vGPU code that sends the necessary RM server message. JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: I37af1993fd8b50f666ae27524d382cce49cf28f7 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1480226 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c62
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.h2
3 files changed, 0 insertions, 66 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 4fc626e8..a02215d2 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -672,8 +672,6 @@ struct gpu_ops {
672 int rw_flag, 672 int rw_flag,
673 bool sparse, 673 bool sparse,
674 struct vm_gk20a_mapping_batch *batch); 674 struct vm_gk20a_mapping_batch *batch);
675 int (*vm_alloc_share)(struct gk20a_as_share *as_share,
676 u32 big_page_size, u32 flags);
677 int (*vm_bind_channel)(struct gk20a_as_share *as_share, 675 int (*vm_bind_channel)(struct gk20a_as_share *as_share,
678 struct channel_gk20a *ch); 676 struct channel_gk20a *ch);
679 int (*fb_flush)(struct gk20a *g); 677 int (*fb_flush)(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index ec020d5f..87e6f30c 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -702,8 +702,6 @@ int gk20a_init_mm_setup_sw(struct gk20a *g)
702 if (err) 702 if (err)
703 return err; 703 return err;
704 704
705 /* set vm_alloc_share op here as gk20a_as_alloc_share needs it */
706 g->ops.mm.vm_alloc_share = gk20a_vm_alloc_share;
707 mm->remove_support = gk20a_remove_mm_support; 705 mm->remove_support = gk20a_remove_mm_support;
708 mm->remove_ce_support = gk20a_remove_mm_ce_support; 706 mm->remove_ce_support = gk20a_remove_mm_ce_support;
709 707
@@ -2451,65 +2449,6 @@ enum gmmu_pgsz_gk20a __get_pte_size(struct vm_gk20a *vm, u64 base, u64 size)
2451 return gmmu_page_size_small; 2449 return gmmu_page_size_small;
2452} 2450}
2453 2451
2454/* address space interfaces for the gk20a module */
2455int gk20a_vm_alloc_share(struct gk20a_as_share *as_share, u32 big_page_size,
2456 u32 flags)
2457{
2458 struct gk20a_as *as = as_share->as;
2459 struct gk20a *g = gk20a_from_as(as);
2460 struct mm_gk20a *mm = &g->mm;
2461 struct vm_gk20a *vm;
2462 char name[32];
2463 int err;
2464 const bool userspace_managed =
2465 (flags & NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED) != 0;
2466
2467 gk20a_dbg_fn("");
2468
2469 if (big_page_size == 0) {
2470 big_page_size =
2471 gk20a_get_platform(g->dev)->default_big_page_size;
2472 } else {
2473 if (!is_power_of_2(big_page_size))
2474 return -EINVAL;
2475
2476 if (!(big_page_size & g->gpu_characteristics.available_big_page_sizes))
2477 return -EINVAL;
2478 }
2479
2480 vm = nvgpu_kzalloc(g, sizeof(*vm));
2481 if (!vm)
2482 return -ENOMEM;
2483
2484 as_share->vm = vm;
2485 vm->as_share = as_share;
2486 vm->enable_ctag = true;
2487
2488 snprintf(name, sizeof(name), "as_%d", as_share->id);
2489
2490 err = nvgpu_init_vm(mm, vm, big_page_size,
2491 big_page_size << 10,
2492 mm->channel.kernel_size,
2493 mm->channel.user_size + mm->channel.kernel_size,
2494 !mm->disable_bigpage, userspace_managed, name);
2495
2496 return err;
2497}
2498
2499int gk20a_vm_release_share(struct gk20a_as_share *as_share)
2500{
2501 struct vm_gk20a *vm = as_share->vm;
2502
2503 gk20a_dbg_fn("");
2504
2505 vm->as_share = NULL;
2506 as_share->vm = NULL;
2507
2508 nvgpu_vm_put(vm);
2509
2510 return 0;
2511}
2512
2513int __gk20a_vm_bind_channel(struct vm_gk20a *vm, struct channel_gk20a *ch) 2452int __gk20a_vm_bind_channel(struct vm_gk20a *vm, struct channel_gk20a *ch)
2514{ 2453{
2515 int err = 0; 2454 int err = 0;
@@ -3130,7 +3069,6 @@ void gk20a_init_mm(struct gpu_ops *gops)
3130{ 3069{
3131 gops->mm.gmmu_map = gk20a_locked_gmmu_map; 3070 gops->mm.gmmu_map = gk20a_locked_gmmu_map;
3132 gops->mm.gmmu_unmap = gk20a_locked_gmmu_unmap; 3071 gops->mm.gmmu_unmap = gk20a_locked_gmmu_unmap;
3133 gops->mm.vm_alloc_share = gk20a_vm_alloc_share;
3134 gops->mm.vm_bind_channel = gk20a_vm_bind_channel; 3072 gops->mm.vm_bind_channel = gk20a_vm_bind_channel;
3135 gops->mm.fb_flush = gk20a_mm_fb_flush; 3073 gops->mm.fb_flush = gk20a_mm_fb_flush;
3136 gops->mm.l2_invalidate = gk20a_mm_l2_invalidate; 3074 gops->mm.l2_invalidate = gk20a_mm_l2_invalidate;
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
index 94342818..16c35d34 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
@@ -416,8 +416,6 @@ int nvgpu_vm_get_compbits_info(struct vm_gk20a *vm,
416/* vm-as interface */ 416/* vm-as interface */
417struct nvgpu_as_alloc_space_args; 417struct nvgpu_as_alloc_space_args;
418struct nvgpu_as_free_space_args; 418struct nvgpu_as_free_space_args;
419int gk20a_vm_alloc_share(struct gk20a_as_share *as_share, u32 big_page_size,
420 u32 flags);
421int gk20a_vm_release_share(struct gk20a_as_share *as_share); 419int gk20a_vm_release_share(struct gk20a_as_share *as_share);
422int gk20a_vm_bind_channel(struct gk20a_as_share *as_share, 420int gk20a_vm_bind_channel(struct gk20a_as_share *as_share,
423 struct channel_gk20a *ch); 421 struct channel_gk20a *ch);