[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 35/47] vfio/ccw: Allow the selection of a given iommu backend
From: |
Cédric Le Goater |
Subject: |
[PULL 35/47] vfio/ccw: Allow the selection of a given iommu backend |
Date: |
Tue, 19 Dec 2023 19:56:31 +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-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>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/ccw.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index
d857bb8d0fe4ff71b3cf635d6da43eccbe593d5f..d2d58bb677cfad38a6965ea6a43783256407207b
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.43.0
- [PULL 25/47] vfio/iommufd: Add support for iova_ranges and pgsizes, (continued)
- [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, 2023/12/19
- [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 <=
- [PULL 38/47] hw/arm: Activate IOMMUFD for virt machines, Cédric Le Goater, 2023/12/19
- [PULL 32/47] vfio/platform: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/12/19
- [PULL 45/47] vfio: Introduce a helper function to initialize VFIODevice, Cédric Le Goater, 2023/12/19
- [PULL 46/47] docs/devel: Add VFIO iommufd backend documentation, Cédric Le Goater, 2023/12/19
- [PULL 42/47] vfio/platform: Move VFIODevice initializations in vfio_platform_instance_init, Cédric Le Goater, 2023/12/19
- [PULL 44/47] vfio/ccw: Move VFIODevice initializations in vfio_ccw_instance_init, Cédric Le Goater, 2023/12/19
- [PULL 39/47] kconfig: Activate IOMMUFD for s390x machines, Cédric Le Goater, 2023/12/19
- [PULL 41/47] vfio/pci: Move VFIODevice initializations in vfio_instance_init, Cédric Le Goater, 2023/12/19
- [PULL 43/47] vfio/ap: Move VFIODevice initializations in vfio_ap_instance_init, Cédric Le Goater, 2023/12/19
- [PULL 47/47] hw/ppc/Kconfig: Imply VFIO_PCI, Cédric Le Goater, 2023/12/19