gpu: nvgpu: Disable ELPG on Prod build

On embedded linux production build, disable the below features
1. ELPG support and its debug and sysfs nodes
2. PERFMON support and its debug and sysfs nodes

JIRA NVGPU-9763

Signed-off-by: Dinesh Kamalakannan <dineshka@nvidia.com>
Change-Id: Icae1a082c2ee3a4b2c6ffc4862a0fc5b22bc4366
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2827571/
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2827571
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Dinesh Kamalakannan
2022-12-14 13:10:21 +05:30
committed by mobile promotions
parent a8581f0283
commit 1aaa6e439c
5 changed files with 65 additions and 14 deletions

View File

@@ -61,6 +61,20 @@ ifeq ($(CONFIG_NVGPU_IVM_BUILD),y)
ccflags-y += -DCONFIG_NVGPU_IVM_BUILD ccflags-y += -DCONFIG_NVGPU_IVM_BUILD
endif endif
# On Embedded Linux , tegra_prod_defconfig is used as kernel defconfig
# to build the production kernel. Used the variable NV_BUILD_KERNEL_CONFIG_NAME to
# detect the production build, to disable the debug and
# profiling related stuff on nvgpu
#
# Production Defconfig is available on below mentioned path
# https://lmi-hub/source/xref/stage-main_automotive/kernel/kernel-5.10/arch/arm64/configs/tegra_prod_defconfig
#
# The makefile which sets NV_BUILD_KERNEL_CONFIG_NAME is present on
# https://git-master.nvidia.com/r/plugins/gitiles/tegra/build/make/+/refs/changes/74/2809974/8/umbrella/parts/Makefile.kernel
ifeq ($(CONFIG_NVGPU_EMB_LINUX_PROD_BUILD),y)
ccflags-y += -DCONFIG_NVGPU_EMB_LINUX_PROD_BUILD
endif
ccflags-y += -DCONFIG_NVGPU_DETERMINISTIC_CHANNELS ccflags-y += -DCONFIG_NVGPU_DETERMINISTIC_CHANNELS
ccflags-y += -DCONFIG_NVGPU_STATIC_POWERGATE ccflags-y += -DCONFIG_NVGPU_STATIC_POWERGATE
ccflags-y += -DCONFIG_NVGPU_ACR_LEGACY ccflags-y += -DCONFIG_NVGPU_ACR_LEGACY
@@ -510,7 +524,6 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
os/linux/debug_gr.o \ os/linux/debug_gr.o \
os/linux/debug_fifo.o \ os/linux/debug_fifo.o \
os/linux/debug_ce.o \ os/linux/debug_ce.o \
os/linux/debug_pmu.o \
os/linux/debug_pmgr.o \ os/linux/debug_pmgr.o \
os/linux/debug_sched.o \ os/linux/debug_sched.o \
os/linux/debug_allocator.o \ os/linux/debug_allocator.o \
@@ -522,6 +535,10 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
os/linux/swprofile_debugfs.o \ os/linux/swprofile_debugfs.o \
os/linux/debug_gsp.o os/linux/debug_gsp.o
ifneq ($(CONFIG_NVGPU_EMB_LINUX_PROD_BUILD),y)
nvgpu-$(CONFIG_DEBUG_FS) += os/linux/debug_pmu.o
endif
nvgpu-$(CONFIG_NVGPU_LOGGING) += os/linux/log.o nvgpu-$(CONFIG_NVGPU_LOGGING) += os/linux/log.o
ifeq ($(CONFIG_NVGPU_TRACK_MEM_USAGE),y) ifeq ($(CONFIG_NVGPU_TRACK_MEM_USAGE),y)

View File

@@ -134,6 +134,23 @@ CONFIG_NVGPU_NVMAP_NEXT := y
CONFIG_NVGPU_NVMEM_FUSE := y CONFIG_NVGPU_NVMEM_FUSE := y
endif endif
ifeq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux)
# On Embedded Linux , tegra_prod_defconfig is used as kernel defconfig
# to build the production kernel. Used the variable NV_BUILD_KERNEL_CONFIG_NAME to
# detect the production build, to disable the debug and
# profiling related stuff on nvgpu
#
# Production Defconfig is available on below mentioned path
# https://lmi-hub/source/xref/stage-main_automotive/kernel/kernel-5.10/arch/arm64/configs/tegra_prod_defconfig
#
# The makefile which sets NV_BUILD_KERNEL_CONFIG_NAME is present on
# https://git-master.nvidia.com/r/plugins/gitiles/tegra/build/make/+/refs/changes/74/2809974/8/umbrella/parts/Makefile.kernel
ifeq ($(NV_BUILD_KERNEL_CONFIG_NAME),tegra_prod_defconfig)
CONFIG_NVGPU_EMB_LINUX_PROD_BUILD := y
endif
endif
CONFIG_NVGPU_IVM_BUILD := y CONFIG_NVGPU_IVM_BUILD := y
# Set config for OOT module build # Set config for OOT module build

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017-2022, NVIDIA Corporation. All rights reserved. * Copyright (C) 2017-2023, NVIDIA Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -511,7 +511,9 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
&g->runlist_interleave); &g->runlist_interleave);
gr_gk20a_debugfs_init(g); gr_gk20a_debugfs_init(g);
#ifndef CONFIG_NVGPU_EMB_LINUX_PROD_BUILD
gk20a_pmu_debugfs_init(g); gk20a_pmu_debugfs_init(g);
#endif
gk20a_railgating_debugfs_init(g); gk20a_railgating_debugfs_init(g);
#ifdef CONFIG_NVGPU_SUPPORT_CDE #ifdef CONFIG_NVGPU_SUPPORT_CDE
gk20a_cde_debugfs_init(g); gk20a_cde_debugfs_init(g);

View File

@@ -1,7 +1,7 @@
/* /*
* GA10B Tegra Platform Interface * GA10B Tegra Platform Interface
* *
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2016-2023, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -749,13 +749,21 @@ struct gk20a_platform ga10b_tegra_platform = {
.enable_slcg = true, .enable_slcg = true,
.enable_blcg = true, .enable_blcg = true,
.enable_elcg = true, .enable_elcg = true,
.enable_perfmon = true,
/* power management configuration JIRA NVGPU-4683 */ /* power management configuration JIRA NVGPU-4683 */
#ifndef CONFIG_NVGPU_EMB_LINUX_PROD_BUILD
.enable_perfmon = true,
.enable_elpg = true, .enable_elpg = true,
.enable_elpg_ms = false,
.can_elpg_init = true, .can_elpg_init = true,
.enable_aelpg = true, .enable_aelpg = true,
#else
/* Disable elpg on embedded linux prod build */
.enable_perfmon = false,
.enable_elpg = false,
.can_elpg_init = false,
.enable_aelpg = false,
#endif
.enable_elpg_ms = false,
/* power management callbacks */ /* power management callbacks */
.suspend = ga10b_tegra_suspend, .suspend = ga10b_tegra_suspend,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2011-2023, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -434,6 +434,7 @@ static ssize_t is_railgated_show(struct device *dev,
} }
static DEVICE_ATTR(is_railgated, S_IRUGO, is_railgated_show, NULL); static DEVICE_ATTR(is_railgated, S_IRUGO, is_railgated_show, NULL);
#ifndef CONFIG_NVGPU_EMB_LINUX_PROD_BUILD
static ssize_t counters_show(struct device *dev, static ssize_t counters_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
@@ -531,6 +532,7 @@ static ssize_t elpg_enable_read(struct device *dev,
} }
static DEVICE_ATTR(elpg_enable, ROOTRW, elpg_enable_read, elpg_enable_store); static DEVICE_ATTR(elpg_enable, ROOTRW, elpg_enable_read, elpg_enable_store);
#endif
static ssize_t ldiv_slowdown_factor_store(struct device *dev, static ssize_t ldiv_slowdown_factor_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
@@ -663,6 +665,7 @@ static ssize_t mscg_enable_read(struct device *dev,
static DEVICE_ATTR(mscg_enable, ROOTRW, mscg_enable_read, mscg_enable_store); static DEVICE_ATTR(mscg_enable, ROOTRW, mscg_enable_read, mscg_enable_store);
#ifndef CONFIG_NVGPU_EMB_LINUX_PROD_BUILD
static ssize_t aelpg_param_store(struct device *dev, static ssize_t aelpg_param_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
@@ -787,7 +790,7 @@ static ssize_t aelpg_enable_read(struct device *dev,
static DEVICE_ATTR(aelpg_enable, ROOTRW, static DEVICE_ATTR(aelpg_enable, ROOTRW,
aelpg_enable_read, aelpg_enable_store); aelpg_enable_read, aelpg_enable_store);
#endif
static ssize_t allow_all_enable_read(struct device *dev, static ssize_t allow_all_enable_read(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
@@ -1495,24 +1498,27 @@ void nvgpu_remove_sysfs(struct device *dev)
device_remove_file(dev, &dev_attr_ptimer_scale_factor); device_remove_file(dev, &dev_attr_ptimer_scale_factor);
device_remove_file(dev, &dev_attr_ptimer_ref_freq); device_remove_file(dev, &dev_attr_ptimer_ref_freq);
device_remove_file(dev, &dev_attr_ptimer_src_freq); device_remove_file(dev, &dev_attr_ptimer_src_freq);
device_remove_file(dev, &dev_attr_elpg_enable);
device_remove_file(dev, &dev_attr_mscg_enable); device_remove_file(dev, &dev_attr_mscg_enable);
device_remove_file(dev, &dev_attr_emc3d_ratio); device_remove_file(dev, &dev_attr_emc3d_ratio);
device_remove_file(dev, &dev_attr_ldiv_slowdown_factor); device_remove_file(dev, &dev_attr_ldiv_slowdown_factor);
device_remove_file(dev, &dev_attr_fmax_at_vmin_safe); device_remove_file(dev, &dev_attr_fmax_at_vmin_safe);
#ifndef CONFIG_NVGPU_EMB_LINUX_PROD_BUILD
device_remove_file(dev, &dev_attr_elpg_enable);
device_remove_file(dev, &dev_attr_counters); device_remove_file(dev, &dev_attr_counters);
device_remove_file(dev, &dev_attr_counters_reset); device_remove_file(dev, &dev_attr_counters_reset);
device_remove_file(dev, &dev_attr_load); device_remove_file(dev, &dev_attr_load);
device_remove_file(dev, &dev_attr_aelpg_param);
device_remove_file(dev, &dev_attr_aelpg_enable);
#endif
device_remove_file(dev, &dev_attr_railgate_delay); device_remove_file(dev, &dev_attr_railgate_delay);
device_remove_file(dev, &dev_attr_is_railgated); device_remove_file(dev, &dev_attr_is_railgated);
#ifdef CONFIG_PM #ifdef CONFIG_PM
device_remove_file(dev, &dev_attr_force_idle); device_remove_file(dev, &dev_attr_force_idle);
device_remove_file(dev, &dev_attr_railgate_enable); device_remove_file(dev, &dev_attr_railgate_enable);
#endif #endif
device_remove_file(dev, &dev_attr_aelpg_param);
device_remove_file(dev, &dev_attr_aelpg_enable);
device_remove_file(dev, &dev_attr_allow_all); device_remove_file(dev, &dev_attr_allow_all);
device_remove_file(dev, &dev_attr_tpc_fs_mask); device_remove_file(dev, &dev_attr_tpc_fs_mask);
device_remove_file(dev, &dev_attr_tpc_pg_mask); device_remove_file(dev, &dev_attr_tpc_pg_mask);
@@ -1570,24 +1576,25 @@ int nvgpu_create_sysfs(struct device *dev)
error |= device_create_file(dev, &dev_attr_ptimer_scale_factor); error |= device_create_file(dev, &dev_attr_ptimer_scale_factor);
error |= device_create_file(dev, &dev_attr_ptimer_ref_freq); error |= device_create_file(dev, &dev_attr_ptimer_ref_freq);
error |= device_create_file(dev, &dev_attr_ptimer_src_freq); error |= device_create_file(dev, &dev_attr_ptimer_src_freq);
error |= device_create_file(dev, &dev_attr_elpg_enable);
error |= device_create_file(dev, &dev_attr_mscg_enable); error |= device_create_file(dev, &dev_attr_mscg_enable);
error |= device_create_file(dev, &dev_attr_emc3d_ratio); error |= device_create_file(dev, &dev_attr_emc3d_ratio);
error |= device_create_file(dev, &dev_attr_ldiv_slowdown_factor); error |= device_create_file(dev, &dev_attr_ldiv_slowdown_factor);
error |= device_create_file(dev, &dev_attr_fmax_at_vmin_safe); error |= device_create_file(dev, &dev_attr_fmax_at_vmin_safe);
#ifndef CONFIG_NVGPU_EMB_LINUX_PROD_BUILD
error |= device_create_file(dev, &dev_attr_counters); error |= device_create_file(dev, &dev_attr_counters);
error |= device_create_file(dev, &dev_attr_counters_reset); error |= device_create_file(dev, &dev_attr_counters_reset);
error |= device_create_file(dev, &dev_attr_load); error |= device_create_file(dev, &dev_attr_load);
error |= device_create_file(dev, &dev_attr_elpg_enable);
error |= device_create_file(dev, &dev_attr_aelpg_param);
error |= device_create_file(dev, &dev_attr_aelpg_enable);
#endif
error |= device_create_file(dev, &dev_attr_railgate_delay); error |= device_create_file(dev, &dev_attr_railgate_delay);
error |= device_create_file(dev, &dev_attr_is_railgated); error |= device_create_file(dev, &dev_attr_is_railgated);
#ifdef CONFIG_PM #ifdef CONFIG_PM
error |= device_create_file(dev, &dev_attr_force_idle); error |= device_create_file(dev, &dev_attr_force_idle);
error |= device_create_file(dev, &dev_attr_railgate_enable); error |= device_create_file(dev, &dev_attr_railgate_enable);
#endif #endif
error |= device_create_file(dev, &dev_attr_aelpg_param);
error |= device_create_file(dev, &dev_attr_aelpg_enable);
error |= device_create_file(dev, &dev_attr_allow_all); error |= device_create_file(dev, &dev_attr_allow_all);
error |= device_create_file(dev, &dev_attr_tpc_fs_mask); error |= device_create_file(dev, &dev_attr_tpc_fs_mask);
error |= device_create_file(dev, &dev_attr_tpc_pg_mask); error |= device_create_file(dev, &dev_attr_tpc_pg_mask);