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 #include "hw/vfio/vfio-cpr.h" 14 15 typedef struct VFIOContainer VFIOContainer; 16 typedef struct VFIODevice VFIODevice; 17 18 typedef struct VFIOGroup { 19 int fd; 20 int groupid; 21 VFIOContainer *container; 22 QLIST_HEAD(, VFIODevice) device_list; 23 QLIST_ENTRY(VFIOGroup) next; 24 QLIST_ENTRY(VFIOGroup) container_next; 25 bool ram_block_discard_allowed; 26 } VFIOGroup; 27 28 typedef struct VFIOContainer { 29 VFIOContainerBase bcontainer; 30 int fd; /* /dev/vfio/vfio, empowered by the attached groups */ 31 unsigned iommu_type; 32 QLIST_HEAD(, VFIOGroup) group_list; 33 VFIOContainerCPR cpr; 34 } VFIOContainer; 35 36 OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY); 37 38 #endif /* HW_VFIO_CONTAINER_H */ 39