summary refs log tree commit diff stats
path: root/include/hw/vfio/vfio-container.h
blob: 712a6914004aeb2eb83927e8c91377eb2dde33f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * VFIO container
 *
 * Copyright Red Hat, Inc. 2025
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef HW_VFIO_CONTAINER_H
#define HW_VFIO_CONTAINER_H

#include "hw/vfio/vfio-container-base.h"
#include "hw/vfio/vfio-cpr.h"

typedef struct VFIOLegacyContainer VFIOLegacyContainer;
typedef struct VFIODevice VFIODevice;

typedef struct VFIOGroup {
    int fd;
    int groupid;
    VFIOLegacyContainer *container;
    QLIST_HEAD(, VFIODevice) device_list;
    QLIST_ENTRY(VFIOGroup) next;
    QLIST_ENTRY(VFIOGroup) container_next;
    bool ram_block_discard_allowed;
} VFIOGroup;

struct VFIOLegacyContainer {
    VFIOContainerBase parent_obj;

    int fd; /* /dev/vfio/vfio, empowered by the attached groups */
    unsigned iommu_type;
    QLIST_HEAD(, VFIOGroup) group_list;
    VFIOContainerCPR cpr;
};

OBJECT_DECLARE_SIMPLE_TYPE(VFIOLegacyContainer, VFIO_IOMMU_LEGACY);

#endif /* HW_VFIO_CONTAINER_H */