mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
hypervisor: move HostdevNeedsVFIO to hypervisor
Move HostdevNeedsVFIO method to hypervisor to be reused between qemu and ch drivers. Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
0dad1ec009
commit
b05f6134c9
@ -2512,3 +2512,10 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *hostdev_mgr,
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
bool
|
||||
virHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
|
||||
{
|
||||
return virHostdevIsPCIDevice(hostdev) ||
|
||||
virHostdevIsMdevDevice(hostdev);
|
||||
}
|
||||
|
@ -232,3 +232,6 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *hostdev_mgr,
|
||||
const char *dom_name,
|
||||
virDomainDiskDef **disks,
|
||||
size_t ndisks);
|
||||
|
||||
bool
|
||||
virHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
|
||||
|
@ -1674,6 +1674,7 @@ virCloseCallbacksDomainRunForConn;
|
||||
# hypervisor/virhostdev.h
|
||||
virHostdevFindUSBDevice;
|
||||
virHostdevManagerGetDefault;
|
||||
virHostdevNeedsVFIO;
|
||||
virHostdevPCINodeDeviceDetach;
|
||||
virHostdevPCINodeDeviceReAttach;
|
||||
virHostdevPCINodeDeviceReset;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "virfile.h"
|
||||
#include "virdevmapper.h"
|
||||
#include "virglibutil.h"
|
||||
#include "virhostdev.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_QEMU
|
||||
|
||||
@ -481,7 +482,7 @@ qemuSetupHostdevCgroup(virDomainObj *vm,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuHostdevNeedsVFIO(dev) &&
|
||||
if (virHostdevNeedsVFIO(dev) &&
|
||||
qemuCgroupAllowDevicePath(vm, QEMU_DEV_VFIO,
|
||||
VIR_CGROUP_DEVICE_RW, false) < 0) {
|
||||
return -1;
|
||||
@ -530,7 +531,7 @@ qemuTeardownHostdevCgroup(virDomainObj *vm,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuHostdevNeedsVFIO(dev) &&
|
||||
if (virHostdevNeedsVFIO(dev) &&
|
||||
!qemuDomainNeedsVFIO(vm->def) &&
|
||||
qemuCgroupDenyDevicePath(vm, QEMU_DEV_VFIO,
|
||||
VIR_CGROUP_DEVICE_RWM, false) < 0) {
|
||||
|
@ -130,14 +130,6 @@ qemuHostdevUpdateActiveDomainDevices(virQEMUDriver *driver,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
|
||||
{
|
||||
return virHostdevIsPCIDevice(hostdev) ||
|
||||
virHostdevIsMdevDevice(hostdev);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
qemuHostdevHostSupportsPassthroughVFIO(void)
|
||||
{
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
#include "qemu_conf.h"
|
||||
|
||||
bool qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
|
||||
|
||||
bool qemuHostdevHostSupportsPassthroughVFIO(void);
|
||||
|
||||
int qemuHostdevUpdateActiveNVMeDisks(virQEMUDriver *driver,
|
||||
|
@ -339,7 +339,7 @@ qemuDomainSetupHostdev(virDomainObj *vm,
|
||||
if (path)
|
||||
*paths = g_slist_prepend(*paths, g_steal_pointer(&path));
|
||||
|
||||
if (qemuHostdevNeedsVFIO(hostdev) &&
|
||||
if (virHostdevNeedsVFIO(hostdev) &&
|
||||
(!hotplug || !qemuDomainNeedsVFIO(vm->def)))
|
||||
*paths = g_slist_prepend(*paths, g_strdup(QEMU_DEV_VFIO));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user