[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 31/47] vfio/platform: Allow the selection of a given iommu backend
From: |
Cédric Le Goater |
Subject: |
[PULL 31/47] vfio/platform: Allow the selection of a given iommu backend |
Date: |
Tue, 19 Dec 2023 19:56:27 +0100 |
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
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>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Cédric Le Goater <clg@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
8e3d4ac45824ec69afb523f8f0e668327122cd02..98ae4bc655b401250bd4cb943e4efec97f486a5f
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.43.0
- [PULL 18/47] vfio/spapr: Move prereg_listener into spapr container, (continued)
- [PULL 18/47] vfio/spapr: Move prereg_listener into spapr container, Cédric Le Goater, 2023/12/19
- [PULL 15/47] vfio/container: Implement attach/detach_device, Cédric Le Goater, 2023/12/19
- [PULL 19/47] vfio/spapr: Move hostwin_list into spapr container, Cédric Le Goater, 2023/12/19
- [PULL 21/47] util/char_dev: Add open_cdev(), Cédric Le Goater, 2023/12/19
- [PULL 20/47] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/12/19
- [PULL 22/47] vfio/common: return early if space isn't empty, Cédric Le Goater, 2023/12/19
- [PULL 24/47] vfio/iommufd: Relax assert check for iommufd backend, Cédric Le Goater, 2023/12/19
- [PULL 23/47] vfio/iommufd: Implement the iommufd backend, Cédric Le Goater, 2023/12/19
- [PULL 26/47] vfio/pci: Extract out a helper vfio_pci_get_pci_hot_reset_info, Cédric Le Goater, 2023/12/19
- [PULL 25/47] vfio/iommufd: Add support for iova_ranges and pgsizes, Cédric Le Goater, 2023/12/19
- [PULL 31/47] vfio/platform: Allow the selection of a given iommu backend,
Cédric Le Goater <=
- [PULL 28/47] vfio/iommufd: Enable pci hot reset through iommufd cdev interface, Cédric Le Goater, 2023/12/19
- [PULL 30/47] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/12/19
- [PULL 33/47] vfio/ap: Allow the selection of a given iommu backend, Cédric Le Goater, 2023/12/19
- [PULL 37/47] vfio: Make VFIOContainerBase poiner parameter const in VFIOIOMMUOps callbacks, Cédric Le Goater, 2023/12/19
- [PULL 36/47] vfio/ccw: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/12/19
- [PULL 27/47] vfio/pci: Introduce a vfio pci hot reset interface, Cédric Le Goater, 2023/12/19
- [PULL 29/47] vfio/pci: Allow the selection of a given iommu backend, Cédric Le Goater, 2023/12/19
- [PULL 34/47] vfio/ap: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/12/19
- [PULL 35/47] vfio/ccw: Allow the selection of a given iommu backend, Cédric Le Goater, 2023/12/19
- [PULL 38/47] hw/arm: Activate IOMMUFD for virt machines, Cédric Le Goater, 2023/12/19