mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 02:52:51 +03:00
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:
committed by
mobile promotions
parent
d80e816875
commit
b4b1fb97bd
@@ -14,6 +14,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_TEGRA_NVLINK
|
||||
#include <linux/platform/tegra/tegra-nvlink.h>
|
||||
#endif
|
||||
|
||||
#include <gk20a/gk20a.h>
|
||||
#include <nvgpu/nvlink.h>
|
||||
#include <nvgpu/enabled.h>
|
||||
@@ -104,3 +108,25 @@ void nvgpu_mss_nvlink_init_credits(struct gk20a *g)
|
||||
val = readl_relaxed(soc4 + 4);
|
||||
writel_relaxed(val, soc4 + 4);
|
||||
}
|
||||
|
||||
int nvgpu_nvlink_deinit(struct gk20a *g)
|
||||
{
|
||||
#ifdef CONFIG_TEGRA_NVLINK
|
||||
struct nvlink_device *ndev = g->nvlink.priv;
|
||||
int err;
|
||||
|
||||
if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK))
|
||||
return -ENODEV;
|
||||
|
||||
err = nvlink_shutdown(ndev);
|
||||
if (err) {
|
||||
nvgpu_err(g, "failed to shut down nvlink");
|
||||
return err;
|
||||
}
|
||||
|
||||
nvgpu_nvlink_remove(g);
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user