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.
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-26 05:24:04 +02:00
parent 8694931665
commit 4514500ee6
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -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"