gpu: nvgpu: Add nvlink.c to POSIX build

1. The nvlink code in common/ is clean from any external API usage.
   There should not be any compilation issues with POSIX build if we
   include nvlink.c to it.
2. Rename the nvlink file in POSIX build to avoid the tmake
   duplicate filename issue.
3. Set CONFIG_TEGRA_NVLINK for POSIX to enable reporting of MISRA
   violations in nvlink code by the MISRA scanner.
4. To fix the build issues:
     a. Add stubs in POSIX
     b. Return the 'err' variable set during dev_shutdown() as 'err'
        is set but not used.

JIRA NVGPU-1921
JIRA NVGPU-1319

Change-Id: Ifdd6574d772167856782bafa74994507b3cedf4c
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2005622
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Tejal Kudav
2019-01-25 09:41:37 +05:30
committed by mobile promotions
parent 26d9b79162
commit 15115e7db9
7 changed files with 75 additions and 11 deletions

View File

@@ -43,7 +43,7 @@ srcs += os/posix/nvgpu.c \
os/posix/posix-clk_arb.c \
os/posix/posix-channel.c \
os/posix/posix-tsg.c \
os/posix/nvlink.c \
os/posix/posix-nvlink.c \
os/posix/lock.c \
os/posix/stubs.c \
os/posix/posix-fault-injection.c \
@@ -52,9 +52,6 @@ srcs += os/posix/nvgpu.c \
os/posix/posix-vgpu.c \
os/posix/posix-dt.c \
os/posix/posix-vidmem.c
else
# Causes duplicate file name if included
srcs += common/nvlink/nvlink.c
endif
# POSIX sources shared between the POSIX and QNX builds.
@@ -268,6 +265,7 @@ srcs += common/sim.c \
common/nvlink/probe.c \
common/nvlink/nvlink_gv100.c \
common/nvlink/nvlink_tu104.c \
common/nvlink/nvlink.c \
gv100/hal_gv100.c \
gv100/gsp_gv100.c \
gv100/clk_gv100.c \

View File

@@ -56,7 +56,9 @@ NV_COMPONENT_CFLAGS += \
-DCONFIG_TEGRA_ACR=1 \
-DCONFIG_TEGRA_GR_VIRTUALIZATION \
-DCONFIG_GK20A_VIDMEM=1 \
-DCONFIG_PCI_MSI
-DCONFIG_PCI_MSI \
-DCONFIG_TEGRA_NVLINK
_NV_TOOLCHAIN_CFLAGS += -rdynamic -g
-include $(NV_COMPONENT_DIR)/Makefile.sources

View File

@@ -99,7 +99,7 @@ int nvgpu_nvlink_dev_shutdown(struct gk20a *g)
int err;
err = g->ops.nvlink.shutdown(g);
return 0;
return err;
}
int nvgpu_nvlink_reg_init(struct gk20a *g)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -21,6 +21,11 @@
*/
#include <nvgpu/nvlink.h>
#include <nvgpu/bug.h>
#include <nvgpu/nvlink_probe.h>
struct gk20a;
struct nvgpu_firmware;
int nvgpu_nvlink_train(struct gk20a *g, u32 link_id, bool from_off)
{
@@ -31,3 +36,58 @@ int nvgpu_nvlink_enumerate(struct gk20a *g)
{
return -ENOSYS;
}
int nvgpu_nvlink_register_device(struct gk20a *g)
{
BUG();
return 0;
}
int nvgpu_nvlink_unregister_device(struct gk20a *g)
{
BUG();
return 0;
}
int nvgpu_nvlink_register_link(struct gk20a *g)
{
BUG();
return 0;
}
int nvgpu_nvlink_unregister_link(struct gk20a *g)
{
BUG();
return 0;
}
int nvgpu_nvlink_setup_ndev(struct gk20a *g)
{
BUG();
return 0;
}
int nvgpu_nvlink_init_ops(struct gk20a *g)
{
BUG();
return 0;
}
int nvgpu_nvlink_read_dt_props(struct gk20a *g)
{
BUG();
return 0;
}
u32 nvgpu_nvlink_minion_load_ucode(struct gk20a *g,
struct nvgpu_firmware *nvgpu_minion_fw)
{
BUG();
return 0;
}
void nvgpu_nvlink_free_minion_used_mem(struct gk20a *g,
struct nvgpu_firmware *nvgpu_minion_fw)
{
BUG();
}

View File

@@ -21,8 +21,8 @@ CONFIGS := \
-DCONFIG_ARCH_TEGRA_18x_SOC=1 \
-DCONFIG_GK20A_VIDMEM=1 \
-DCONFIG_PCI_MSI \
-DCONFIG_SUPPORT_PMU_PSTATE
-DCONFIG_SUPPORT_PMU_PSTATE \
-DCONFIG_TEGRA_NVLINK
# Uncomment these to enable the config.
# CONFIGS += -DCONFIG_NVGPU_TRACK_MEM_USAGE=y

View File

@@ -112,7 +112,9 @@ NV_COMPONENT_CFLAGS += \
-DCONFIG_ARCH_TEGRA_18x_SOC=1 \
-DCONFIG_GK20A_VIDMEM=1 \
-DCONFIG_PCI_MSI \
-DCONFIG_SUPPORT_PMU_PSTATE
-DCONFIG_SUPPORT_PMU_PSTATE \
-DCONFIG_TEGRA_NVLINK
NV_COMPONENT_SYSTEMIMAGE_DIR := $(NV_SYSTEMIMAGE_TEST_EXECUTABLE_DIR)/nvgpu_unit/
systemimage:: $(NV_COMPONENT_SYSTEMIMAGE_DIR)
$(NV_COMPONENT_SYSTEMIMAGE_DIR) : $(NV_SYSTEMIMAGE_TEST_EXECUTABLE_DIR)

View File

@@ -50,7 +50,9 @@ NV_COMPONENT_CFLAGS += \
-DCONFIG_ARCH_TEGRA_18x_SOC=1 \
-DCONFIG_GK20A_VIDMEM=1 \
-DCONFIG_PCI_MSI \
-DCONFIG_SUPPORT_PMU_PSTATE
-DCONFIG_SUPPORT_PMU_PSTATE \
-DCONFIG_TEGRA_NVLINK
NV_COMPONENT_NEEDED_INTERFACE_DIRS += \
$(NV_SOURCE)/kernel/nvgpu/drivers/gpu/nvgpu \
$(NV_SOURCE)/kernel/nvgpu/userspace