sm6375-common: Drop power init script

* Switch back to old init script for power stuffs.
* Bring back post boot script.

Change-Id: Ifca0be0f7bb767dfeb601083e66e73c88521f880
This commit is contained in:
Anand S 2024-07-20 20:16:00 +05:30
parent 1f580a9b66
commit 74fce3f5d0
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61
5 changed files with 6543 additions and 143 deletions

View file

@ -110,3 +110,131 @@ function configure_memory_parameters() {
#Spawn 2 kswapd threads which can help in fast reclaiming of pages
echo 2 > /proc/sys/vm/kswapd_threads
}
# Core control parameters for silver
echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
# Enable Core control for Silver
echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/enable
# Disable Core control on gold
echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
# Setting b.L scheduler parameters
echo 65 > /proc/sys/kernel/sched_downmigrate
echo 71 > /proc/sys/kernel/sched_upmigrate
echo 85 > /proc/sys/kernel/sched_group_downmigrate
echo 100 > /proc/sys/kernel/sched_group_upmigrate
echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
echo 0 > /proc/sys/kernel/sched_coloc_busy_hysteresis_enable_cpus
echo 0 > /proc/sys/kernel/sched_busy_hysteresis_enable_cpus
echo 5 > /proc/sys/kernel/sched_ravg_window_nr_ticks
# disable unfiltering
echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period
# cpuset parameters
echo 0-5 > /dev/cpuset/background/cpus
echo 0-5 > /dev/cpuset/system-background/cpus
# Turn off scheduler boost at the end
echo 0 > /proc/sys/kernel/sched_boost
# configure governor settings for silver cluster
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
echo 1113600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
# configure governor settings for gold cluster
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/down_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/up_rate_limit_us
echo 1228800 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq
echo 691200 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq
# Colocation V3 settings
echo 680000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq
echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost
echo 35 > /proc/sys/kernel/sched_min_task_util_for_colocation
# sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
echo 85 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_load
# configure input boost settings
echo "0:1113600" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
# Enable bus-dcvs
for device in /sys/devices/platform/soc
do
for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
do
cat $cpubw/available_frequencies | cut -d " " -f 1 > $cpubw/min_freq
echo "bw_hwmon" > $cpubw/governor
echo "762 1144 1720 2086 2597 2929 3879 5161 5931 6881 7980" > $cpubw/bw_hwmon/mbps_zones
echo 4 > $cpubw/bw_hwmon/sample_ms
echo 68 > $cpubw/bw_hwmon/io_percent
echo 20 > $cpubw/bw_hwmon/hist_memory
echo 0 > $cpubw/bw_hwmon/hyst_length
echo 80 > $cpubw/bw_hwmon/down_thres
echo 0 > $cpubw/bw_hwmon/guard_band_mbps
echo 250 > $cpubw/bw_hwmon/up_scale
echo 1600 > $cpubw/bw_hwmon/idle_mbps
echo 40 > $cpubw/polling_interval
done
# configure compute settings for silver latfloor
for latfloor in $device/*cpu0-cpu*latfloor/devfreq/*cpu0-cpu*latfloor
do
cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq
echo 8 > $latfloor/polling_interval
done
# configure compute settings for gold latfloor
for latfloor in $device/*cpu6-cpu*latfloor/devfreq/*cpu6-cpu*latfloor
do
cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq
echo 8 > $latfloor/polling_interval
done
# configure mem_latency settings for DDR scaling
for memlat in $device/*lat/devfreq/*lat
do
cat $memlat/available_frequencies | cut -d " " -f 1 > $memlat/min_freq
echo 8 > $memlat/polling_interval
echo 400 > $memlat/mem_latency/ratio_ceil
done
#Gold CPU6 L3 ratio ceil
for l3gold in $device/*cpu6-cpu-l3-lat/devfreq/*cpu6-cpu-l3-lat
do
echo 4000 > $l3gold/mem_latency/ratio_ceil
echo 25000 > $l3gold/mem_latency/wb_filter_ratio
echo 60 > $l3gold/mem_latency/wb_pct_thres
done
#Gold CPU7 L3 ratio ceil
for l3gold in $device/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat
do
echo 4000 > $l3gold/mem_latency/ratio_ceil
echo 25000 > $l3gold/mem_latency/wb_filter_ratio
echo 60 > $l3gold/mem_latency/wb_pct_thres
done
done
echo N > /sys/module/lpm_levels/parameters/sleep_disabled
configure_memory_parameters
setprop vendor.post_boot.parsed 1

View file

@ -110,3 +110,131 @@ function configure_memory_parameters() {
#Spawn 2 kswapd threads which can help in fast reclaiming of pages
echo 2 > /proc/sys/vm/kswapd_threads
}
# Core control parameters for silver
echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
# Enable Core control for Silver
echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/enable
# Disable Core control on gold
echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
# Setting b.L scheduler parameters
echo 65 > /proc/sys/kernel/sched_downmigrate
echo 71 > /proc/sys/kernel/sched_upmigrate
echo 85 > /proc/sys/kernel/sched_group_downmigrate
echo 100 > /proc/sys/kernel/sched_group_upmigrate
echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
echo 0 > /proc/sys/kernel/sched_coloc_busy_hysteresis_enable_cpus
echo 0 > /proc/sys/kernel/sched_busy_hysteresis_enable_cpus
echo 5 > /proc/sys/kernel/sched_ravg_window_nr_ticks
# disable unfiltering
echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period
# cpuset parameters
echo 0-3 > /dev/cpuset/background/cpus
echo 0-5 > /dev/cpuset/system-background/cpus
# Turn off scheduler boost at the end
echo 0 > /proc/sys/kernel/sched_boost
# configure governor settings for silver cluster
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
echo 1190400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
# configure governor settings for gold cluster
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/down_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/up_rate_limit_us
echo 1248000 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq
echo 768000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq
# Colocation V3 settings
echo 680000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq
echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost
echo 35 > /proc/sys/kernel/sched_min_task_util_for_colocation
# sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
echo 85 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_load
# configure input boost settings
echo "0:1190400" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
# Enable bus-dcvs
for device in /sys/devices/platform/soc
do
for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
do
cat $cpubw/available_frequencies | cut -d " " -f 1 > $cpubw/min_freq
echo "bw_hwmon" > $cpubw/governor
echo "1144 1720 2086 2929 3879 5931 6881 8137" > $cpubw/bw_hwmon/mbps_zones
echo 4 > $cpubw/bw_hwmon/sample_ms
echo 68 > $cpubw/bw_hwmon/io_percent
echo 20 > $cpubw/bw_hwmon/hist_memory
echo 0 > $cpubw/bw_hwmon/hyst_length
echo 80 > $cpubw/bw_hwmon/down_thres
echo 0 > $cpubw/bw_hwmon/guard_band_mbps
echo 250 > $cpubw/bw_hwmon/up_scale
echo 1600 > $cpubw/bw_hwmon/idle_mbps
echo 40 > $cpubw/polling_interval
done
# configure compute settings for silver latfloor
for latfloor in $device/*cpu0-cpu*latfloor/devfreq/*cpu0-cpu*latfloor
do
cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq
echo 8 > $latfloor/polling_interval
done
# configure compute settings for gold latfloor
for latfloor in $device/*cpu6-cpu*latfloor/devfreq/*cpu6-cpu*latfloor
do
cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq
echo 8 > $latfloor/polling_interval
done
# configure mem_latency settings for DDR scaling
for memlat in $device/*lat/devfreq/*lat
do
cat $memlat/available_frequencies | cut -d " " -f 1 > $memlat/min_freq
echo 8 > $memlat/polling_interval
echo 400 > $memlat/mem_latency/ratio_ceil
done
#Gold CPU6 L3 ratio ceil
for l3gold in $device/*cpu6-cpu-l3-lat/devfreq/*cpu6-cpu-l3-lat
do
echo 4000 > $l3gold/mem_latency/ratio_ceil
echo 25000 > $l3gold/mem_latency/wb_filter_ratio
echo 60 > $l3gold/mem_latency/wb_pct_thres
done
#Gold CPU7 L3 ratio ceil
for l3gold in $device/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat
do
echo 4000 > $l3gold/mem_latency/ratio_ceil
echo 25000 > $l3gold/mem_latency/wb_filter_ratio
echo 60 > $l3gold/mem_latency/wb_pct_thres
done
done
echo N > /sys/module/lpm_levels/parameters/sleep_disabled
configure_memory_parameters
setprop vendor.post_boot.parsed 1

File diff suppressed because it is too large Load diff

View file

@ -1,142 +0,0 @@
# Copyright (c) 2016, Code Aurora Forum. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Code Aurora nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
on init
# Disable UFS powersaving
write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 0
write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 0
# Disable powersaving
write /sys/module/lpm_levels/parameters/sleep_disabled 1
# Bring all cores online
write /sys/devices/system/cpu/cpu0/online 1
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu2/online 1
write /sys/devices/system/cpu/cpu3/online 1
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu5/online 1
write /sys/devices/system/cpu/cpu6/online 1
write /sys/devices/system/cpu/cpu7/online 1
# Configure governor settings for little cluster
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us 20000
# Configure governor settings for big cluster
write /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us 20000
on boot
# For cpusets initialize for Silver only first and then Silver + Gold
# Silver only configuration cannot work with 0-7
write /dev/cpuset/top-app/cpus 0-3
write /dev/cpuset/audio-app/cpus 1-2
write /dev/cpuset/foreground/cpus 0-3
write /dev/cpuset/foreground/boost/cpus 0-3
write /dev/cpuset/background/cpus 0-3
write /dev/cpuset/system-background/cpus 0-3
write /dev/cpuset/top-app/cpus 0-7
write /dev/cpuset/foreground/cpus 0-7
write /dev/cpuset/foreground/boost/cpus 0-7
write /dev/cpuset/background/cpus 0-7
write /dev/cpuset/system-background/cpus 0-7
# Disable console_suspend to get better logging for kernel crashes
write /sys/module/printk/parameters/console_suspend N
on property:init.svc.vendor.charger=running
setprop persist.sys.usb.config mass_storage
# Keep one LITTLE and one big
write /sys/devices/system/cpu/cpu1/online 0
write /sys/devices/system/cpu/cpu2/online 0
write /sys/devices/system/cpu/cpu3/online 0
write /sys/devices/system/cpu/cpu5/online 0
write /sys/devices/system/cpu/cpu6/online 0
write /sys/devices/system/cpu/cpu7/online 0
wait /dev/block/bootdevice
# Enable UFS powersaving
write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 1
write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
# Turn on sleep modes
write /sys/module/lpm_levels/parameters/sleep_disabled 0
start vendor.power_off_alarm
mount tmpfs tmpfs /data
setprop sys.usb.controller 4e00000.dwc3
setprop sys.usb.configfs 1
on enable-low-power
# Set the default IRQ affinity to the silver cluster.
# When a CPU is isolated/hotplugged, the IRQ affinity is adjusted
# to one of the CPU from the default IRQ affinity mask.
write /proc/irq/default_smp_affinity "f"
# Setting b.L scheduler parameters
write /proc/sys/kernel/sched_upmigrate 95
write /proc/sys/kernel/sched_downmigrate 85
write /proc/sys/kernel/sched_group_upmigrate 100
write /proc/sys/kernel/sched_group_downmigrate 95
write /proc/sys/kernel/sched_walt_rotate_big_tasks 1
# Set cpuset parameters
write /dev/cpuset/background/cpus 0-1
write /dev/cpuset/system-background/cpus 0-3
write /dev/cpuset/foreground/boost/cpus 0-3,6-7
write /dev/cpuset/foreground/cpus 0-3,6-7
write /dev/cpuset/top-app/cpus 0-7
write /dev/cpuset/restricted/cpus 0-3
# Setup final cpu.uclamp
write /dev/cpuctl/background/cpu.uclamp.max 50
write /dev/cpuctl/system-background/cpu.uclamp.max 50
write /dev/cpuctl/dex2oat/cpu.uclamp.max 60
# Turn on sleep modes
write /sys/module/lpm_levels/parameters/sleep_disabled 0
# Enable UFS powersaving
write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 1
write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
write /proc/sys/vm/swappiness 100
write /proc/sys/vm/watermark_scale_factor 1
on property:sys.boot_completed=1
trigger enable-low-power
# If UART is on, enable console_suspend on boot_complete to save power
on property:sys.boot_completed=1 && property:init.svc.console=running
write /sys/module/printk/parameters/console_suspend Y
on property:init.svc.recovery=running
trigger enable-low-power

View file

@ -29,7 +29,6 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
import /vendor/etc/init/hw/init.qcom.power.rc
import /vendor/etc/init/hw/init.qcom.usb.rc
import /vendor/etc/init/hw/init.target.rc
@ -548,6 +547,13 @@ service qcom-sh /vendor/bin/init.qcom.sh
group root system radio
oneshot
service qcom-post-boot /vendor/bin/init.qcom.post_boot.sh
class late_start
user root
group root system wakelock graphics
disabled
oneshot
service wifi-sdio-on /vendor/bin/init.qcom.sdio.sh
class late_start
group wifi inet
@ -560,6 +566,9 @@ service wifi-crda /vendor/bin/init.crda.sh
disabled
oneshot
on property:sys.boot_completed=1
start qcom-post-boot
on property:ro.vendor.ril.mbn_copy_completed=1
write /data/vendor/radio/copy_complete 1