1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef HW_VFIO_VFIO_PLATFORM_H
17#define HW_VFIO_VFIO_PLATFORM_H
18
19#include "hw/sysbus.h"
20#include "hw/vfio/vfio-common.h"
21#include "qemu/event_notifier.h"
22#include "qemu/queue.h"
23
24#define TYPE_VFIO_PLATFORM "vfio-platform"
25
26enum {
27 VFIO_IRQ_INACTIVE = 0,
28 VFIO_IRQ_PENDING = 1,
29 VFIO_IRQ_ACTIVE = 2,
30
31};
32
33typedef struct VFIOINTp {
34 QLIST_ENTRY(VFIOINTp) next;
35 QSIMPLEQ_ENTRY(VFIOINTp) pqnext;
36 EventNotifier *interrupt;
37 EventNotifier *unmask;
38 qemu_irq qemuirq;
39 struct VFIOPlatformDevice *vdev;
40 int state;
41 uint8_t pin;
42 uint32_t flags;
43 bool kvm_accel;
44} VFIOINTp;
45
46
47typedef void (*eventfd_user_side_handler_t)(VFIOINTp *intp);
48
49typedef struct VFIOPlatformDevice {
50 SysBusDevice sbdev;
51 VFIODevice vbasedev;
52 VFIORegion **regions;
53 QLIST_HEAD(, VFIOINTp) intp_list;
54
55 QSIMPLEQ_HEAD(, VFIOINTp) pending_intp_queue;
56 char *compat;
57 unsigned int num_compat;
58 uint32_t mmap_timeout;
59 QEMUTimer *mmap_timer;
60 QemuMutex intp_mutex;
61 bool irqfd_allowed;
62} VFIOPlatformDevice;
63
64typedef struct VFIOPlatformDeviceClass {
65
66 SysBusDeviceClass parent_class;
67
68} VFIOPlatformDeviceClass;
69
70#define VFIO_PLATFORM_DEVICE(obj) \
71 OBJECT_CHECK(VFIOPlatformDevice, (obj), TYPE_VFIO_PLATFORM)
72#define VFIO_PLATFORM_DEVICE_CLASS(klass) \
73 OBJECT_CLASS_CHECK(VFIOPlatformDeviceClass, (klass), TYPE_VFIO_PLATFORM)
74#define VFIO_PLATFORM_DEVICE_GET_CLASS(obj) \
75 OBJECT_GET_CLASS(VFIOPlatformDeviceClass, (obj), TYPE_VFIO_PLATFORM)
76
77#endif
78