From 2fecf71e4556c5cc52116b11ebf278a55d82bb22 Mon Sep 17 00:00:00 2001 From: Shashank Singh Date: Tue, 21 Apr 2020 12:54:16 +0000 Subject: [PATCH] gpu: nvgpu: add disable nvlink option in gk20a_platform Add option to disable nvlink in struct gk20a_platform so that chips that do not support nvlink can work with pcie without compiling out nvlink code. Jira NVGPU-5870 Change-Id: Idc60418b5cf322ac81b241a4e59d25f5d8e6b9ca Signed-off-by: Shashank Singh Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2332162 Reviewed-by: automaticguardword Reviewed-by: Deepak Nibade Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/pci.c | 11 ++++++++++- drivers/gpu/nvgpu/os/linux/platform_gk20a.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/os/linux/pci.c b/drivers/gpu/nvgpu/os/linux/pci.c index ed51228c4..a79685a03 100644 --- a/drivers/gpu/nvgpu/os/linux/pci.c +++ b/drivers/gpu/nvgpu/os/linux/pci.c @@ -96,6 +96,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { .can_elcg = false, .disable_aspm = true, + .disable_nvlink = false, .pstate = true, /* power management callbacks */ @@ -138,6 +139,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { .can_elcg = false, .disable_aspm = true, + .disable_nvlink = false, .pstate = true, /* power management callbacks */ @@ -178,6 +180,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { .can_elcg = false, .disable_aspm = true, + .disable_nvlink = false, /* power management callbacks */ .is_railgated = nvgpu_pci_tegra_is_railgated, @@ -216,6 +219,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { .can_elcg = false, .disable_aspm = true, + .disable_nvlink = true, .pstate = false, /* power management callbacks */ @@ -651,7 +655,12 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, goto err_free_irq; } - err = nvgpu_nvlink_probe(g); + if (!platform->disable_nvlink) { + err = nvgpu_nvlink_probe(g); + } else { + err = -ENODEV; + } + /* * ENODEV is a legal error which means there is no NVLINK * any other error is fatal diff --git a/drivers/gpu/nvgpu/os/linux/platform_gk20a.h b/drivers/gpu/nvgpu/os/linux/platform_gk20a.h index cc1532483..310cfe87b 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gk20a.h +++ b/drivers/gpu/nvgpu/os/linux/platform_gk20a.h @@ -151,6 +151,9 @@ struct gk20a_platform { /* Disable big page support */ bool disable_bigpage; + /* Disable nvlink support */ + bool disable_nvlink; + /* * gk20a_do_idle() API can take GPU either into rail gate or CAR reset * This flag can be used to force CAR reset case instead of rail gate