From 5ee3dc7af7859e7b8aa34c10c21778101c15e812 Mon Sep 17 00:00:00 2001 From: Yi Liu Date: Tue, 21 Nov 2023 16:44:03 +0800 Subject: vfio/iommufd: Implement the iommufd backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The iommufd backend is implemented based on the new /dev/iommu user API. This backend obviously depends on CONFIG_IOMMUFD. So far, the iommufd backend doesn't support dirty page sync yet. Co-authored-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/vfio/common.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'hw/vfio/common.c') diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 934f4f5446..6569732b7a 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include CONFIG_DEVICES /* CONFIG_IOMMUFD */ #include #ifdef CONFIG_KVM #include @@ -1503,6 +1504,11 @@ int vfio_attach_device(char *name, VFIODevice *vbasedev, { const VFIOIOMMUOps *ops = &vfio_legacy_ops; +#ifdef CONFIG_IOMMUFD + if (vbasedev->iommufd) { + ops = &vfio_iommufd_ops; + } +#endif return ops->attach_device(name, vbasedev, as, errp); } -- cgit 1.4.1