1on init
2    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold
3    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold
4    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency
5    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/pmu_limit_enable
6    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/lcpi_threshold
7    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold
8    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency
9    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/pmu_limit_enable
10    chown system system /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/lcpi_threshold
11    chown system system /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/spc_threshold
12    chown system system /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/limit_frequency
13    chown system system /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/pmu_limit_enable
14
15    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware
16    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/memlat_cpuidle_state_aware
17    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/memlat_cpuidle_state_aware
18    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/memlat_cpuidle_state_aware
19    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/memlat_cpuidle_state_aware
20    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/memlat_cpuidle_state_aware
21    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/memlat_cpuidle_state_aware
22    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware
23    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/memlat_cpuidle_state_aware
24
25    # Boot time tuning
26    # Set uclamp_min to capacity of little core + 1 to avoid little core
27    write /proc/vendor_sched/groups/ta/uclamp_min 221
28    write /proc/vendor_sched/groups/ta/prefer_idle 1
29    write /proc/vendor_sched/groups/fg/uclamp_min 221
30    write /proc/vendor_sched/groups/fg/prefer_idle 1
31    write /proc/vendor_sched/groups/sys/uclamp_min 221
32    write /proc/vendor_sched/groups/sys/prefer_idle 1
33
34    # governor setting
35    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor sched_pixel
36    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/up_rate_limit_us 500
37    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_us 5000
38    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_scale_pow 2
39    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor sched_pixel
40    write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/up_rate_limit_us 500
41    write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/down_rate_limit_us 20000
42    write /sys/devices/system/cpu/cpu8/cpufreq/scaling_governor sched_pixel
43    write /sys/devices/system/cpu/cpu8/cpufreq/sched_pixel/up_rate_limit_us 500
44    write /sys/devices/system/cpu/cpu8/cpufreq/sched_pixel/down_rate_limit_us 20000
45
46    # memlat cpuidle awareness setting
47    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware 2
48    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/memlat_cpuidle_state_aware 2
49    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/memlat_cpuidle_state_aware 2
50    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/memlat_cpuidle_state_aware 2
51    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/memlat_cpuidle_state_aware 2
52    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/memlat_cpuidle_state_aware 2
53    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/memlat_cpuidle_state_aware 2
54    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware 2
55    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/memlat_cpuidle_state_aware 2
56
57    # change permissions and default values for camera-daemon cpu controller
58    chown system system /dev/cpuctl/camera-daemon/cpu.uclamp.min
59    chown system system /dev/cpuctl/camera-daemon/cpu.uclamp.max
60    chown root root /dev/cpuctl/camera-daemon/cpu.uclamp.latency_sensitive
61    chown system system /dev/cpuctl/camera-daemon/cgroup.procs
62
63    mkdir /dev/cpuset/camera-daemon-high-group
64    write /dev/cpuset/camera-daemon-high-group/cpus 0-8
65    write /dev/cpuset/camera-daemon-high-group/mems 0
66    chown system system /dev/cpuset/camera-daemon-high-group/tasks
67    chmod 0664 /dev/cpuset/camera-daemon-high-group/tasks
68
69    mkdir /dev/cpuset/camera-daemon-mid-group
70    write /dev/cpuset/camera-daemon-mid-group/cpus 0-8
71    write /dev/cpuset/camera-daemon-mid-group/mems 0
72    chown system system /dev/cpuset/camera-daemon-mid-group/tasks
73    chmod 0664 /dev/cpuset/camera-daemon-mid-group/tasks
74
75    mkdir /dev/cpuset/camera-daemon-mid-high-group
76    write /dev/cpuset/camera-daemon-mid-high-group/cpus 0-8
77    write /dev/cpuset/camera-daemon-mid-high-group/mems 0
78    chown system system /dev/cpuset/camera-daemon-mid-high-group/tasks
79    chmod 0664 /dev/cpuset/camera-daemon-mid-high-group/tasks
80
81    # Add memlat governor settings
82    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/polling_interval 10
83    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/polling_interval 10
84    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/polling_interval 10
85    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/polling_interval 10
86    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/polling_interval 10
87    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/polling_interval 10
88    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/polling_interval 10
89    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/polling_interval 10
90    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/polling_interval 10
91    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/mem_latency/ratio_ceil 1800
92    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/mem_latency/ratio_ceil 1800
93    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/mem_latency/ratio_ceil 1800
94    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/mem_latency/ratio_ceil 1800
95    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/mem_latency/ratio_ceil 3700
96    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/mem_latency/ratio_ceil 3700
97    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/mem_latency/ratio_ceil 3700
98    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/mem_latency/ratio_ceil 3700
99    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/mem_latency/ratio_ceil 3400
100    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/mem_latency/stall_floor 3000
101    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/mem_latency/stall_floor 3000
102    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/mem_latency/stall_floor 3000
103    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/mem_latency/stall_floor 3000
104    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/mem_latency/stall_floor 2400
105    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/mem_latency/stall_floor 2400
106    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/mem_latency/stall_floor 2400
107    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/mem_latency/stall_floor 2400
108    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/mem_latency/stall_floor 500
109
110on zygote-start
111    # For PixelLogger configuration file.
112    chmod 0771 /data/vendor/wifi
113    write /proc/vendor_sched/groups/ta/uclamp_min 1
114    write /proc/vendor_sched/groups/fg/uclamp_min 0
115    write /proc/vendor_sched/groups/sys/uclamp_min 0
116    write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0x3f
117    write /proc/vendor_sched/groups/ta/preferred_idle_mask_mid 0x1f0
118    write /proc/vendor_sched/groups/ta/preferred_idle_mask_high 0x1f0
119    write /proc/vendor_sched/groups/ta/prefer_idle 1
120    write /proc/vendor_sched/groups/fg/preferred_idle_mask_low 0x3f
121    write /proc/vendor_sched/groups/fg/preferred_idle_mask_mid 0x1f0
122    write /proc/vendor_sched/groups/fg/preferred_idle_mask_high 0x1f0
123    write /proc/vendor_sched/groups/fg/prefer_idle 1
124    write /proc/vendor_sched/groups/sys/preferred_idle_mask_low 0x3f
125    write /proc/vendor_sched/groups/sys/preferred_idle_mask_mid 0x1f0
126    write /proc/vendor_sched/groups/sys/preferred_idle_mask_high 0x1f0
127    write /proc/vendor_sched/groups/sys/prefer_idle 1
128
129    write /proc/vendor_sched/groups/bg/ug 0
130    write /proc/vendor_sched/groups/sys_bg/ug 0
131    write /proc/vendor_sched/groups/ota/ug 0
132    write /proc/vendor_sched/groups/dex2oat/ug 1
133    write /proc/vendor_sched/groups/ta/ug 2
134    write /proc/vendor_sched/groups/fg/ug 2
135    write /proc/vendor_sched/groups/nnapi/ug 2
136    write /proc/vendor_sched/groups/rt/ug 2
137    write /proc/vendor_sched/groups/sf/ug 2
138    write /proc/vendor_sched/groups/sys/ug 2
139
140on property:init.svc.vendor.charger=running
141    stop keymaster-4-0
142
143    setprop sys.usb.configfs 1
144    setprop vendor.setup.power 1
145
146    # keep one little and one big
147    write /sys/devices/system/cpu/cpu1/online 0
148    write /sys/devices/system/cpu/cpu2/online 0
149    write /sys/devices/system/cpu/cpu3/online 0
150    write /sys/devices/system/cpu/cpu4/online 0
151    write /sys/devices/system/cpu/cpu5/online 0
152    write /sys/devices/system/cpu/cpu6/online 0
153    write /sys/devices/system/cpu/cpu7/online 0
154
155on property:sys.boot_completed=1
156    # Set kswapd affinity
157    write /sys/kernel/vendor_mm/kswapd_cpu_affinity ff
158
159    # Restore prefer idle
160    write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0x1ff
161    write /proc/vendor_sched/groups/ta/preferred_idle_mask_mid 0x1ff
162    write /proc/vendor_sched/groups/ta/preferred_idle_mask_high 0x1ff
163    write /proc/vendor_sched/groups/fg/preferred_idle_mask_low 0x1ff
164    write /proc/vendor_sched/groups/fg/preferred_idle_mask_mid 0x1ff
165    write /proc/vendor_sched/groups/fg/preferred_idle_mask_high 0x1ff
166    write /proc/vendor_sched/groups/sys/preferred_idle_mask_low 0x1ff
167    write /proc/vendor_sched/groups/sys/preferred_idle_mask_mid 0x1ff
168    write /proc/vendor_sched/groups/sys/preferred_idle_mask_high 0x1ff
169
170    # Setup final cpuset
171    write /dev/cpuset/top-app/cpus 0-8
172    write /dev/cpuset/foreground/cpus 0-7
173    write /dev/cpuset/background/cpus 0-3
174    write /dev/cpuset/system-background/cpus 0-3
175    write /dev/cpuset/restricted/cpus 0-3
176    write /dev/cpuset/camera-daemon/cpus 0-8
177    setprop vendor.powerhal.init 1
178
179    # Set PMU freq limit parameters
180    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold 0
181    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold 76
182    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency 1328000
183    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/lcpi_threshold 0
184    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold 73
185    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency 1836000
186    write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/lcpi_threshold 0
187    write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/spc_threshold 68
188    write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/limit_frequency 2363000
189    write /proc/vendor_sched/pmu_poll_time 10
190
191    # Disable PMU freq limit
192    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/pmu_limit_enable 1
193    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/pmu_limit_enable 1
194    write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/pmu_limit_enable 1
195    write /proc/vendor_sched/pmu_poll_enable 0
196
197# MTE
198on property:persist.device_config.runtime_native_boot.mode_override=sync
199    # Per-core mode overrides.
200    # Little Cores: sync
201    write /sys/devices/system/cpu/cpu0/mte_tcf_preferred sync
202    write /sys/devices/system/cpu/cpu1/mte_tcf_preferred sync
203    write /sys/devices/system/cpu/cpu2/mte_tcf_preferred sync
204    write /sys/devices/system/cpu/cpu3/mte_tcf_preferred sync
205    # Mid Cores: sync
206    write /sys/devices/system/cpu/cpu4/mte_tcf_preferred sync
207    write /sys/devices/system/cpu/cpu5/mte_tcf_preferred sync
208    write /sys/devices/system/cpu/cpu6/mte_tcf_preferred sync
209    write /sys/devices/system/cpu/cpu7/mte_tcf_preferred sync
210    # Big Core: sync mode performance is prohibitively bad
211    write /sys/devices/system/cpu/cpu8/mte_tcf_preferred asymm
212
213on property:persist.device_config.runtime_native_boot.mode_override=asymm
214    # Per-core mode overrides.
215    write /sys/devices/system/cpu/cpu0/mte_tcf_preferred asymm
216    write /sys/devices/system/cpu/cpu1/mte_tcf_preferred asymm
217    write /sys/devices/system/cpu/cpu2/mte_tcf_preferred asymm
218    write /sys/devices/system/cpu/cpu3/mte_tcf_preferred asymm
219    write /sys/devices/system/cpu/cpu4/mte_tcf_preferred asymm
220    write /sys/devices/system/cpu/cpu5/mte_tcf_preferred asymm
221    write /sys/devices/system/cpu/cpu6/mte_tcf_preferred asymm
222    write /sys/devices/system/cpu/cpu7/mte_tcf_preferred asymm
223    write /sys/devices/system/cpu/cpu8/mte_tcf_preferred asymm
224