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/pci.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/pci.c')
-rw-r--r-- | drivers/gpu/nvgpu/pci.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/pci.c b/drivers/gpu/nvgpu/pci.c index 114e9af7..a7899f7e 100644 --- a/drivers/gpu/nvgpu/pci.c +++ b/drivers/gpu/nvgpu/pci.c | |||
@@ -393,6 +393,11 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
393 | } | 393 | } |
394 | disable_irq(g->irq_stall); | 394 | disable_irq(g->irq_stall); |
395 | 395 | ||
396 | /* | ||
397 | * is_fmodel needs to be in gk20a struct for deferred teardown | ||
398 | */ | ||
399 | g->is_fmodel = platform->is_fmodel; | ||
400 | |||
396 | err = nvgpu_pci_init_support(pdev); | 401 | err = nvgpu_pci_init_support(pdev); |
397 | if (err) | 402 | if (err) |
398 | return err; | 403 | return err; |
@@ -426,7 +431,6 @@ static void nvgpu_pci_remove(struct pci_dev *pdev) | |||
426 | struct gk20a *g = get_gk20a(&pdev->dev); | 431 | struct gk20a *g = get_gk20a(&pdev->dev); |
427 | 432 | ||
428 | gk20a_dbg(gpu_dbg_shutdown, "Removing nvgpu driver!\n"); | 433 | gk20a_dbg(gpu_dbg_shutdown, "Removing nvgpu driver!\n"); |
429 | gk20a_driver_start_unload(g); | ||
430 | 434 | ||
431 | if (g->irqs_enabled) | 435 | if (g->irqs_enabled) |
432 | disable_irq(g->irq_stall); | 436 | disable_irq(g->irq_stall); |
@@ -445,7 +449,7 @@ static void nvgpu_pci_remove(struct pci_dev *pdev) | |||
445 | * Wait for the driver to finish up all the IOCTLs it's working on | 449 | * Wait for the driver to finish up all the IOCTLs it's working on |
446 | * before cleaning up the driver's data structures. | 450 | * before cleaning up the driver's data structures. |
447 | */ | 451 | */ |
448 | gk20a_wait_for_idle(&pdev->dev); | 452 | gk20a_driver_start_unload(g); |
449 | gk20a_dbg(gpu_dbg_shutdown, "Driver idle.\n"); | 453 | gk20a_dbg(gpu_dbg_shutdown, "Driver idle.\n"); |
450 | 454 | ||
451 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC | 455 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC |
@@ -455,9 +459,6 @@ static void nvgpu_pci_remove(struct pci_dev *pdev) | |||
455 | gk20a_user_deinit(g->dev, &nvgpu_pci_class); | 459 | gk20a_user_deinit(g->dev, &nvgpu_pci_class); |
456 | gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b"); | 460 | gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b"); |
457 | 461 | ||
458 | if (g->remove_support) | ||
459 | g->remove_support(g->dev); | ||
460 | |||
461 | debugfs_remove_recursive(platform->debugfs); | 462 | debugfs_remove_recursive(platform->debugfs); |
462 | debugfs_remove_recursive(platform->debugfs_alias); | 463 | debugfs_remove_recursive(platform->debugfs_alias); |
463 | 464 | ||