gpu: nvgpu: add shutdown callback for dgpu

The nvlink needs to be de-initialized as part of system
shutdown or reboot. Add the shutdown callback of pci driver
and use it to trigger nvlink de-initialization.

Bug 200422323

Change-Id: Iec8193d9665bc77ddbf3680ea130dfa4c1b3b0ad
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1928821
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nitin Kumbhar
2018-10-17 13:17:44 +05:30
committed by mobile promotions
parent 0a77871bab
commit 84e13ce30c

View File

@@ -874,11 +874,30 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
gk20a_put(g); gk20a_put(g);
} }
void nvgpu_pci_shutdown(struct pci_dev *pdev)
{
struct gk20a *g = get_gk20a(&pdev->dev);
struct device *dev = dev_from_gk20a(g);
int err;
nvgpu_info(g, "shutting down");
/* no support yet if DGPU is in VGPU mode */
if (gk20a_gpu_is_virtual(dev))
return;
err = nvgpu_nvlink_deinit(g);
WARN(err, "gpu failed to remove nvlink");
nvgpu_info(g, "shut down complete");
}
static struct pci_driver nvgpu_pci_driver = { static struct pci_driver nvgpu_pci_driver = {
.name = "nvgpu", .name = "nvgpu",
.id_table = nvgpu_pci_table, .id_table = nvgpu_pci_table,
.probe = nvgpu_pci_probe, .probe = nvgpu_pci_probe,
.remove = nvgpu_pci_remove, .remove = nvgpu_pci_remove,
.shutdown = nvgpu_pci_shutdown,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.driver.pm = &nvgpu_pci_pm_ops, .driver.pm = &nvgpu_pci_pm_ops,
#endif #endif