[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 12/27] vfio/platform: Allow the selection of a given iommu bac
From: |
Zhenzhong Duan |
Subject: |
[PATCH v7 12/27] vfio/platform: Allow the selection of a given iommu backend |
Date: |
Tue, 21 Nov 2023 16:44:11 +0800 |
Now we support two types of iommu backends, let's add the capability
to select one of them. This depends on whether an iommufd object has
been linked with the vfio-platform device:
If the user wants to use the legacy backend, it shall not
link the vfio-platform device with any iommufd object:
-device vfio-platform,host=XXX
This is called the legacy mode/backend.
If the user wants to use the iommufd backend (/dev/iommu) it
shall pass an iommufd object id in the vfio-platform device options:
-object iommufd,id=iommufd0
-device vfio-platform,host=XXX,iommufd=iommufd0
Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
---
hw/vfio/platform.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
index 8e3d4ac458..98ae4bc655 100644
--- a/hw/vfio/platform.c
+++ b/hw/vfio/platform.c
@@ -15,11 +15,13 @@
*/
#include "qemu/osdep.h"
+#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
#include "qapi/error.h"
#include <sys/ioctl.h>
#include <linux/vfio.h>
#include "hw/vfio/vfio-platform.h"
+#include "sysemu/iommufd.h"
#include "migration/vmstate.h"
#include "qemu/error-report.h"
#include "qemu/lockable.h"
@@ -649,6 +651,10 @@ static Property vfio_platform_dev_properties[] = {
DEFINE_PROP_UINT32("mmap-timeout-ms", VFIOPlatformDevice,
mmap_timeout, 1100),
DEFINE_PROP_BOOL("x-irqfd", VFIOPlatformDevice, irqfd_allowed, true),
+#ifdef CONFIG_IOMMUFD
+ DEFINE_PROP_LINK("iommufd", VFIOPlatformDevice, vbasedev.iommufd,
+ TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
+#endif
DEFINE_PROP_END_OF_LIST(),
};
--
2.34.1
- [PATCH v7 05/27] vfio/iommufd: Relax assert check for iommufd backend, (continued)
- [PATCH v7 05/27] vfio/iommufd: Relax assert check for iommufd backend, Zhenzhong Duan, 2023/11/21
- [PATCH v7 06/27] vfio/iommufd: Add support for iova_ranges and pgsizes, Zhenzhong Duan, 2023/11/21
- [PATCH v7 07/27] vfio/pci: Extract out a helper vfio_pci_get_pci_hot_reset_info, Zhenzhong Duan, 2023/11/21
- [PATCH v7 08/27] vfio/pci: Introduce a vfio pci hot reset interface, Zhenzhong Duan, 2023/11/21
- [PATCH v7 09/27] vfio/iommufd: Enable pci hot reset through iommufd cdev interface, Zhenzhong Duan, 2023/11/21
- [PATCH v7 10/27] vfio/pci: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/21
- [PATCH v7 11/27] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/21
- [PATCH v7 13/27] vfio/platform: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/21
- [PATCH v7 14/27] vfio/ap: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/21
- [PATCH v7 15/27] vfio/ap: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/21
- [PATCH v7 12/27] vfio/platform: Allow the selection of a given iommu backend,
Zhenzhong Duan <=
- [PATCH v7 16/27] vfio/ccw: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/21
- [PATCH v7 17/27] vfio/ccw: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/21
- [PATCH v7 19/27] hw/arm: Activate IOMMUFD for virt machines, Zhenzhong Duan, 2023/11/21
- [PATCH v7 18/27] vfio: Make VFIOContainerBase poiner parameter const in VFIOIOMMUOps callbacks, Zhenzhong Duan, 2023/11/21
- [PATCH v7 20/27] kconfig: Activate IOMMUFD for s390x machines, Zhenzhong Duan, 2023/11/21
- [PATCH v7 23/27] vfio/platform: Move VFIODevice initializations in vfio_platform_instance_init, Zhenzhong Duan, 2023/11/21
- [PATCH v7 22/27] vfio/pci: Move VFIODevice initializations in vfio_instance_init, Zhenzhong Duan, 2023/11/21
- [PATCH v7 24/27] vfio/ap: Move VFIODevice initializations in vfio_ap_instance_init, Zhenzhong Duan, 2023/11/21
- [PATCH v7 25/27] vfio/ccw: Move VFIODevice initializations in vfio_ccw_instance_init, Zhenzhong Duan, 2023/11/21
- [PATCH v7 21/27] hw/i386: Activate IOMMUFD for q35 machines, Zhenzhong Duan, 2023/11/21