diff --git a/drivers/gpu/nvgpu/Makefile.shared.configs b/drivers/gpu/nvgpu/Makefile.shared.configs index 8c85adca2..d06583fd2 100644 --- a/drivers/gpu/nvgpu/Makefile.shared.configs +++ b/drivers/gpu/nvgpu/Makefile.shared.configs @@ -51,4 +51,8 @@ NVGPU_COMMON_CFLAGS += -DCONFIG_GK20A_CTXSW_TRACE IGPU_VIRT_SUPPORT := 1 NVGPU_COMMON_CFLAGS += -DIGPU_VIRT_SUPPORT + +# Enable nvlink support for normal build. +NVGPU_NVLINK_SUPPORT := 1 +NVGPU_COMMON_CFLAGS += -DCONFIG_TEGRA_NVLINK endif diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index 80c660351..216443808 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -37,7 +37,6 @@ srcs += os/posix/nvgpu.c \ os/posix/posix-clk_arb.c \ os/posix/posix-channel.c \ os/posix/posix-tsg.c \ - os/posix/posix-nvlink.c \ os/posix/stubs.c \ os/posix/posix-sim.c \ os/posix/posix-nvhost.c \ @@ -45,6 +44,10 @@ srcs += os/posix/nvgpu.c \ os/posix/posix-dt.c \ os/posix/posix-vidmem.c \ os/posix/fecs_trace_posix.c + +ifdef NVGPU_NVLINK_SUPPORT +srcs += os/posix/posix-nvlink.c +endif endif # POSIX sources shared between the POSIX and QNX builds. @@ -95,7 +98,6 @@ srcs += common/sim/sim.c \ common/ecc.c \ common/ce/ce.c \ common/vbios/bios.c \ - common/vbios/nvlink_bios.c \ common/vbios/bios_sw_gp106.c \ common/vbios/bios_sw_gv100.c \ common/vbios/bios_sw_tu104.c \ @@ -232,15 +234,6 @@ srcs += common/sim/sim.c \ common/clk_arb/clk_arb.c \ common/clk_arb/clk_arb_gp10b.c \ common/clk_arb/clk_arb_gv100.c \ - common/nvlink/probe.c \ - common/nvlink/init/device_reginit.c \ - common/nvlink/init/device_reginit_gv100.c \ - common/nvlink/intr_and_err_handling_gv100.c \ - common/nvlink/minion.c \ - common/nvlink/link_mode_transitions.c \ - common/nvlink/nvlink_gv100.c \ - common/nvlink/nvlink_tu104.c \ - common/nvlink/nvlink.c \ common/fence/fence.c \ hal/mm/mm_gk20a.c \ hal/mm/mm_gm20b.c \ @@ -422,10 +415,6 @@ srcs += common/sim/sim.c \ hal/netlist/netlist_tu104.c \ hal/nvdec/nvdec_gp106.c \ hal/nvdec/nvdec_tu104.c \ - hal/nvlink/minion_gv100.c \ - hal/nvlink/minion_tu104.c \ - hal/nvlink/link_mode_transitions_gv100.c \ - hal/nvlink/link_mode_transitions_tu104.c \ hal/gsp/gsp_gv100.c \ hal/sec2/sec2_gp106.c \ hal/sec2/sec2_tu104.c \ @@ -510,3 +499,20 @@ srcs += common/vgpu/init/init_vgpu.c \ common/vgpu/gv11b/vgpu_tsg_gv11b.c \ common/vgpu/gp10b/vgpu_hal_gp10b.c endif + +ifeq ($(NVGPU_NVLINK_SUPPORT), 1) +srcs += common/vbios/nvlink_bios.c \ + common/nvlink/probe.c \ + common/nvlink/init/device_reginit.c \ + common/nvlink/init/device_reginit_gv100.c \ + common/nvlink/intr_and_err_handling_gv100.c \ + common/nvlink/minion.c \ + common/nvlink/link_mode_transitions.c \ + common/nvlink/nvlink_gv100.c \ + common/nvlink/nvlink_tu104.c \ + common/nvlink/nvlink.c \ + hal/nvlink/minion_gv100.c \ + hal/nvlink/minion_tu104.c \ + hal/nvlink/link_mode_transitions_gv100.c \ + hal/nvlink/link_mode_transitions_tu104.c +endif diff --git a/drivers/gpu/nvgpu/Makefile.tmk b/drivers/gpu/nvgpu/Makefile.tmk index c94555f9b..e9d9394bb 100644 --- a/drivers/gpu/nvgpu/Makefile.tmk +++ b/drivers/gpu/nvgpu/Makefile.tmk @@ -62,8 +62,7 @@ NV_COMPONENT_CFLAGS += \ -DCONFIG_TEGRA_ACR=1 \ -DCONFIG_TEGRA_GR_VIRTUALIZATION \ -DCONFIG_GK20A_VIDMEM=1 \ - -DCONFIG_PCI_MSI \ - -DCONFIG_TEGRA_NVLINK + -DCONFIG_PCI_MSI -include $(NV_COMPONENT_DIR)/Makefile.shared.configs NV_COMPONENT_CFLAGS += $(NVGPU_COMMON_CFLAGS) diff --git a/drivers/gpu/nvgpu/hal/fb/fb_gv11b.c b/drivers/gpu/nvgpu/hal/fb/fb_gv11b.c index 089a6332a..7c5a4d3e8 100644 --- a/drivers/gpu/nvgpu/hal/fb/fb_gv11b.c +++ b/drivers/gpu/nvgpu/hal/fb/fb_gv11b.c @@ -53,7 +53,9 @@ static void gv11b_init_nvlink_soc_credits(struct gk20a *g) nvgpu_log(g, gpu_dbg_info, "nvlink soc credits init done by bpmp"); } else { #ifndef __NVGPU_POSIX__ +#ifdef CONFIG_TEGRA_NVLINK nvgpu_mss_nvlink_init_credits(g); +#endif #endif } } diff --git a/drivers/gpu/nvgpu/os/linux/nvlink.c b/drivers/gpu/nvgpu/os/linux/nvlink.c index cda88cdfe..b388f0307 100644 --- a/drivers/gpu/nvgpu/os/linux/nvlink.c +++ b/drivers/gpu/nvgpu/os/linux/nvlink.c @@ -251,7 +251,6 @@ int nvgpu_nvlink_minion_load_ucode(struct gk20a *g, return err; } -#endif /* CONFIG_TEGRA_NVLINK */ void nvgpu_mss_nvlink_init_credits(struct gk20a *g) { @@ -287,6 +286,7 @@ void nvgpu_mss_nvlink_init_credits(struct gk20a *g) val = readl_relaxed(soc4 + 4); writel_relaxed(val, soc4 + 4); } +#endif /* CONFIG_TEGRA_NVLINK */ int nvgpu_nvlink_deinit(struct gk20a *g) { diff --git a/userspace/Makefile.configs b/userspace/Makefile.configs index aa5a1814f..bea469905 100644 --- a/userspace/Makefile.configs +++ b/userspace/Makefile.configs @@ -44,7 +44,6 @@ CONFIGS := \ -DCONFIG_GK20A_VIDMEM=1 \ -DCONFIG_PCI_MSI \ -DCONFIG_SUPPORT_PMU_PSTATE \ - -DCONFIG_TEGRA_NVLINK \ -DNVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT # Uncomment these to enable the config. diff --git a/userspace/Makefile.tmk b/userspace/Makefile.tmk index de8c792ab..0fea8628d 100644 --- a/userspace/Makefile.tmk +++ b/userspace/Makefile.tmk @@ -124,7 +124,6 @@ NV_COMPONENT_CFLAGS += \ -DCONFIG_GK20A_VIDMEM=1 \ -DCONFIG_PCI_MSI \ -DCONFIG_SUPPORT_PMU_PSTATE \ - -DCONFIG_TEGRA_NVLINK \ -DNVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT -include ../drivers/gpu/nvgpu/Makefile.shared.configs diff --git a/userspace/units/Makefile.units.common.tmk b/userspace/units/Makefile.units.common.tmk index 3ecbce675..f973da777 100644 --- a/userspace/units/Makefile.units.common.tmk +++ b/userspace/units/Makefile.units.common.tmk @@ -67,8 +67,7 @@ NV_COMPONENT_CFLAGS += \ -DCONFIG_ARCH_TEGRA_18x_SOC=1 \ -DCONFIG_GK20A_VIDMEM=1 \ -DCONFIG_PCI_MSI \ - -DCONFIG_SUPPORT_PMU_PSTATE \ - -DCONFIG_TEGRA_NVLINK + -DCONFIG_SUPPORT_PMU_PSTATE -include $(NV_SOURCE)/kernel/nvgpu/drivers/gpu/nvgpu/Makefile.shared.configs NV_COMPONENT_CFLAGS += $(NVGPU_COMMON_CFLAGS)