aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorCédric Le Goater <clg@redhat.com>2024-06-17 08:34:03 +0200
committerCédric Le Goater <clg@redhat.com>2024-06-24 23:15:31 +0200
commit504d297e10fdfe1b1243274e334abb0074ee69f4 (patch)
tree8945e18123d6830160957e1afc6b0ff01157c769 /hw
parent9550fdfd29f52d548d99aed2b1a002308ad6175a (diff)
downloadqemu-504d297e10fdfe1b1243274e334abb0074ee69f4.zip
qemu-504d297e10fdfe1b1243274e334abb0074ee69f4.tar.gz
qemu-504d297e10fdfe1b1243274e334abb0074ee69f4.tar.bz2
vfio/container: Change VFIOContainerBase to use QOM
VFIOContainerBase was made a QOM interface because we believed that a QOM object would expose all the IOMMU backends to the QEMU machine and human interface. This only applies to user creatable devices or objects. Change the VFIOContainerBase nature from interface to object and make the necessary adjustments in the VFIO_IOMMU hierarchy. Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vfio/container-base.c4
-rw-r--r--hw/vfio/container.c1
-rw-r--r--hw/vfio/iommufd.c1
-rw-r--r--hw/vfio/spapr.c3
4 files changed, 8 insertions, 1 deletions
diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c
index 280f0dd..98c15e1 100644
--- a/hw/vfio/container-base.c
+++ b/hw/vfio/container-base.c
@@ -102,8 +102,10 @@ void vfio_container_destroy(VFIOContainerBase *bcontainer)
static const TypeInfo types[] = {
{
.name = TYPE_VFIO_IOMMU,
- .parent = TYPE_INTERFACE,
+ .parent = TYPE_OBJECT,
+ .instance_size = sizeof(VFIOContainerBase),
.class_size = sizeof(VFIOIOMMUClass),
+ .abstract = true,
},
};
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 31bdc46..3ae5253 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -1196,6 +1196,7 @@ static const TypeInfo types[] = {
{
.name = TYPE_VFIO_IOMMU_LEGACY,
.parent = TYPE_VFIO_IOMMU,
+ .instance_size = sizeof(VFIOContainer),
.class_init = vfio_iommu_legacy_class_init,
}, {
.name = TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO,
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index e5d9334..3e9d642 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -672,6 +672,7 @@ static const TypeInfo types[] = {
{
.name = TYPE_VFIO_IOMMU_IOMMUFD,
.parent = TYPE_VFIO_IOMMU,
+ .instance_size = sizeof(VFIOIOMMUFDContainer),
.class_init = vfio_iommu_iommufd_class_init,
}, {
.name = TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO,
diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
index 47b040f..018bd20 100644
--- a/hw/vfio/spapr.c
+++ b/hw/vfio/spapr.c
@@ -30,6 +30,8 @@ typedef struct VFIOSpaprContainer {
QLIST_HEAD(, VFIOHostDMAWindow) hostwin_list;
} VFIOSpaprContainer;
+OBJECT_DECLARE_SIMPLE_TYPE(VFIOSpaprContainer, VFIO_IOMMU_SPAPR);
+
static bool vfio_prereg_listener_skipped_section(MemoryRegionSection *section)
{
if (memory_region_is_iommu(section->mr)) {
@@ -548,6 +550,7 @@ static const TypeInfo types[] = {
{
.name = TYPE_VFIO_IOMMU_SPAPR,
.parent = TYPE_VFIO_IOMMU_LEGACY,
+ .instance_size = sizeof(VFIOSpaprContainer),
.class_init = vfio_iommu_spapr_class_init,
},
};