Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
2 people authored and legoater committed Dec 19, 2023
1 parent 1eae5b7 commit 5ee3dc7
Show file tree
Hide file tree
Showing 5 changed files with 452 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/vfio/common.c
Expand Up @@ -19,6 +19,7 @@
*/

#include "qemu/osdep.h"
#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
#include <sys/ioctl.h>
#ifdef CONFIG_KVM
#include <linux/kvm.h>
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 5ee3dc7

Please sign in to comment.