diff --git a/drivers/gpu/nvgpu/Makefile.shared.configs b/drivers/gpu/nvgpu/Makefile.shared.configs index a28088f9c..3af8de089 100644 --- a/drivers/gpu/nvgpu/Makefile.shared.configs +++ b/drivers/gpu/nvgpu/Makefile.shared.configs @@ -55,8 +55,11 @@ NVGPU_COMMON_CFLAGS := NVGPU_COMMON_CFLAGS += \ -DCONFIG_TEGRA_GK20A_PMU=1 \ -DCONFIG_TEGRA_ACR=1 \ - -DCONFIG_NVGPU_GR_VIRTUALIZATION \ - -DCONFIG_PCI_MSI + -DCONFIG_NVGPU_GR_VIRTUALIZATION + +ifeq ($(CONFIG_NVGPU_DGPU),1) +NVGPU_COMMON_CFLAGS += -DCONFIG_PCI_MSI +endif CONFIG_NVGPU_LOGGING := 1 NVGPU_COMMON_CFLAGS += -DCONFIG_NVGPU_LOGGING diff --git a/drivers/gpu/nvgpu/common/init/nvgpu_init.c b/drivers/gpu/nvgpu/common/init/nvgpu_init.c index b18cf8859..3474dae1c 100644 --- a/drivers/gpu/nvgpu/common/init/nvgpu_init.c +++ b/drivers/gpu/nvgpu/common/init/nvgpu_init.c @@ -1187,9 +1187,11 @@ static void gk20a_free_cb(struct nvgpu_ref *refcount) gk20a_debug_deinit(g); +#ifdef CONFIG_NVGPU_NON_FUSA if (g->gfree != NULL) { g->gfree(g); } +#endif } struct gk20a *nvgpu_get(struct gk20a *g) diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index 3ea6018ad..a8e90656f 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -370,6 +370,7 @@ struct nvgpu_gpu_params { * and not in the main gk20a struct. */ struct gk20a { +#ifdef CONFIG_NVGPU_NON_FUSA /** * @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. */ void (*gfree)(struct gk20a *g); +#endif /** Starting virtual address of mapped bar0 io region. */ uintptr_t regs; @@ -619,10 +621,12 @@ struct gk20a { u32 emc3d_ratio; #endif +#ifdef CONFIG_NVGPU_SW_SEMAPHORE /** * A group of semaphore pools. One for each channel. */ struct nvgpu_semaphore_sea *sema_sea; +#endif #ifdef CONFIG_NVGPU_DEBUGGER /* held while manipulating # of debug/profiler sessions present */ @@ -828,18 +832,18 @@ struct gk20a { /* PCIe power states. */ bool xve_l0s; 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 SoC PDI if one exists. Zero if neither exists. */ u64 per_device_identifier; -#if defined(CONFIG_PCI_MSI) - /* Check if msi is enabled */ - bool msi_enabled; -#endif #ifdef CONFIG_NVGPU_TRACK_MEM_USAGE struct nvgpu_mem_alloc_tracker *vmallocs; struct nvgpu_mem_alloc_tracker *kmallocs; diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h index c73ca3a1a..e71898960 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h @@ -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 * 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. * @@ -42,6 +43,7 @@ * - On QNX, this simply calls BUG() which will restart the driver. */ void nvgpu_kernel_restart(void *cmd); +#endif #ifdef NVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT struct nvgpu_posix_fault_inj *nvgpu_nvgpu_get_fault_injection(void); diff --git a/drivers/gpu/nvgpu/os/posix/nvgpu.c b/drivers/gpu/nvgpu/os/posix/nvgpu.c index 506a5cd65..e1aae6353 100644 --- a/drivers/gpu/nvgpu/os/posix/nvgpu.c +++ b/drivers/gpu/nvgpu/os/posix/nvgpu.c @@ -86,6 +86,7 @@ static struct nvgpu_posix_io_callbacks default_posix_reg_callbacks = { .bar1_readl = readl_access_reg_fn, }; +#ifdef CONFIG_NVGPU_NON_FUSA /* * Somewhat meaningless in userspace... */ @@ -94,6 +95,7 @@ void nvgpu_kernel_restart(void *cmd) (void)cmd; BUG(); } +#endif void nvgpu_start_gpu_idle(struct gk20a *g) { diff --git a/userspace/units/init/nvgpu-init.c b/userspace/units/init/nvgpu-init.c index 6105bb9ed..31b9fbdb2 100644 --- a/userspace/units/init/nvgpu-init.c +++ b/userspace/units/init/nvgpu-init.c @@ -295,8 +295,8 @@ int test_get_put(struct unit_module *m, /* to cover the cases where these are set */ #ifdef CONFIG_NVGPU_NON_FUSA g->remove_support = no_return; -#endif g->gfree = no_return; +#endif g->ops.ecc.ecc_remove_support = no_return; g->ops.ltc.ltc_remove_support = no_return;