From 88cb62fcf627edceed577d40a1ed1a4e1d2e5e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 4 Jun 2016 16:52:02 +0200 Subject: [PATCH] core: add pci_e820_host property Enable e820_host option for VMs with PCI devices (to allow VM kernel to deal with address space conflicts). But add a property to allow disabling it. Fixes QubesOS/qubes-issues#2019 --- core-modules/000QubesVm.py | 4 ++++ doc/qvm-tools/qvm-prefs.rst | 8 ++++++++ qvm-tools/qvm-prefs | 10 ++++++++++ rpm_spec/core-dom0.spec | 2 +- vm-config/xen-vm-template-hvm.xml | 1 + vm-config/xen-vm-template.xml | 1 + 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 45fd2df1..edf9e7fa 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -136,6 +136,7 @@ class QubesVm(object): eval(value) if value.find("[") >= 0 else eval("[" + value + "]") }, "pci_strictreset": {"default": True}, + "pci_e820_host": {"default": True}, # Internal VM (not shown in qubes-manager, doesn't create appmenus entries "internal": { "default": False, 'attr': '_internal' }, "vcpus": { "default": 2 }, @@ -1191,6 +1192,7 @@ class QubesVm(object): # If dynamic memory management disabled, set maxmem=mem args['maxmem'] = args['mem'] args['vcpus'] = str(self.vcpus) + args['features'] = '' if self.netvm is not None: args['ip'] = self.ip args['mac'] = self.mac @@ -1215,6 +1217,8 @@ class QubesVm(object): args['network_end'] = '-->' args['no_network_begin'] = '' args['no_network_end'] = '' + if len(self.pcidevs) and self.pci_e820_host: + args['features'] = '' args.update(self.storage.get_config_params()) if hasattr(self, 'kernelopts'): args['kernelopts'] = self.kernelopts diff --git a/doc/qvm-tools/qvm-prefs.rst b/doc/qvm-tools/qvm-prefs.rst index 12bef70e..937b6264 100644 --- a/doc/qvm-tools/qvm-prefs.rst +++ b/doc/qvm-tools/qvm-prefs.rst @@ -49,6 +49,14 @@ pci_strictreset cases it could make sense - for example when the VM to which it is assigned is trusted one, or is running all the time. +pci_e820_host + Accepted values: ``True``, ``False`` + + Give VM with PCI devices a memory map (e820) of the host. This is + required for some devices to properly resolve conflicts in address space. + This option is enabled by default for VMs with PCI devices and have no + effect for VMs without devices. + label Accepted values: ``red``, ``orange``, ``yellow``, ``green``, ``gray``, ``blue``, ``purple``, ``black`` diff --git a/qvm-tools/qvm-prefs b/qvm-tools/qvm-prefs index 7e2225a5..a8180754 100755 --- a/qvm-tools/qvm-prefs +++ b/qvm-tools/qvm-prefs @@ -58,6 +58,7 @@ def do_list(vm): print fmt.format ("config", vm.conf_file) print fmt.format ("pcidevs", vm.pcidevs) print fmt.format ("pci_strictreset", vm.pci_strictreset) + print fmt.format ("pci_e820_host", vm.pci_e820_host) if vm.template is None: print fmt.format ("root_img", vm.root_img) if hasattr(vm, "rootcow_img") and vm.rootcow_img is not None: @@ -228,6 +229,14 @@ def set_pci_strictreset(vms, vm, args): vm.pci_strictreset = bool(eval(args[0].capitalize())) return True +def set_pci_e820_host(vms, vm, args): + if len (args) != 1: + print >> sys.stderr, "Missing value (True/False)!" + return False + + vm.pci_e820_host = bool(eval(args[0].capitalize())) + return True + def set_netvm(vms, vm, args): if len (args) != 1: print >> sys.stderr, "Missing netvm name argument!" @@ -485,6 +494,7 @@ properties = { "include_in_backups": set_include_in_backups, "pcidevs": set_pcidevs, "pci_strictreset": set_pci_strictreset, + "pci_e820_host": set_pci_e820_host, "label" : set_label, "netvm" : set_netvm, "dispvm_netvm" : set_dispvm_netvm, diff --git a/rpm_spec/core-dom0.spec b/rpm_spec/core-dom0.spec index 86c531bf..16d5d6c2 100644 --- a/rpm_spec/core-dom0.spec +++ b/rpm_spec/core-dom0.spec @@ -62,7 +62,7 @@ Requires: libvirt-python %if x%{?backend_vmm} == xxen Requires: xen-runtime Requires: xen-hvm -Requires: libvirt-daemon-xen >= 1.2.20-4 +Requires: libvirt-daemon-xen >= 1.2.20-6 %endif Requires: createrepo Requires: gnome-packagekit diff --git a/vm-config/xen-vm-template-hvm.xml b/vm-config/xen-vm-template-hvm.xml index 1b6b5089..728b17c4 100644 --- a/vm-config/xen-vm-template-hvm.xml +++ b/vm-config/xen-vm-template-hvm.xml @@ -15,6 +15,7 @@ + {features} destroy diff --git a/vm-config/xen-vm-template.xml b/vm-config/xen-vm-template.xml index ccb89c93..bbb7ee0a 100644 --- a/vm-config/xen-vm-template.xml +++ b/vm-config/xen-vm-template.xml @@ -10,6 +10,7 @@ {kerneldir}/initramfs root=/dev/mapper/dmroot ro nomodeset console=hvc0 rd_NO_PLYMOUTH 3 {kernelopts} + {features}