gpu: nvgpu: shutdown nvlink in driver remove

During driver remove, if nvlink is set up, gracefully
shut it down so that it can be enumerated again.

Bug 1987855

Change-Id: Ibd83a5e29364b22264e689aa879569a9cccf0f79
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1746073
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nitin Kumbhar
2018-06-11 15:31:33 +05:30
committed by mobile promotions
parent d80e816875
commit b4b1fb97bd
8 changed files with 72 additions and 3 deletions

View File

@@ -26,7 +26,9 @@
#include <nvgpu/enabled.h>
#include <nvgpu/nvlink.h>
#include <nvgpu/soc.h>
#include <nvgpu/sim.h>
#include "nvlink.h"
#include "gk20a/gk20a.h"
#include "clk/clk.h"
#include "clk/clk_mclk.h"
@@ -35,12 +37,10 @@
#include "sysfs.h"
#include "os_linux.h"
#include "platform_gk20a.h"
#include <nvgpu/sim.h>
#include "pci.h"
#include "pci_usermode.h"
#include "os_linux.h"
#include "driver_common.h"
#define PCI_INTERFACE_NAME "card-%s%%s"
@@ -828,9 +828,11 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
if (gk20a_gpu_is_virtual(dev))
return;
nvgpu_nvlink_remove(g);
err = nvgpu_nvlink_deinit(g);
WARN(err, "gpu failed to remove nvlink");
gk20a_driver_start_unload(g);
err = nvgpu_quiesce(g);
/* TODO: handle failure to idle */
WARN(err, "gpu failed to idle during driver removal");