Files
meta-tegra/recipes-bsp/tegra-binaries/tegra-nvpower/0001-Drop-bc-usage-and-remove-symlink-creation-functions.patch
2025-04-19 04:26:13 -07:00

224 lines
8.0 KiB
Diff

From 20a945128145290a457c507e24ee0a15422fea36 Mon Sep 17 00:00:00 2001
From: Ilies CHERGUI <ichergui@nvidia.com>
Date: Mon, 20 Jan 2025 10:36:25 +0000
Subject: [PATCH] Drop bc usage and remove symlink creation functions
Upstream-Status: Pending
Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Ilies CHERGUI <ichergui@nvidia.com>
---
etc/systemd/nvpower.sh | 178 ++---------------------------------------
1 file changed, 7 insertions(+), 171 deletions(-)
diff --git a/etc/systemd/nvpower.sh b/etc/systemd/nvpower.sh
index df9afc7..8afcfaf 100755
--- a/etc/systemd/nvpower.sh
+++ b/etc/systemd/nvpower.sh
@@ -182,171 +182,6 @@ function is_nvpm_relinking_needed()
return 1
}
-function create_nvpmodel_symlink()
-{
- conf_file=""
-
- if [ -e "${NVPM_SYMLINK}" ]; then
- if is_nvpm_relinking_needed; then
- nvpm_back="/etc/nvpmodel_nvbackup.conf"
- echo "${SCRIPT_NAME} - NOTICE: Backing up the" \
- "existing ${NVPM_SYMLINK} to ${nvpm_back}!"
- cp -b -S .bak "${NVPM_SYMLINK}" "${nvpm_back}"
-
- unlink "${NVPM_SYMLINK}"
- ret="$?"
- if [ "${ret}" -ne "0" ]; then
- echo "${SCRIPT_NAME} - Error: Failed" \
- "to unlink ${NVPM_SYMLINK}!"
- else
- rm /var/lib/nvpmodel/status
- fi
- fi
- fi
-
- # create /etc/nvpmodel.conf symlink
- if [ ! -e "${NVPM_SYMLINK}" ]; then
- if [ "${SOCFAMILY}" = "tegra194" ]; then
- if [ "${machine}" = "e3900" ]; then
- if [ -d "/sys/devices/gpu.0" ] &&
- [ -d "/sys/devices/17000000.gv11b" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_t194_e3900_iGPU.conf"
- else
- conf_file="/etc/nvpmodel/nvpmodel_t194_e3900_dGPU.conf"
- fi
- elif [ "${machine}" = "p2972-0006" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_t194_8gb.conf"
- elif [ "${machine}" = "p3668" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_t194_p3668.conf"
- elif [ "${machine}" = "p3668-emul" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_t194_p3668_emul.conf"
- elif [ "${machine}" = "jetson-xavier-industrial" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_t194_agxi.conf"
- else
- conf_file="/etc/nvpmodel/nvpmodel_t194.conf"
- fi
- elif [ "${SOCFAMILY}" = "tegra234" ]; then
- if [ "${machine}" = "p3701-0000-as-p3767-0000" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0000.conf"
- elif [ "${machine}" = "p3701-0000-as-p3767-0001" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0001.conf"
- elif [ "${machine}" = "p3701-0000-as-p3767-0003" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0003.conf"
- elif [ "${machine}" = "p3701-0000-as-p3767-0004" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0004.conf"
- elif [ "${machine}" = "p3701-0000-as-pxxxx" ] || \
- [ "${machine}" = "e2421-1099-as-pxxxx" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_pxxxx.conf"
- elif [ "${machine}" = "p3701-0002" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3701_0002.conf"
- elif [ "${machine}" = "p3701-0000-as-p3701-0004" ] || \
- [ "${machine}" = "p3701-0004" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3701_0004.conf"
- elif [ "${machine}" = "p3701-0008-safety" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_igx_orin_safety.conf"
- elif [ "${machine}" = "p3701-0008" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3701_0008.conf"
- if [ "${cvb}" = "p3740-0002-c01" ] || \
- [ "${cvb}" = "p3971" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_igx_orin.conf"
- fi
- elif [ "${machine}" = "p3767-0000" ] || \
- [ "${machine}" = "p3767-0002" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0000.conf"
- elif [ "${machine}" = "p3767-0000-super" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0000_super.conf"
- elif [ "${machine}" = "p3767-0000-px1" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0000_px1.conf"
- elif [ "${machine}" = "p3767-0000-as-p3767-0001" ] || \
- [ "${machine}" = "p3767-0001" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0001.conf"
- elif [ "${machine}" = "p3767-0001-super" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0001_super.conf"
- elif [ "${machine}" = "p3767-0003" ] || \
- [ "${machine}" = "p3767-0005" ] || \
- [ "${machine}" = "p3767-0000-as-p3767-0003" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0003.conf"
- elif [ "${machine}" = "p3767-0003-super" ] || \
- [ "${machine}" = "p3767-0005-super" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0003_super.conf"
- elif [ "${machine}" = "p3767-0004" ] || \
- [ "${machine}" = "p3767-0000-as-p3767-0004" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0004.conf"
- elif [ "${machine}" = "p3767-0004-super" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_p3767_0004_super.conf"
- else
- conf_file="/etc/nvpmodel/nvpmodel_p3701_0000.conf"
- fi
- elif [ "${SOCFAMILY}" = "tegra239" ]; then
- if [ "${machine}" = "e2423" ]; then
- conf_file="/etc/nvpmodel/nvpmodel_e2423.conf"
- fi
- fi
-
- if [ "${conf_file}" != "" ]; then
- if [ -e "${conf_file}" ]; then
- ln -sf "${conf_file}" "${NVPM_SYMLINK}"
- else
- echo "${SCRIPT_NAME} - WARNING: file ${conf_file} not found!"
- fi
- fi
- fi
-}
-
-function create_nvfancontrol_symlink()
-{
- conf_file=""
- if [ ! -e "/etc/nvfancontrol.conf" ]; then
- if [ "${SOCFAMILY}" = "tegra194" ]; then
- if [ "${machine}" = "e3900" ]; then
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_e3900.conf"
- elif [ "${machine}" = "p3668" ]; then
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p3668.conf"
- else
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p2888.conf"
- fi
- fi
-
- if [ "${SOCFAMILY}" = "tegra234" ]; then
- if [[ "${machine}" =~ "p3701" ]]; then
- # Use p3701_0000 as default fan settings for p3701 series
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p3701_0000.conf"
- if [[ "${machine}" =~ "p3701-0008" ]]; then
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p3701_0008.conf"
- fi
- elif [[ "${machine}" =~ "p3767" ]]; then
- # All p3767 series share the same fan settings
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p3767_0000.conf"
- else
- # Use p3701_0000 as default fan settings for other tegra234 platforms
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p3701_0000.conf"
- fi
-
- if [ "${cvb}" = "p3711-0000" ]; then
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p3711_0000.conf"
- elif [ "${cvb}" = "p3740-0002-b01" ]; then
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p3740_0002_b01.conf"
- elif [ "${cvb}" = "p3740-0002-c01" ]; then
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_p3740_0002_c01.conf"
- fi
- fi
-
- if [ "${SOCFAMILY}" = "tegra239" ]; then
- if [ "${machine}" = "e2423" ]; then
- conf_file="/etc/nvpower/nvfancontrol/nvfancontrol_e2423.conf"
- fi
- fi
-
- if [ "${conf_file}" != "" ]; then
- if [ -e "${conf_file}" ]; then
- ln -sf "${conf_file}" /etc/nvfancontrol.conf
- else
- echo "${SCRIPT_NAME} - WARNING: file ${conf_file} not found!"
- fi
- fi
- fi
-}
-
# CPU hotplug helper function that turns on/off the CPU cores in the specified range
# * Parameters:
# * ${1}: desired online status (0 for offline, 1 for online)
@@ -686,10 +521,12 @@ function setup_actmon()
debugfs_actmon="/sys/kernel/debug/tegra-host1x/actmon"
# Actmon settings should be the same across engines
- tee ${debugfs_actmon}/*/sample_period 1>/dev/null <<< 1500
- tee ${debugfs_actmon}/*/module0/consec_upper_num 1>/dev/null <<< 7
- tee ${debugfs_actmon}/*/module0/consec_lower_num 1>/dev/null <<< 7
- tee ${debugfs_actmon}/*/module0/k 1>/dev/null <<< 2
+ for engine in ${debugfs_actmon}/*; do
+ echo 1500 > $engine/sample_period
+ echo 7 > $engine/module0/consec_upper_num
+ echo 7 > $engine/module0/consec_lower_num
+ echo 2 > $engine/module0/k
+ done
}
SOCFAMILY=""
@@ -697,8 +534,6 @@ SOCFAMILY=""
set_socfamily
set_safety_flag
set_power_state_perm
-create_nvpmodel_symlink
-create_nvfancontrol_symlink
cpu_hotplug
set_cpufreq_governor
set_cpu_floor_freq
@@ -707,3 +542,4 @@ lock_se_frequency
validate_nvpmodel_conf
setup_hwmon
setup_actmon
+exit 0
--
2.34.1