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
This commit is contained in:
Marek Marczykowski-Górecki 2016-06-04 16:52:02 +02:00
parent daf55710b8
commit 88cb62fcf6
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
6 changed files with 25 additions and 1 deletions

View File

@ -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'] = '<xen><e820_host state=\'on\'/></xen>'
args.update(self.storage.get_config_params())
if hasattr(self, 'kernelopts'):
args['kernelopts'] = self.kernelopts

View File

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

View File

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

View File

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

View File

@ -15,6 +15,7 @@
<acpi/>
<apic/>
<viridian/>
{features}
</features>
<clock offset='variable' adjustment='{timeoffset}' basis='{time_basis}'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -10,6 +10,7 @@
<initrd>{kerneldir}/initramfs</initrd>
<cmdline>root=/dev/mapper/dmroot ro nomodeset console=hvc0 rd_NO_PLYMOUTH 3 {kernelopts}</cmdline>
</os>
<features>{features}</features>
<clock offset='utc' adjustment='reset'>
<timer name="tsc" mode="native"/>
</clock>