mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
vfio: Remove unneeded union from VFIOContainer
Currently the VFIOContainer iommu_data field contains a union with different information for different host iommu types. However: * It only actually contains information for the x86-like "Type1" iommu * Because we have a common listener the Type1 fields are actually used on all IOMMU types, including the SPAPR TCE type as well In fact we now have a general structure for the listener which is unlikely to ever need per-iommu-type information, so this patch removes the union. In a similar way we can unify the setup of the vfio memory listener in vfio_connect_container() that is currently split across a switch on iommu type, but is effectively the same in both cases. The iommu_data.release pointer was only needed as a cleanup function which would handle potentially different data in the union. With the union gone, it too can be removed. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
a5b39cd3f6
commit
ee0bf0e59b
2 changed files with 22 additions and 46 deletions
|
@ -59,22 +59,12 @@ typedef struct VFIOAddressSpace {
|
|||
|
||||
struct VFIOGroup;
|
||||
|
||||
typedef struct VFIOType1 {
|
||||
MemoryListener listener;
|
||||
int error;
|
||||
bool initialized;
|
||||
} VFIOType1;
|
||||
|
||||
typedef struct VFIOContainer {
|
||||
VFIOAddressSpace *space;
|
||||
int fd; /* /dev/vfio/vfio, empowered by the attached groups */
|
||||
struct {
|
||||
/* enable abstraction to support various iommu backends */
|
||||
union {
|
||||
VFIOType1 type1;
|
||||
};
|
||||
void (*release)(struct VFIOContainer *);
|
||||
} iommu_data;
|
||||
MemoryListener listener;
|
||||
int error;
|
||||
bool initialized;
|
||||
QLIST_HEAD(, VFIOGuestIOMMU) giommu_list;
|
||||
QLIST_HEAD(, VFIOGroup) group_list;
|
||||
QLIST_ENTRY(VFIOContainer) next;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue