[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 22/27] vfio/pci: Allow the selection of a given iommu backend
|
From: |
Zhenzhong Duan |
|
Subject: |
[PATCH v2 22/27] vfio/pci: Allow the selection of a given iommu backend |
|
Date: |
Mon, 16 Oct 2023 16:32:18 +0800 |
From: Eric Auger <eric.auger@redhat.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-pci device:
if the user wants to use the legacy backend, it shall not
link the vfio-pci device with any iommufd object:
-device vfio-pci,host=0000:02:00.0
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-pci device options:
-object iommufd,id=iommufd0
-device vfio-pci,host=0000:02:00.0,iommufd=iommufd0
Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
hw/vfio/pci.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 24fc047423..15e1b771b0 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -43,6 +43,7 @@
#include "migration/blocker.h"
#include "migration/qemu-file.h"
#include "linux/iommufd.h"
+#include "sysemu/iommufd.h"
#define TYPE_VFIO_PCI_NOHOTPLUG "vfio-pci-nohotplug"
@@ -3700,6 +3701,10 @@ static Property vfio_pci_dev_properties[] = {
* DEFINE_PROP_STRING("vfiofd", VFIOPCIDevice, vfiofd_name),
* DEFINE_PROP_STRING("vfiogroupfd, VFIOPCIDevice, vfiogroupfd_name),
*/
+#ifdef CONFIG_IOMMUFD
+ DEFINE_PROP_LINK("iommufd", VFIOPCIDevice, vbasedev.iommufd,
+ TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
+#endif
DEFINE_PROP_END_OF_LIST(),
};
--
2.34.1
- [PATCH v2 13/27] vfio/container: Move listener to base container, (continued)
- [PATCH v2 13/27] vfio/container: Move listener to base container, Zhenzhong Duan, 2023/10/16
- [PATCH v2 14/27] vfio/container: Move dirty_pgsizes and max_dirty_bitmap_size to base container, Zhenzhong Duan, 2023/10/16
- [PATCH v2 15/27] vfio/container: Implement attach/detach_device, Zhenzhong Duan, 2023/10/16
- [PATCH v2 16/27] Add iommufd configure option, Zhenzhong Duan, 2023/10/16
- [PATCH v2 17/27] backends/iommufd: Introduce the iommufd object, Zhenzhong Duan, 2023/10/16
- [PATCH v2 18/27] util/char_dev: Add open_cdev(), Zhenzhong Duan, 2023/10/16
- [PATCH v2 19/27] vfio/iommufd: Implement the iommufd backend, Zhenzhong Duan, 2023/10/16
- [PATCH v2 20/27] vfio/container: Bypass EEH if iommufd backend, Zhenzhong Duan, 2023/10/16
- [PATCH v2 21/27] vfio/pci: Adapt vfio pci hot reset support with iommufd BE, Zhenzhong Duan, 2023/10/16
- [PATCH v2 22/27] vfio/pci: Allow the selection of a given iommu backend,
Zhenzhong Duan <=
- [PATCH v2 23/27] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/10/16
- [PATCH v2 25/27] vfio/platform: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/10/16
- [PATCH v2 24/27] vfio: Allow the selection of a given iommu backend for platform ap and ccw, Zhenzhong Duan, 2023/10/16
- [PATCH v2 27/27] vfio/ccw: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/10/16
- [PATCH v2 26/27] vfio/ap: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/10/16