summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/vgpu.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-03-08 19:58:25 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-28 12:39:07 -0400
commit2e15a2d1accb8303c2363122c638e08ae7b70a50 (patch)
treefd967e64059e4b868f26de0aab56828984c52139 /drivers/gpu/nvgpu/vgpu/vgpu.c
parent8a15e02ca92b83aa5a216ea9cd42680373212ecd (diff)
gpu: nvgpu: Use new kmem API functions (vgpu/*)
Use the new kmem API functions in vgpu/*. Also reshuffle the order of some allocs in the vgpu init code to allow usage of the nvgpu kmem APIs. Bug 1799159 Bug 1823380 Change-Id: I6c6dcff03b406a260dffbf89a59b368d31a4cb2c Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1318318 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index df793be7..49f0fb39 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -198,7 +198,7 @@ static void vgpu_remove_support(struct gk20a *g)
198 int err; 198 int err;
199 199
200 if (g->dbg_regops_tmp_buf) 200 if (g->dbg_regops_tmp_buf)
201 kfree(g->dbg_regops_tmp_buf); 201 nvgpu_kfree(g, g->dbg_regops_tmp_buf);
202 202
203 if (g->pmu.remove_support) 203 if (g->pmu.remove_support)
204 g->pmu.remove_support(&g->pmu); 204 g->pmu.remove_support(&g->pmu);
@@ -252,7 +252,7 @@ static int vgpu_init_support(struct platform_device *pdev)
252 252
253 INIT_LIST_HEAD(&g->profiler_objects); 253 INIT_LIST_HEAD(&g->profiler_objects);
254 254
255 g->dbg_regops_tmp_buf = kzalloc(SZ_4K, GFP_KERNEL); 255 g->dbg_regops_tmp_buf = nvgpu_kzalloc(g, SZ_4K);
256 if (!g->dbg_regops_tmp_buf) { 256 if (!g->dbg_regops_tmp_buf) {
257 dev_err(g->dev, "couldn't allocate regops tmp buf"); 257 dev_err(g->dev, "couldn't allocate regops tmp buf");
258 return -ENOMEM; 258 return -ENOMEM;
@@ -474,7 +474,7 @@ static int vgpu_pm_qos_init(struct device *dev)
474 struct gk20a *g = get_gk20a(dev); 474 struct gk20a *g = get_gk20a(dev);
475 struct gk20a_scale_profile *profile; 475 struct gk20a_scale_profile *profile;
476 476
477 profile = kzalloc(sizeof(*profile), GFP_KERNEL); 477 profile = nvgpu_kzalloc(g, sizeof(*profile));
478 if (!profile) 478 if (!profile)
479 return -ENOMEM; 479 return -ENOMEM;
480 480
@@ -493,7 +493,7 @@ static void vgpu_pm_qos_remove(struct device *dev)
493 493
494 pm_qos_remove_max_notifier(PM_QOS_GPU_FREQ_BOUNDS, 494 pm_qos_remove_max_notifier(PM_QOS_GPU_FREQ_BOUNDS,
495 &g->scale_profile->qos_notify_block); 495 &g->scale_profile->qos_notify_block);
496 kfree(g->scale_profile); 496 nvgpu_kfree(g, g->scale_profile);
497 g->scale_profile = NULL; 497 g->scale_profile = NULL;
498} 498}
499 499
@@ -556,24 +556,27 @@ int vgpu_probe(struct platform_device *pdev)
556 556
557 gk20a_dbg_fn(""); 557 gk20a_dbg_fn("");
558 558
559 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
560 if (!priv)
561 return -ENOMEM;
562
563 gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL); 559 gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL);
564 if (!gk20a) { 560 if (!gk20a) {
565 dev_err(dev, "couldn't allocate gk20a support"); 561 dev_err(dev, "couldn't allocate gk20a support");
566 return -ENOMEM; 562 return -ENOMEM;
567 } 563 }
568 564
569 platform->g = gk20a;
570 platform->vgpu_priv = priv;
571 gk20a->dev = dev; 565 gk20a->dev = dev;
572 566
573 gk20a->is_fmodel = platform->is_fmodel; 567 gk20a->is_fmodel = platform->is_fmodel;
574 568
575 nvgpu_kmem_init(gk20a); 569 nvgpu_kmem_init(gk20a);
576 570
571 priv = nvgpu_kzalloc(gk20a, sizeof(*priv));
572 if (!priv) {
573 kfree(gk20a);
574 return -ENOMEM;
575 }
576
577 platform->g = gk20a;
578 platform->vgpu_priv = priv;
579
577 err = gk20a_user_init(dev, INTERFACE_NAME, &nvgpu_class); 580 err = gk20a_user_init(dev, INTERFACE_NAME, &nvgpu_class);
578 if (err) 581 if (err)
579 return err; 582 return err;