mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-10 21:51:31 +00:00
qemu: be sure we're using the updated value of backend during hotplug
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.
This commit is contained in:
parent
e45b07314e
commit
0d0a7bf45a
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user