On Thu, Mar 19, 2026 at 17:36:51 +0100, Pavel Hrdina via Devel wrote:
> From: Pavel Hrdina <[email protected]>
> 
> This function is used to figure out if VM needs access to /dev/vfio/vfio.
> In case of PCI host devices that is true only if IOMMUFD is not enabled.
> 
> This fixes error when hotplugging PCI host device with IOMMUFD disabled
> to a VM that already has PCI host device with IOMMIFD enabled:
> 
>     Could not open '/dev/vfio/vfio': No such file or directory
> 
> The function is used in this case to check if /dev/vfio/vfio was already
> made available to QEMU or not.
> 
> Signed-off-by: Pavel Hrdina <[email protected]>
> ---
>  src/conf/domain_conf.c   | 14 ++++++++++++++
>  src/conf/domain_conf.h   |  3 +++
>  src/libvirt_private.syms |  1 +
>  src/qemu/qemu_domain.c   |  2 +-
>  4 files changed, 19 insertions(+), 1 deletion(-)

[...]

> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 4520c3c28d..1d00ff2845 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -9284,7 +9284,7 @@ qemuDomainSupportsVideoVga(const virDomainVideoDef 
> *video,

This function really now needs a comment stating why/what and the
quirks.

>  bool
>  qemuDomainNeedsVFIO(const virDomainDef *def)
>  {
> -    return virDomainDefHasPCIHostdev(def) ||
> +    return virDomainDefHasPCIHostdevWithoutIOMMUFD(def) ||
>          virDomainDefHasMdevHostdev(def) ||
>          virDomainDefHasNVMeDisk(def);
>  }


Reviewed-by: Peter Krempa <[email protected]>

Reply via email to