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