Probable fix for
https://bugzilla.redhat.com/show_bug.cgi?id=1056360
commit f094aaac changed qemuPrepareHostdevPCIDevices() such that it
may modify the "backend" (vfio vs. legacy kvm) setting in the
virHostdevDef. However, qemuDomainAttachHostPciDevice() (used by
hotplug) copies the backend setting into a local *before* calling
qemuPrepareHostdevPCIDevices(), and then later makes a decision based
on that pre-change value.
The result is that, if the backend had been set to "default" (i.e. not
specified in the config) and was later updated to "VFIO" by
qemuPrepareHostdevPCIDevices(), the qemu process' MacMemLock is not
increased (as is required for VFIO device assignment).
This patch delays making the local copy of backend until after its
potential modification.
---
src/qemu/qemu_hotplug.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 4315df2..4a885d2 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1,7 +1,7 @@
/*
* qemu_hotplug.h: QEMU device hotplug management
*
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2014 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -1152,7 +1152,7 @@ qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
bool releaseaddr = false;
bool teardowncgroup = false;
bool teardownlabel = false;
- int backend = hostdev->source.subsys.u.pci.backend;
+ int backend;
unsigned long long memKB;
if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
@@ -1162,6 +1162,9 @@ qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
&hostdev, 1, priv->qemuCaps) < 0)
return -1;
+ /* this could have been changed by qemuPrepareHostdevPCIDevices */
+ backend = hostdev->source.subsys.u.pci.backend;
+
switch ((virDomainHostdevSubsysPciBackendType) backend) {
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
--
1.8.5.3