[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 12/21] vfio/platform: Allow the selection of a given iommu bac
|
From: |
Zhenzhong Duan |
|
Subject: |
[PATCH v6 12/21] vfio/platform: Allow the selection of a given iommu backend |
|
Date: |
Tue, 14 Nov 2023 18:09:46 +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>
---
v6: Move #include "sysemu/iommufd.h" in platform.c
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
- Re: [PATCH v6 09/21] vfio/iommufd: Enable pci hot reset through iommufd cdev interface, (continued)
- [PATCH v6 10/21] vfio/pci: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/14
- [PATCH v6 11/21] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/14
- Re: [PATCH v6 11/21] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/11/14
- Re: [PATCH v6 11/21] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Philippe Mathieu-Daudé, 2023/11/15
- Re: [PATCH v6 11/21] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/11/15
- RE: [PATCH v6 11/21] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Duan, Zhenzhong, 2023/11/15
- Re: [PATCH v6 11/21] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/11/16
- RE: [PATCH v6 11/21] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Duan, Zhenzhong, 2023/11/16
[PATCH v6 12/21] vfio/platform: Allow the selection of a given iommu backend,
Zhenzhong Duan <=
[PATCH v6 13/21] vfio/platform: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/14
[PATCH v6 14/21] vfio/ap: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/14
[PATCH v6 15/21] vfio/ap: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/14
[PATCH v6 16/21] vfio/ccw: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/14