[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 13/20] vfio/ap: Allow the selection of a given iommu backend
|
From: |
Zhenzhong Duan |
|
Subject: |
[PATCH v5 13/20] vfio/ap: Allow the selection of a given iommu backend |
|
Date: |
Thu, 9 Nov 2023 19:45:22 +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-ap device:
if the user wants to use the legacy backend, it shall not
link the vfio-ap device with any iommufd object:
-device vfio-ap,sysfsdev=/sys/bus/mdev/devices/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-ap device options:
-object iommufd,id=iommufd0
-device vfio-ap,sysfsdev=/sys/bus/mdev/devices/XXX,iommufd=iommufd0
Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
hw/vfio/ap.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index bbf69ff55a..80629609ae 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -11,10 +11,12 @@
*/
#include "qemu/osdep.h"
+#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
#include <linux/vfio.h>
#include <sys/ioctl.h>
#include "qapi/error.h"
#include "hw/vfio/vfio-common.h"
+#include "sysemu/iommufd.h"
#include "hw/s390x/ap-device.h"
#include "qemu/error-report.h"
#include "qemu/event_notifier.h"
@@ -204,6 +206,10 @@ static void vfio_ap_unrealize(DeviceState *dev)
static Property vfio_ap_properties[] = {
DEFINE_PROP_STRING("sysfsdev", VFIOAPDevice, vdev.sysfsdev),
+#ifdef CONFIG_IOMMUFD
+ DEFINE_PROP_LINK("iommufd", VFIOAPDevice, vdev.iommufd,
+ TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
+#endif
DEFINE_PROP_END_OF_LIST(),
};
--
2.34.1
- [PATCH v5 07/20] vfio/pci: Introduce a vfio pci hot reset interface, (continued)
- [PATCH v5 07/20] vfio/pci: Introduce a vfio pci hot reset interface, Zhenzhong Duan, 2023/11/09
- [PATCH v5 08/20] vfio/iommufd: Enable pci hot reset through iommufd cdev interface, Zhenzhong Duan, 2023/11/09
- [PATCH v5 09/20] vfio/pci: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/09
- [PATCH v5 12/20] vfio/platform: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/09
- [PATCH v5 11/20] vfio/platform: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/09
- [PATCH v5 10/20] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/09
- [PATCH v5 14/20] vfio/ap: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/09
- [PATCH v5 13/20] vfio/ap: Allow the selection of a given iommu backend,
Zhenzhong Duan <=
- [PATCH v5 15/20] vfio/ccw: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/09
- [PATCH v5 17/20] vfio: Make VFIOContainerBase poiner parameter const in VFIOIOMMUOps callbacks, Zhenzhong Duan, 2023/11/09
- [PATCH v5 20/20] hw/i386: Activate IOMMUFD for q35 machines, Zhenzhong Duan, 2023/11/09
- [PATCH v5 19/20] kconfig: Activate IOMMUFD for s390x machines, Zhenzhong Duan, 2023/11/09
- [PATCH v5 16/20] vfio/ccw: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/09