gpu: nvgpu: compile out ununsed code on safety build for common.nvgpu

Jira NVGPU-7052

Change-Id: Idab4f9d56c0748f54fd08fc5fd01d96a66f94700
Signed-off-by: shashank singh <shashsingh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2581247
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2670885
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
shashank singh
2021-08-23 10:29:42 +05:30
committed by mobile promotions
parent 05a1f927f8
commit fb0ebef0a7
6 changed files with 22 additions and 9 deletions

View File

@@ -55,8 +55,11 @@ NVGPU_COMMON_CFLAGS :=
NVGPU_COMMON_CFLAGS += \ NVGPU_COMMON_CFLAGS += \
-DCONFIG_TEGRA_GK20A_PMU=1 \ -DCONFIG_TEGRA_GK20A_PMU=1 \
-DCONFIG_TEGRA_ACR=1 \ -DCONFIG_TEGRA_ACR=1 \
-DCONFIG_NVGPU_GR_VIRTUALIZATION \ -DCONFIG_NVGPU_GR_VIRTUALIZATION
-DCONFIG_PCI_MSI
ifeq ($(CONFIG_NVGPU_DGPU),1)
NVGPU_COMMON_CFLAGS += -DCONFIG_PCI_MSI
endif
CONFIG_NVGPU_LOGGING := 1 CONFIG_NVGPU_LOGGING := 1
NVGPU_COMMON_CFLAGS += -DCONFIG_NVGPU_LOGGING NVGPU_COMMON_CFLAGS += -DCONFIG_NVGPU_LOGGING

View File

@@ -1187,9 +1187,11 @@ static void gk20a_free_cb(struct nvgpu_ref *refcount)
gk20a_debug_deinit(g); gk20a_debug_deinit(g);
#ifdef CONFIG_NVGPU_NON_FUSA
if (g->gfree != NULL) { if (g->gfree != NULL) {
g->gfree(g); g->gfree(g);
} }
#endif
} }
struct gk20a *nvgpu_get(struct gk20a *g) struct gk20a *nvgpu_get(struct gk20a *g)

View File

@@ -370,6 +370,7 @@ struct nvgpu_gpu_params {
* and not in the main gk20a struct. * and not in the main gk20a struct.
*/ */
struct gk20a { struct gk20a {
#ifdef CONFIG_NVGPU_NON_FUSA
/** /**
* @brief Free data in the struct allocated during its creation. * @brief Free data in the struct allocated during its creation.
* *
@@ -381,6 +382,7 @@ struct gk20a {
* have had the opportunity to free their private data. * have had the opportunity to free their private data.
*/ */
void (*gfree)(struct gk20a *g); void (*gfree)(struct gk20a *g);
#endif
/** Starting virtual address of mapped bar0 io region. */ /** Starting virtual address of mapped bar0 io region. */
uintptr_t regs; uintptr_t regs;
@@ -619,10 +621,12 @@ struct gk20a {
u32 emc3d_ratio; u32 emc3d_ratio;
#endif #endif
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
/** /**
* A group of semaphore pools. One for each channel. * A group of semaphore pools. One for each channel.
*/ */
struct nvgpu_semaphore_sea *sema_sea; struct nvgpu_semaphore_sea *sema_sea;
#endif
#ifdef CONFIG_NVGPU_DEBUGGER #ifdef CONFIG_NVGPU_DEBUGGER
/* held while manipulating # of debug/profiler sessions present */ /* held while manipulating # of debug/profiler sessions present */
@@ -828,18 +832,18 @@ struct gk20a {
/* PCIe power states. */ /* PCIe power states. */
bool xve_l0s; bool xve_l0s;
bool xve_l1; bool xve_l1;
#endif
#if defined(CONFIG_PCI_MSI)
/* Check if msi is enabled */
bool msi_enabled;
#endif
#endif
/** /**
* The per-device identifier. The iGPUs without a PDI will use * The per-device identifier. The iGPUs without a PDI will use
* the SoC PDI if one exists. Zero if neither exists. * the SoC PDI if one exists. Zero if neither exists.
*/ */
u64 per_device_identifier; u64 per_device_identifier;
#if defined(CONFIG_PCI_MSI)
/* Check if msi is enabled */
bool msi_enabled;
#endif
#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE #ifdef CONFIG_NVGPU_TRACK_MEM_USAGE
struct nvgpu_mem_alloc_tracker *vmallocs; struct nvgpu_mem_alloc_tracker *vmallocs;
struct nvgpu_mem_alloc_tracker *kmallocs; struct nvgpu_mem_alloc_tracker *kmallocs;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -30,6 +30,7 @@
* @{ * @{
*/ */
#ifdef CONFIG_NVGPU_NON_FUSA
/** /**
* @brief Restart driver as implemented for OS. * @brief Restart driver as implemented for OS.
* *
@@ -42,6 +43,7 @@
* - On QNX, this simply calls BUG() which will restart the driver. * - On QNX, this simply calls BUG() which will restart the driver.
*/ */
void nvgpu_kernel_restart(void *cmd); void nvgpu_kernel_restart(void *cmd);
#endif
#ifdef NVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT #ifdef NVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT
struct nvgpu_posix_fault_inj *nvgpu_nvgpu_get_fault_injection(void); struct nvgpu_posix_fault_inj *nvgpu_nvgpu_get_fault_injection(void);

View File

@@ -86,6 +86,7 @@ static struct nvgpu_posix_io_callbacks default_posix_reg_callbacks = {
.bar1_readl = readl_access_reg_fn, .bar1_readl = readl_access_reg_fn,
}; };
#ifdef CONFIG_NVGPU_NON_FUSA
/* /*
* Somewhat meaningless in userspace... * Somewhat meaningless in userspace...
*/ */
@@ -94,6 +95,7 @@ void nvgpu_kernel_restart(void *cmd)
(void)cmd; (void)cmd;
BUG(); BUG();
} }
#endif
void nvgpu_start_gpu_idle(struct gk20a *g) void nvgpu_start_gpu_idle(struct gk20a *g)
{ {

View File

@@ -295,8 +295,8 @@ int test_get_put(struct unit_module *m,
/* to cover the cases where these are set */ /* to cover the cases where these are set */
#ifdef CONFIG_NVGPU_NON_FUSA #ifdef CONFIG_NVGPU_NON_FUSA
g->remove_support = no_return; g->remove_support = no_return;
#endif
g->gfree = no_return; g->gfree = no_return;
#endif
g->ops.ecc.ecc_remove_support = no_return; g->ops.ecc.ecc_remove_support = no_return;
g->ops.ltc.ltc_remove_support = no_return; g->ops.ltc.ltc_remove_support = no_return;