1 /* 2 * VFIO container 3 * 4 * Copyright Red Hat, Inc. 2025 5 * 6 * SPDX-License-Identifier: GPL-2.0-or-later 7 */ 8 9 #ifndef HW_VFIO_CONTAINER_H 10 #define HW_VFIO_CONTAINER_H 11 12 #include "hw/vfio/vfio-container-base.h" 13 14 typedef struct VFIOContainer VFIOContainer; 15 typedef struct VFIODevice VFIODevice; 16 17 typedef struct VFIOGroup { 18 int fd; 19 int groupid; 20 VFIOContainer *container; 21 QLIST_HEAD(, VFIODevice) device_list; 22 QLIST_ENTRY(VFIOGroup) next; 23 QLIST_ENTRY(VFIOGroup) container_next; 24 bool ram_block_discard_allowed; 25 } VFIOGroup; 26 27 typedef struct VFIOContainer { 28 VFIOContainerBase bcontainer; 29 int fd; /* /dev/vfio/vfio, empowered by the attached groups */ 30 unsigned iommu_type; 31 QLIST_HEAD(, VFIOGroup) group_list; 32 } VFIOContainer; 33 34 OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY); 35 36 #endif /* HW_VFIO_CONTAINER_H */ 37