vfio/common: Move giommu_list in base container

Move the giommu_list field in the base container and store
the base container in the VFIOGuestIOMMU.

No functional change intended.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Eric Auger 2023-11-02 15:12:31 +08:00 committed by Cédric Le Goater
parent ed2f7f8017
commit dddf83ab99
5 changed files with 29 additions and 23 deletions

View file

@ -95,7 +95,6 @@ typedef struct VFIOContainer {
uint64_t max_dirty_bitmap_size;
unsigned long pgsizes;
unsigned int dma_max_mappings;
QLIST_HEAD(, VFIOGuestIOMMU) giommu_list;
QLIST_HEAD(, VFIOHostDMAWindow) hostwin_list;
QLIST_HEAD(, VFIOGroup) group_list;
QLIST_HEAD(, VFIORamDiscardListener) vrdl_list;
@ -104,14 +103,6 @@ typedef struct VFIOContainer {
GList *iova_ranges;
} VFIOContainer;
typedef struct VFIOGuestIOMMU {
VFIOContainer *container;
IOMMUMemoryRegion *iommu_mr;
hwaddr iommu_offset;
IOMMUNotifier n;
QLIST_ENTRY(VFIOGuestIOMMU) giommu_next;
} VFIOGuestIOMMU;
typedef struct VFIORamDiscardListener {
VFIOContainer *container;
MemoryRegion *mr;

View file

@ -29,8 +29,17 @@ typedef struct {
*/
typedef struct VFIOContainerBase {
const VFIOIOMMUOps *ops;
QLIST_HEAD(, VFIOGuestIOMMU) giommu_list;
} VFIOContainerBase;
typedef struct VFIOGuestIOMMU {
VFIOContainerBase *bcontainer;
IOMMUMemoryRegion *iommu_mr;
hwaddr iommu_offset;
IOMMUNotifier n;
QLIST_ENTRY(VFIOGuestIOMMU) giommu_next;
} VFIOGuestIOMMU;
int vfio_container_dma_map(VFIOContainerBase *bcontainer,
hwaddr iova, ram_addr_t size,
void *vaddr, bool readonly);