[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 18/18] vfio/pci: Add an iommufd option
From: |
Yi Liu |
Subject: |
[RFC 18/18] vfio/pci: Add an iommufd option |
Date: |
Thu, 14 Apr 2022 03:47:10 -0700 |
From: Eric Auger <eric.auger@redhat.com>
This auto/on/off option allows the user to force a the select
the iommu BE (iommufd or legacy).
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
hw/vfio/pci.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index cf5703f94b..70a4c2b0a8 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -42,6 +42,8 @@
#include "qapi/error.h"
#include "migration/blocker.h"
#include "migration/qemu-file.h"
+#include "qapi/visitor.h"
+#include "qapi/qapi-visit-common.h"
#define TYPE_VFIO_PCI_NOHOTPLUG "vfio-pci-nohotplug"
@@ -3246,6 +3248,26 @@ static Property vfio_pci_dev_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
+static void get_iommu_be(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ VFIOPCIDevice *vdev = VFIO_PCI(obj);
+ VFIODevice *vbasedev = &vdev->vbasedev;
+ OnOffAuto iommufd_be = vbasedev->iommufd_be;
+
+ visit_type_OnOffAuto(v, name, &iommufd_be, errp);
+}
+
+static void set_iommu_be(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ VFIOPCIDevice *vdev = VFIO_PCI(obj);
+ VFIODevice *vbasedev = &vdev->vbasedev;
+
+ visit_type_OnOffAuto(v, name, &vbasedev->iommufd_be, errp);
+}
+
+
static void vfio_pci_dev_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -3253,6 +3275,10 @@ static void vfio_pci_dev_class_init(ObjectClass *klass,
void *data)
dc->reset = vfio_pci_reset;
device_class_set_props(dc, vfio_pci_dev_properties);
+ object_class_property_add(klass, "iommufd", "OnOffAuto",
+ get_iommu_be, set_iommu_be, NULL, NULL);
+ object_class_property_set_description(klass, "iommufd",
+ "Enable iommufd backend");
dc->desc = "VFIO-based PCI device assignment";
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
pdc->realize = vfio_realize;
--
2.27.0
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, (continued)
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, Jason Gunthorpe, 2022/04/26
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, Yi Liu, 2022/04/26
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, Jason Gunthorpe, 2022/04/26
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, Alex Williamson, 2022/04/26
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, Jason Gunthorpe, 2022/04/26
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, Alex Williamson, 2022/04/26
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, Jason Gunthorpe, 2022/04/26
- Re: [RFC 15/18] vfio/iommufd: Implement iommufd backend, Jason Gunthorpe, 2022/04/26
[RFC 16/18] vfio/iommufd: Add IOAS_COPY_DMA support, Yi Liu, 2022/04/14
[RFC 17/18] vfio/as: Allow the selection of a given iommu backend, Yi Liu, 2022/04/14
[RFC 18/18] vfio/pci: Add an iommufd option,
Yi Liu <=
Re: [RFC 00/18] vfio: Adopt iommufd, Nicolin Chen, 2022/04/15
RE: [RFC 00/18] vfio: Adopt iommufd, Tian, Kevin, 2022/04/18
Re: [RFC 00/18] vfio: Adopt iommufd, Alex Williamson, 2022/04/22