Browse Source

Fix detection of PCI passthrough

Do not enable meminfo-writer (and in consequence qmemman) for the VM if
any real PCI device is present. Do not count qemu-emulated devices.
Marek Marczykowski-Górecki 7 years ago
parent
commit
4514500ee6
1 changed files with 19 additions and 2 deletions
  1. 19 2
      vm-systemd/qubes-sysinit.sh

+ 19 - 2
vm-systemd/qubes-sysinit.sh

@@ -10,8 +10,25 @@ DEFAULT_ENABLED_APPVM="cups qubes-update-check"
 DEFAULT_ENABLED_TEMPLATEVM="$DEFAULT_ENABLED_APPVM updates-proxy-setup"
 DEFAULT_ENABLED=""
 
-if [ -z "`ls /sys/bus/pci/devices/`" ]; then
-    # do not enable meminfo-writer (so qmemman for this domain) when any PCI
+# devices emulated by qemu, first list of vendor IDs then list of device IDs:
+qemu_devices="0x8086
+0x8086
+0x8086
+0x8086
+0x8086
+0x5853
+0x1013
+0x1237
+0x7000
+0x7010
+0x7020
+0x7113
+0x0001
+0x00b8
+"
+if [ -z "$(ls /sys/bus/pci/devices/)" -o \
+        "$(cat /sys/bus/pci/devices/*/{vendor,device})" != "$qemu_devices" ]; then
+    # do not enable meminfo-writer (so qmemman for this domain) when any real PCI
     # device is present
     DEFAULT_ENABLED="$DEFAULT_ENABLED meminfo-writer"
     DEFAULT_ENABLED_APPVM="$DEFAULT_ENABLED_APPVM meminfo-writer"