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