diff options
author | David Nieto <dmartineznie@nvidia.com> | 2017-03-13 23:23:03 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-25 05:06:55 -0400 |
commit | e0f2afe5eb43fb32490ccabd504879c3e3e54623 (patch) | |
tree | d227311914fd44e88e1ab13b652870c0fa772cf1 /drivers/gpu/nvgpu/vgpu/vgpu.c | |
parent | b48186488d0108dee7b3fb755b2d99f4652780df (diff) |
gpu: nvgpu: refactor teardown to support unbind
This change refactors the teardown in remove to ensure that it is
possible to unload the driver while leaving fds open. This is achieved
by making sure that the SW state is kept alive till all fds are closed
and by checking that subsequent calls to ioctls after the teardown fail.
Normally, this would be achieved ny calls into gk20a_busy(), but in
kickoff we dont call into that to reduce latency, so we need to check
the driver status directly, and also in some of the functions
as we need to make sure the ioctl does not dereference the device or
platform struct
bug 200277762
JIRA: EVLR-1023
Change-Id: I163e47a08c29d4d5b3ab79f0eb531ef234f40bde
Signed-off-by: David Nieto <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1320219
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/vgpu.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index 72606952..df793be7 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c | |||
@@ -191,10 +191,9 @@ static int vgpu_intr_thread(void *dev_id) | |||
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
193 | 193 | ||
194 | static void vgpu_remove_support(struct device *dev) | 194 | static void vgpu_remove_support(struct gk20a *g) |
195 | { | 195 | { |
196 | struct gk20a *g = get_gk20a(dev); | 196 | struct vgpu_priv_data *priv = vgpu_get_priv_data_from_dev(g->dev); |
197 | struct vgpu_priv_data *priv = vgpu_get_priv_data_from_dev(dev); | ||
198 | struct tegra_vgpu_intr_msg msg; | 197 | struct tegra_vgpu_intr_msg msg; |
199 | int err; | 198 | int err; |
200 | 199 | ||
@@ -265,7 +264,7 @@ static int vgpu_init_support(struct platform_device *pdev) | |||
265 | return 0; | 264 | return 0; |
266 | 265 | ||
267 | fail: | 266 | fail: |
268 | vgpu_remove_support(&pdev->dev); | 267 | vgpu_remove_support(g); |
269 | return err; | 268 | return err; |
270 | } | 269 | } |
271 | 270 | ||
@@ -571,6 +570,8 @@ int vgpu_probe(struct platform_device *pdev) | |||
571 | platform->vgpu_priv = priv; | 570 | platform->vgpu_priv = priv; |
572 | gk20a->dev = dev; | 571 | gk20a->dev = dev; |
573 | 572 | ||
573 | gk20a->is_fmodel = platform->is_fmodel; | ||
574 | |||
574 | nvgpu_kmem_init(gk20a); | 575 | nvgpu_kmem_init(gk20a); |
575 | 576 | ||
576 | err = gk20a_user_init(dev, INTERFACE_NAME, &nvgpu_class); | 577 | err = gk20a_user_init(dev, INTERFACE_NAME, &nvgpu_class); |
@@ -653,7 +654,7 @@ int vgpu_remove(struct platform_device *pdev) | |||
653 | 654 | ||
654 | vgpu_pm_qos_remove(dev); | 655 | vgpu_pm_qos_remove(dev); |
655 | if (g->remove_support) | 656 | if (g->remove_support) |
656 | g->remove_support(dev); | 657 | g->remove_support(g); |
657 | 658 | ||
658 | vgpu_comm_deinit(); | 659 | vgpu_comm_deinit(); |
659 | gk20a_sched_ctrl_cleanup(g); | 660 | gk20a_sched_ctrl_cleanup(g); |