On Thu, Mar 19, 2026 at 17:36:49 +0100, Pavel Hrdina via Devel wrote:
> From: Pavel Hrdina <[email protected]>
> 
> Function virHostdevNeedsVFIO is used only in QEMU to figure out if the
> host device needs access to /dev/vfio/vfio, for PCI host devices that is
> true only if libvirt is not using IOMMUFD.
> 
> Signed-off-by: Pavel Hrdina <[email protected]>
> ---
>  src/conf/domain_conf.c      | 13 +++++++++++++
>  src/conf/domain_conf.h      |  3 +++
>  src/hypervisor/virhostdev.c |  2 +-
>  src/libvirt_private.syms    |  1 +
>  4 files changed, 18 insertions(+), 1 deletion(-)

[...]

> diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
> index 19907c76ba..0d5e582c08 100644
> --- a/src/hypervisor/virhostdev.c
> +++ b/src/hypervisor/virhostdev.c
> @@ -2536,7 +2536,7 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager 
> *hostdev_mgr,

While it seems for now obvious what's happening in the function I'd
suggest adding a comment about why the function, if the device uses
iommufd, returns false here.

>  bool
>  virHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
>  {
> -    return virHostdevIsPCIDevice(hostdev) ||
> +    return virHostdevIsPCIDeviceWithoutIOMMUFD(hostdev) ||
>          virHostdevIsMdevDevice(hostdev);
>  }

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

Reply via email to