From: Michal Privoznik Date: Tue, 17 Sep 2019 07:33:28 +0000 (+0200) Subject: qemu_hostdev: Introduce qemuHostdevNeedsVFIO() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f988128cc1352b258f6e4ae23e7b901ce2313bd0;p=libvirt.git 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 Reviewed-by: Cole Robinson --- diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index af41c32679..ebbca817b8 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -118,6 +118,15 @@ qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver, return 0; } + +bool +qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev) +{ + return virHostdevIsVFIODevice(hostdev) || + virHostdevIsMdevDevice(hostdev); +} + + bool qemuHostdevHostSupportsPassthroughVFIO(void) { diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index e99c204961..536069fe8a 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -24,6 +24,8 @@ #include "qemu_conf.h" #include "domain_conf.h" +bool qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev); + bool qemuHostdevHostSupportsPassthroughVFIO(void); int qemuHostdevUpdateActiveMediatedDevices(virQEMUDriverPtr driver,