1dnl Run "m4 genfs_contexts" to test
2dnl
3dnl # $1 = pci prefix
4pushdef(`cf_pci_gpu_device', `dnl
5# VMM is configured to always assign the GPU to PCI address 00:02.0 (if present).
6# LINT.IfChange(virtio_gpu_pci_address)
7genfscon sysfs $1/0000:00:02.0/device u:object_r:sysfs_gpu:s0
8genfscon sysfs $1/0000:00:02.0/subsystem_device u:object_r:sysfs_gpu:s0
9genfscon sysfs $1/0000:00:02.0/subsystem_vendor u:object_r:sysfs_gpu:s0
10genfscon sysfs $1/0000:00:02.0/uevent u:object_r:sysfs_gpu:s0
11genfscon sysfs $1/0000:00:02.0/vendor u:object_r:sysfs_gpu:s0
12# LINT.ThenChange(../../../host/libs/vm_manager/vm_manager.h:virtio_gpu_pci_address)
13dnl')dnl
14dnl
15dnl # $1 = rtc prefix
16dnl # $2 = rtc number (decimal)
17dnl # $3 = rtc wakeup offset (decimal)
18pushdef(`cf_rtc_wakeup_alarmtimer', `dnl
19genfscon sysfs $1/wakeup u:object_r:sysfs_wakeup:s0
20genfscon sysfs $1/rtc/rtc$2/wakeup`'eval($3 + 1)`' u:object_r:sysfs_wakeup:s0 # <= 5.5
21genfscon sysfs $1/rtc/rtc$2/alarmtimer.0.auto/wakeup u:object_r:sysfs_wakeup:s0 # >5.5
22dnl')dnl
23dnl
24# crosvm (x86)
25cf_pci_gpu_device(/devices/pci0000:00)
26## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
27genfscon sysfs /devices/platform/rtc_cmos/rtc u:object_r:sysfs_rtc:s0
28## find /sys/devices/LNXSYSTM:00/* -type d -name 'wakeup[0-9]*'
29genfscon sysfs /devices/LNXSYSTM:00/LNXPWRBN:00/wakeup u:object_r:sysfs_wakeup:s0
30genfscon sysfs /devices/LNXSYSTM:00/LNXSLPBN:00/wakeup u:object_r:sysfs_wakeup:s0
31## find /sys/devices/platform/* -type d -name 'wakeup[0-9]*'
32genfscon sysfs /devices/platform/rtc_cmos/rtc/rtc0/wakeup3 u:object_r:sysfs_wakeup:s0
33genfscon sysfs /devices/platform/rtc_cmos/rtc/rtc0/wakeup4 u:object_r:sysfs_wakeup:s0
34cf_rtc_wakeup_alarmtimer(/devices/platform/rtc_cmos, 0, 1)
35## currently disabled
36#genfscon sysfs /devices/LNXSYSTM:00/GFSH0001:00/wakeup u:object_r:sysfs_wakeup:s0
37#genfscon sysfs /devices/platform/GFSH0001:00/power_supply u:object_r:sysfs_batteryinfo:s0
38#genfscon sysfs /devices/platform/GFSH0001:00/power_supply/ac/wakeup3 u:object_r:sysfs_wakeup:s0
39#genfscon sysfs /devices/platform/GFSH0001:00/power_supply/battery/wakeup4 u:object_r:sysfs_wakeup:s0
40genfscon sysfs /devices/virtual/mac80211_hwsim/hwsim0/net u:object_r:sysfs_net:s0
41genfscon sysfs /devices/virtual/mac80211_hwsim/hwsim1/net u:object_r:sysfs_net:s0
42
43# crosvm (arm64)
44cf_pci_gpu_device(/devices/platform/10000.pci/pci0000:00)
45## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
46genfscon sysfs /devices/platform/2000.rtc/rtc u:object_r:sysfs_rtc:s0
47## find /sys/devices/platform/* -type d -name 'wakeup[0-9]'
48## arm64 2000.rtc on crosvm does not currently expose a wakeup node
49
50# qemu (x86)
51#cf_pci_gpu_device(/devices/pci0000:00) - duplicated with crosvm(x86)
52## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
53genfscon sysfs /devices/pnp0/00:04/rtc u:object_r:sysfs_rtc:s0
54## find /sys/devices/platform/* -type d -name 'wakeup[0-9][0-9]'
55cf_rtc_wakeup_alarmtimer(/devices/pnp0/00:04, 0, 19)
56
57# qemu (arm64)
58cf_pci_gpu_device(/devices/platform/4010000000.pcie/pci0000:00)
59## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
60genfscon sysfs /devices/platform/9010000.pl031/rtc u:object_r:sysfs_rtc:s0
61## find /sys/devices/platform/* -type d -name 'wakeup[0-9]'
62cf_rtc_wakeup_alarmtimer(/devices/platform/9010000.pl031, 0, 0)
63
64# qemu (arm)
65cf_pci_gpu_device(/devices/platform/3f000000.pcie/pci0000:00)
66genfscon sysfs /devices/platform/rtc-test.1/wakeup/wakeup2 u:object_r:sysfs_wakeup:s0
67genfscon sysfs /devices/platform/rtc-test.2/wakeup/wakeup3 u:object_r:sysfs_wakeup:s0
68
69# qemu (riscv64)
70cf_pci_gpu_device(/devices/platform/soc/30000000.pci/pci0000:00)
71
72# common on all platforms / vm managers
73genfscon sysfs /devices/platform/rtc-test.0/rtc u:object_r:sysfs_rtc:s0
74genfscon sysfs /devices/platform/rtc-test.1/rtc u:object_r:sysfs_rtc:s0
75genfscon sysfs /devices/platform/rtc-test.2/rtc u:object_r:sysfs_rtc:s0
76genfscon sysfs /bus/iio/devices u:object_r:sysfs_iio_devices:s0
77cf_rtc_wakeup_alarmtimer(/devices/platform/rtc-test.1, 2, 0)
78genfscon sysfs /devices/platform/rtc-test.2/wakeup u:object_r:sysfs_wakeup:s0
79dnl
80popdef(`cf_pci_gpu_device')dnl
81popdef(`cf_rtc_wakeup_alarmtimer')dnl
82