diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/pci.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/nvlink.c | 30 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/nvlink.h | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c index 3d3c2a9f..871abef4 100644 --- a/drivers/gpu/nvgpu/common/linux/pci.c +++ b/drivers/gpu/nvgpu/common/linux/pci.c | |||
@@ -757,6 +757,8 @@ static void nvgpu_pci_remove(struct pci_dev *pdev) | |||
757 | if (gk20a_gpu_is_virtual(dev)) | 757 | if (gk20a_gpu_is_virtual(dev)) |
758 | return; | 758 | return; |
759 | 759 | ||
760 | nvgpu_nvlink_remove(g); | ||
761 | |||
760 | gk20a_driver_start_unload(g); | 762 | gk20a_driver_start_unload(g); |
761 | err = nvgpu_quiesce(g); | 763 | err = nvgpu_quiesce(g); |
762 | /* TODO: handle failure to idle */ | 764 | /* TODO: handle failure to idle */ |
diff --git a/drivers/gpu/nvgpu/common/nvlink.c b/drivers/gpu/nvgpu/common/nvlink.c index 25c1b10b..1a6ee853 100644 --- a/drivers/gpu/nvgpu/common/nvlink.c +++ b/drivers/gpu/nvgpu/common/nvlink.c | |||
@@ -503,3 +503,33 @@ free_ndev: | |||
503 | return -ENODEV; | 503 | return -ENODEV; |
504 | #endif | 504 | #endif |
505 | } | 505 | } |
506 | |||
507 | int nvgpu_nvlink_remove(struct gk20a *g) | ||
508 | { | ||
509 | #ifdef CONFIG_TEGRA_NVLINK | ||
510 | struct nvlink_device *ndev; | ||
511 | int err; | ||
512 | |||
513 | ndev = g->nvlink.priv; | ||
514 | |||
515 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_NVLINK, false); | ||
516 | |||
517 | err = nvlink_unregister_link(&ndev->link); | ||
518 | if (err) { | ||
519 | nvgpu_err(g, "failed on nvlink link unregistration"); | ||
520 | return err; | ||
521 | } | ||
522 | |||
523 | err = nvlink_unregister_device(ndev); | ||
524 | if (err) { | ||
525 | nvgpu_err(g, "failed on nvlink device unregistration"); | ||
526 | return err; | ||
527 | } | ||
528 | |||
529 | nvgpu_kfree(g, ndev); | ||
530 | |||
531 | return 0; | ||
532 | #else | ||
533 | return -ENODEV; | ||
534 | #endif | ||
535 | } | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvlink.h b/drivers/gpu/nvgpu/include/nvgpu/nvlink.h index bb47537f..9824e62b 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvlink.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvlink.h | |||
@@ -236,6 +236,7 @@ int nvgpu_nvlink_train(struct gk20a *g, u32 link_id, bool from_off); | |||
236 | int nvgpu_nvlink_read_dt_props(struct gk20a *g); | 236 | int nvgpu_nvlink_read_dt_props(struct gk20a *g); |
237 | 237 | ||
238 | int nvgpu_nvlink_probe(struct gk20a *g); | 238 | int nvgpu_nvlink_probe(struct gk20a *g); |
239 | int nvgpu_nvlink_remove(struct gk20a *g); | ||
239 | 240 | ||
240 | void nvgpu_mss_nvlink_init_credits(struct gk20a *g); | 241 | void nvgpu_mss_nvlink_init_credits(struct gk20a *g); |
241 | 242 | ||