mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +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;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
virHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
|
||||||
|
{
|
||||||
|
return virHostdevIsPCIDevice(hostdev) ||
|
||||||
|
virHostdevIsMdevDevice(hostdev);
|
||||||
|
}
|
||||||
|
@ -232,3 +232,6 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *hostdev_mgr,
|
|||||||
const char *dom_name,
|
const char *dom_name,
|
||||||
virDomainDiskDef **disks,
|
virDomainDiskDef **disks,
|
||||||
size_t ndisks);
|
size_t ndisks);
|
||||||
|
|
||||||
|
bool
|
||||||
|
virHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
|
||||||
|
@ -1674,6 +1674,7 @@ virCloseCallbacksDomainRunForConn;
|
|||||||
# hypervisor/virhostdev.h
|
# hypervisor/virhostdev.h
|
||||||
virHostdevFindUSBDevice;
|
virHostdevFindUSBDevice;
|
||||||
virHostdevManagerGetDefault;
|
virHostdevManagerGetDefault;
|
||||||
|
virHostdevNeedsVFIO;
|
||||||
virHostdevPCINodeDeviceDetach;
|
virHostdevPCINodeDeviceDetach;
|
||||||
virHostdevPCINodeDeviceReAttach;
|
virHostdevPCINodeDeviceReAttach;
|
||||||
virHostdevPCINodeDeviceReset;
|
virHostdevPCINodeDeviceReset;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "virfile.h"
|
#include "virfile.h"
|
||||||
#include "virdevmapper.h"
|
#include "virdevmapper.h"
|
||||||
#include "virglibutil.h"
|
#include "virglibutil.h"
|
||||||
|
#include "virhostdev.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_QEMU
|
#define VIR_FROM_THIS VIR_FROM_QEMU
|
||||||
|
|
||||||
@ -481,7 +482,7 @@ qemuSetupHostdevCgroup(virDomainObj *vm,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuHostdevNeedsVFIO(dev) &&
|
if (virHostdevNeedsVFIO(dev) &&
|
||||||
qemuCgroupAllowDevicePath(vm, QEMU_DEV_VFIO,
|
qemuCgroupAllowDevicePath(vm, QEMU_DEV_VFIO,
|
||||||
VIR_CGROUP_DEVICE_RW, false) < 0) {
|
VIR_CGROUP_DEVICE_RW, false) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -530,7 +531,7 @@ qemuTeardownHostdevCgroup(virDomainObj *vm,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuHostdevNeedsVFIO(dev) &&
|
if (virHostdevNeedsVFIO(dev) &&
|
||||||
!qemuDomainNeedsVFIO(vm->def) &&
|
!qemuDomainNeedsVFIO(vm->def) &&
|
||||||
qemuCgroupDenyDevicePath(vm, QEMU_DEV_VFIO,
|
qemuCgroupDenyDevicePath(vm, QEMU_DEV_VFIO,
|
||||||
VIR_CGROUP_DEVICE_RWM, false) < 0) {
|
VIR_CGROUP_DEVICE_RWM, false) < 0) {
|
||||||
|
@ -130,14 +130,6 @@ qemuHostdevUpdateActiveDomainDevices(virQEMUDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
|
|
||||||
{
|
|
||||||
return virHostdevIsPCIDevice(hostdev) ||
|
|
||||||
virHostdevIsMdevDevice(hostdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
qemuHostdevHostSupportsPassthroughVFIO(void)
|
qemuHostdevHostSupportsPassthroughVFIO(void)
|
||||||
{
|
{
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
#include "qemu_conf.h"
|
#include "qemu_conf.h"
|
||||||
|
|
||||||
bool qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
|
|
||||||
|
|
||||||
bool qemuHostdevHostSupportsPassthroughVFIO(void);
|
bool qemuHostdevHostSupportsPassthroughVFIO(void);
|
||||||
|
|
||||||
int qemuHostdevUpdateActiveNVMeDisks(virQEMUDriver *driver,
|
int qemuHostdevUpdateActiveNVMeDisks(virQEMUDriver *driver,
|
||||||
|
@ -339,7 +339,7 @@ qemuDomainSetupHostdev(virDomainObj *vm,
|
|||||||
if (path)
|
if (path)
|
||||||
*paths = g_slist_prepend(*paths, g_steal_pointer(&path));
|
*paths = g_slist_prepend(*paths, g_steal_pointer(&path));
|
||||||
|
|
||||||
if (qemuHostdevNeedsVFIO(hostdev) &&
|
if (virHostdevNeedsVFIO(hostdev) &&
|
||||||
(!hotplug || !qemuDomainNeedsVFIO(vm->def)))
|
(!hotplug || !qemuDomainNeedsVFIO(vm->def)))
|
||||||
*paths = g_slist_prepend(*paths, g_strdup(QEMU_DEV_VFIO));
|
*paths = g_slist_prepend(*paths, g_strdup(QEMU_DEV_VFIO));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user