qemu_hostdev: Introduce qemuHostdevNeedsVFIO()

There are two types of host devices that require /dev/vfio/vfio
access:

  1) PCI devices with VFIO backend
  2) Mediated devices

Introduce a simple helper that returns true if passed @hostdev
falls in either of the categories.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Michal Privoznik 2019-09-17 09:33:28 +02:00
parent 0dfc7c6059
commit f988128cc1
2 changed files with 11 additions and 0 deletions

View File

@ -118,6 +118,15 @@ qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
return 0;
}
bool
qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
{
return virHostdevIsVFIODevice(hostdev) ||
virHostdevIsMdevDevice(hostdev);
}
bool
qemuHostdevHostSupportsPassthroughVFIO(void)
{

View File

@ -24,6 +24,8 @@
#include "qemu_conf.h"
#include "domain_conf.h"
bool qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
bool qemuHostdevHostSupportsPassthroughVFIO(void);
int qemuHostdevUpdateActiveMediatedDevices(virQEMUDriverPtr driver,