1#
2# Copyright (C) 2019 The Android Open-Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17#
18# This file inherits from init.${ro.boot.hardware.platform}.rc plus additional
19# configs only used by XR targets.
20#
21import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.common.rc
22
23on init
24    # Temporarily stop booting into VR directly due to battery drain.
25    # TODO(b/131327495): Re-enable this once VrHeadsetPowerPolicyService or its
26    #                    equivalent lands in Android master.
27    setprop ro.boot.vr 0
28
29    # Setup cpusets used by the VR services.
30    mkdir /dev/cpuset/kernel 0750 root system
31    write /dev/cpuset/kernel/cpus 0
32    write /dev/cpuset/kernel/mems 0
33    chown system system /dev/cpuset/kernel/tasks
34    chown system system /dev/cpuset/kernel/cpus
35    chmod 0660 /dev/cpuset/kernel/tasks
36    chmod 0660 /dev/cpuset/kernel/cpus
37
38    mkdir /dev/cpuset/system 0750 root system
39    write /dev/cpuset/system/cpus 0
40    write /dev/cpuset/system/mems 0
41    chown system system /dev/cpuset/system/tasks
42    chmod 0660 /dev/cpuset/system/tasks
43
44    mkdir /dev/cpuset/system/performance 0750 root system
45    write /dev/cpuset/system/performance/cpus 0
46    write /dev/cpuset/system/performance/mems 0
47    chown system system /dev/cpuset/system/performance/tasks
48    chmod 0660 /dev/cpuset/system/performance/tasks
49
50    mkdir /dev/cpuset/system/background 0750 root system
51    write /dev/cpuset/system/background/cpus 0
52    write /dev/cpuset/system/background/mems 0
53    chown system system /dev/cpuset/system/background/tasks
54    chmod 0660 /dev/cpuset/system/background/tasks
55
56    mkdir /dev/cpuset/application 0750 root system
57    write /dev/cpuset/application/cpus 0
58    write /dev/cpuset/application/mems 0
59    chown system system /dev/cpuset/application/tasks
60    chmod 0660 /dev/cpuset/application/tasks
61
62    mkdir /dev/cpuset/application/performance 0750 root system
63    write /dev/cpuset/application/performance/cpus 0
64    write /dev/cpuset/application/performance/mems 0
65    chown system system /dev/cpuset/application/performance/tasks
66    chmod 0660 /dev/cpuset/application/performance/tasks
67
68    mkdir /dev/cpuset/application/background 0750 root system
69    write /dev/cpuset/application/background/cpus 0
70    write /dev/cpuset/application/background/mems 0
71    chown system system /dev/cpuset/application/background/tasks
72    chmod 0660 /dev/cpuset/application/background/tasks
73
74    # Create UDS structure for base VR services.
75    mkdir /dev/socket/pdx 0775 system system
76    mkdir /dev/socket/pdx/system 0775 system system
77    mkdir /dev/socket/pdx/system/buffer_hub 0775 system system
78    mkdir /dev/socket/pdx/system/performance 0775 system system
79    mkdir /dev/socket/pdx/system/vr 0775 system system
80    mkdir /dev/socket/pdx/system/vr/display 0775 system system
81    mkdir /dev/socket/pdx/system/vr/pose 0775 system system
82    mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
83
84on boot
85    # Update DVR cpusets to boot-time values.
86    write /dev/cpuset/kernel/cpus 0-7
87    write /dev/cpuset/system/cpus 0-7
88    write /dev/cpuset/system/performance/cpus 0-7
89    write /dev/cpuset/system/background/cpus 0-7
90    write /dev/cpuset/system/cpus 0-7
91    write /dev/cpuset/application/cpus 0-7
92    write /dev/cpuset/application/performance/cpus 0-7
93    write /dev/cpuset/application/background/cpus 0-7
94    write /dev/cpuset/application/cpus 0-7
95
96on property:sys.boot_completed=1
97    # Update DVR cpusets to runtime values.
98    # Kernel cpuset will be apply on PowerHAL
99    write /dev/cpuset/system/performance/cpus 6-7
100    write /dev/cpuset/system/background/cpus 0-1
101    write /dev/cpuset/system/cpus 0-1,6-7
102    write /dev/cpuset/application/performance/cpus 4-5
103    write /dev/cpuset/application/background/cpus 0-1
104    write /dev/cpuset/application/cpus 0-1,4-5
105