diff options
| author | Yi Liu <yi.l.liu@intel.com> | 2023-11-21 16:44:03 +0800 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2023-12-19 19:03:38 +0100 |
| commit | 5ee3dc7af7859e7b8aa34c10c21778101c15e812 (patch) | |
| tree | aec5bf93cff00ca176ccb23ec8d0e6224eeb9480 /hw/vfio/common.c | |
| parent | 1eae5b7bd3ddd03b5591e9122b011c6520064a5a (diff) | |
| download | focaccia-qemu-5ee3dc7af7859e7b8aa34c10c21778101c15e812.tar.gz focaccia-qemu-5ee3dc7af7859e7b8aa34c10c21778101c15e812.zip | |
vfio/iommufd: Implement the iommufd backend
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 <eric.auger@redhat.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/common.c')
| -rw-r--r-- | hw/vfio/common.c | 6 |
1 files changed, 6 insertions, 0 deletions
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 <sys/ioctl.h> #ifdef CONFIG_KVM #include <linux/kvm.h> @@ -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); } |