From 4514500ee6b468f5daf2754c82a0751e17cb4472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 26 May 2017 05:24:04 +0200 Subject: [PATCH] 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. --- vm-systemd/qubes-sysinit.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/vm-systemd/qubes-sysinit.sh b/vm-systemd/qubes-sysinit.sh index 684147c..d9b8aa4 100755 --- a/vm-systemd/qubes-sysinit.sh +++ b/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"