aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-01-06 00:24:14 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-01-06 00:24:14 +0000
commitf26582aab54ad20f4df76d3d392144fd146600d7 (patch)
tree98421b524605cda3b94ee3fa6c43e5c31122254a
parentd7bdadb9631f1986a8d86cfa304897176c2244a5 (diff)
parent325e3c30991f3cc1f610576fbfabfe7769727679 (diff)
downloadcuttlefish-f26582aab54ad20f4df76d3d392144fd146600d7.tar.gz
Merge "move gpu policy back to genfs_contexts to fix riscv timeout" into main
-rw-r--r--host/libs/vm_manager/vm_manager.h2
-rw-r--r--shared/sepolicy/vendor/file_contexts10
-rw-r--r--shared/sepolicy/vendor/genfs_contexts19
3 files changed, 20 insertions, 11 deletions
diff --git a/host/libs/vm_manager/vm_manager.h b/host/libs/vm_manager/vm_manager.h
index 3dbd9ce39..b3fa4be6c 100644
--- a/host/libs/vm_manager/vm_manager.h
+++ b/host/libs/vm_manager/vm_manager.h
@@ -82,7 +82,7 @@ class VmManager {
// LINT.IfChange(virtio_gpu_pci_address)
static constexpr const int kGpuPciSlotNum = 2;
- // LINT.ThenChange(../../../shared/sepolicy/vendor/file_contexts:virtio_gpu_pci_address)
+ // LINT.ThenChange(../../../shared/sepolicy/vendor/genfs_contexts:virtio_gpu_pci_address)
virtual ~VmManager() = default;
diff --git a/shared/sepolicy/vendor/file_contexts b/shared/sepolicy/vendor/file_contexts
index 08e91ab93..2f3a4857c 100644
--- a/shared/sepolicy/vendor/file_contexts
+++ b/shared/sepolicy/vendor/file_contexts
@@ -74,16 +74,6 @@
# qemu (riscv64)
/sys/devices/platform/soc/30000000.pci/pci0000:00/0000:00:[0-9a-fA-F]{2}.0/virtio[0-9]+/(block|ndbus[0-9]+)(/.*)? u:object_r:sysfs_devices_block:s0
-# virtio-gpu
-# VMM is configured to always assign the GPU to PCI address 00:02.0 (if present).
-# LINT.IfChange(virtio_gpu_pci_address)
-/sys/devices/(.*/)?pci0000:00/0000:00:02.0/device(/.*)? u:object_r:sysfs_gpu:s0
-/sys/devices/(.*/)?pci0000:00/0000:00:02.0/subsystem_device(/.*)? u:object_r:sysfs_gpu:s0
-/sys/devices/(.*/)?pci0000:00/0000:00:02.0/subsystem_vendor(/.*)? u:object_r:sysfs_gpu:s0
-/sys/devices/(.*/)?pci0000:00/0000:00:02.0/uevent(/.*)? u:object_r:sysfs_gpu:s0
-/sys/devices/(.*/)?pci0000:00/0000:00:02.0/vendor(/.*)? u:object_r:sysfs_gpu:s0
-# LINT.ThenChange(../../../host/libs/vm_manager/vm_manager.h:virtio_gpu_pci_address)
-
#############################
# Vendor files
#
diff --git a/shared/sepolicy/vendor/genfs_contexts b/shared/sepolicy/vendor/genfs_contexts
index 8591f0f2a..08350b49e 100644
--- a/shared/sepolicy/vendor/genfs_contexts
+++ b/shared/sepolicy/vendor/genfs_contexts
@@ -1,5 +1,17 @@
dnl Run "m4 genfs_contexts" to test
dnl
+dnl # $1 = pci prefix
+pushdef(`cf_pci_gpu_device', `dnl
+# VMM is configured to always assign the GPU to PCI address 00:02.0 (if present).
+# LINT.IfChange(virtio_gpu_pci_address)
+genfscon sysfs $1/0000:00:0000:00:02.0/device u:object_r:sysfs_gpu:s0
+genfscon sysfs $1/0000:00:0000:00:02.0/subsystem_device u:object_r:sysfs_gpu:s0
+genfscon sysfs $1/0000:00:0000:00:02.0/subsystem_vendor u:object_r:sysfs_gpu:s0
+genfscon sysfs $1/0000:00:0000:00:02.0/uevent u:object_r:sysfs_gpu:s0
+genfscon sysfs $1/0000:00:0000:00:02.0/vendor u:object_r:sysfs_gpu:s0
+# LINT.ThenChange(../../../host/libs/vm_manager/vm_manager.h:virtio_gpu_pci_address)
+dnl')dnl
+dnl
dnl # $1 = rtc prefix
dnl # $2 = rtc number (decimal)
dnl # $3 = rtc wakeup offset (decimal)
@@ -10,6 +22,7 @@ genfscon sysfs $1/rtc/rtc$2/alarmtimer.0.auto/wakeup u:object_r:sysfs_wakeup:s0
dnl')dnl
dnl
# crosvm (x86)
+cf_pci_gpu_device(/devices/pci0000:00)
## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
genfscon sysfs /devices/platform/rtc_cmos/rtc u:object_r:sysfs_rtc:s0
## find /sys/devices/LNXSYSTM:00/* -type d -name 'wakeup[0-9]*'
@@ -28,28 +41,33 @@ genfscon sysfs /devices/virtual/mac80211_hwsim/hwsim0/net u:object_r:sysfs_net:s
genfscon sysfs /devices/virtual/mac80211_hwsim/hwsim1/net u:object_r:sysfs_net:s0
# crosvm (arm64)
+cf_pci_gpu_device(/devices/platform/10000.pci/pci0000:00)
## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
genfscon sysfs /devices/platform/2000.rtc/rtc u:object_r:sysfs_rtc:s0
## find /sys/devices/platform/* -type d -name 'wakeup[0-9]'
## arm64 2000.rtc on crosvm does not currently expose a wakeup node
# qemu (x86)
+#cf_pci_gpu_device(/devices/pci0000:00) - duplicated with crosvm(x86)
## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
genfscon sysfs /devices/pnp0/00:04/rtc u:object_r:sysfs_rtc:s0
## find /sys/devices/platform/* -type d -name 'wakeup[0-9][0-9]'
cf_rtc_wakeup_alarmtimer(/devices/pnp0/00:04, 0, 19)
# qemu (arm64)
+cf_pci_gpu_device(/devices/platform/4010000000.pcie/pci0000:00)
## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
genfscon sysfs /devices/platform/9010000.pl031/rtc u:object_r:sysfs_rtc:s0
## find /sys/devices/platform/* -type d -name 'wakeup[0-9]'
cf_rtc_wakeup_alarmtimer(/devices/platform/9010000.pl031, 0, 0)
# qemu (arm)
+cf_pci_gpu_device(/devices/platform/3f000000.pcie/pci0000:00)
genfscon sysfs /devices/platform/rtc-test.1/wakeup/wakeup2 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/rtc-test.2/wakeup/wakeup3 u:object_r:sysfs_wakeup:s0
# qemu (riscv64)
+cf_pci_gpu_device(/devices/platform/soc/30000000.pci/pci0000:00)
# common on all platforms / vm managers
genfscon sysfs /devices/platform/rtc-test.0/rtc u:object_r:sysfs_rtc:s0
@@ -59,4 +77,5 @@ genfscon sysfs /bus/iio/devices u:object_r:sysfs_iio_devices:s0
cf_rtc_wakeup_alarmtimer(/devices/platform/rtc-test.1, 2, 0)
genfscon sysfs /devices/platform/rtc-test.2/wakeup u:object_r:sysfs_wakeup:s0
dnl
+popdef(`cf_pci_gpu_device')dnl
popdef(`cf_rtc_wakeup_alarmtimer')dnl