mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu_domain: Separate VFIO code
This piece of code will be re-used later. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> ACKed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
84d11903e1
commit
610858d282
@ -31346,6 +31346,23 @@ virDomainDefHasManagedPR(const virDomainDef *def)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virDomainDefHasVFIOHostdev(const virDomainDef *def)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->nhostdevs; i++) {
|
||||
const virDomainHostdevDef *tmp = def->hostdevs[i];
|
||||
if (tmp->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||
tmp->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||
tmp->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainGraphicsDefHasOpenGL:
|
||||
* @def: domain definition
|
||||
|
@ -3627,6 +3627,9 @@ virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard,
|
||||
bool
|
||||
virDomainDefHasManagedPR(const virDomainDef *def);
|
||||
|
||||
bool
|
||||
virDomainDefHasVFIOHostdev(const virDomainDef *def);
|
||||
|
||||
bool
|
||||
virDomainGraphicsDefHasOpenGL(const virDomainDef *def);
|
||||
|
||||
|
@ -298,6 +298,7 @@ virDomainDefHasMemballoon;
|
||||
virDomainDefHasMemoryHotplug;
|
||||
virDomainDefHasUSB;
|
||||
virDomainDefHasVcpusOffline;
|
||||
virDomainDefHasVFIOHostdev;
|
||||
virDomainDefLifecycleActionAllowed;
|
||||
virDomainDefMaybeAddController;
|
||||
virDomainDefMaybeAddInput;
|
||||
|
@ -12359,7 +12359,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
|
||||
bool includeVFIO = false;
|
||||
char **tmpPaths = NULL;
|
||||
int *tmpPerms = NULL;
|
||||
size_t i, tmpNpaths = 0;
|
||||
size_t tmpNpaths = 0;
|
||||
int perm = 0;
|
||||
|
||||
*npaths = 0;
|
||||
@ -12382,16 +12382,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
|
||||
|
||||
perm = VIR_CGROUP_DEVICE_RW;
|
||||
if (teardown) {
|
||||
size_t nvfios = 0;
|
||||
for (i = 0; i < def->nhostdevs; i++) {
|
||||
virDomainHostdevDefPtr tmp = def->hostdevs[i];
|
||||
if (tmp->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||
tmp->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||
tmp->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO)
|
||||
nvfios++;
|
||||
}
|
||||
|
||||
if (nvfios == 0)
|
||||
if (!virDomainDefHasVFIOHostdev(def))
|
||||
includeVFIO = true;
|
||||
} else {
|
||||
includeVFIO = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user