[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 16/27] vfio/ccw: Allow the selection of a given iommu backend
|
From: |
Zhenzhong Duan |
|
Subject: |
[PATCH v7 16/27] vfio/ccw: Allow the selection of a given iommu backend |
|
Date: |
Tue, 21 Nov 2023 16:44:15 +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-ccw device:
If the user wants to use the legacy backend, it shall not
link the vfio-ccw device with any iommufd object:
-device vfio-ccw,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-ccw device options:
-object iommufd,id=iommufd0
-device vfio-ccw,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>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
---
hw/vfio/ccw.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index d857bb8d0f..d2d58bb677 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -15,12 +15,14 @@
*/
#include "qemu/osdep.h"
+#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
#include <linux/vfio.h>
#include <linux/vfio_ccw.h>
#include <sys/ioctl.h>
#include "qapi/error.h"
#include "hw/vfio/vfio-common.h"
+#include "sysemu/iommufd.h"
#include "hw/s390x/s390-ccw.h"
#include "hw/s390x/vfio-ccw.h"
#include "hw/qdev-properties.h"
@@ -677,6 +679,10 @@ static void vfio_ccw_unrealize(DeviceState *dev)
static Property vfio_ccw_properties[] = {
DEFINE_PROP_STRING("sysfsdev", VFIOCCWDevice, vdev.sysfsdev),
DEFINE_PROP_BOOL("force-orb-pfch", VFIOCCWDevice, force_orb_pfch, false),
+#ifdef CONFIG_IOMMUFD
+ DEFINE_PROP_LINK("iommufd", VFIOCCWDevice, vdev.iommufd,
+ TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
+#endif
DEFINE_PROP_END_OF_LIST(),
};
--
2.34.1
- [PATCH v7 06/27] vfio/iommufd: Add support for iova_ranges and pgsizes, (continued)
- [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, 2023/11/21
- [PATCH v7 16/27] vfio/ccw: Allow the selection of a given iommu backend,
Zhenzhong Duan <=
- [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
- [PATCH v7 27/27] docs/devel: Add VFIO iommufd backend documentation, Zhenzhong Duan, 2023/11/21