]> git.ipfire.org Git - thirdparty/qemu.git/blame - include/hw/vfio/vfio-platform.h
Move QOM typedefs and add missing includes
[thirdparty/qemu.git] / include / hw / vfio / vfio-platform.h
CommitLineData
0ea2730b
EA
1/*
2 * vfio based device assignment support - platform devices
3 *
4 * Copyright Linaro Limited, 2014
5 *
6 * Authors:
7 * Kim Phillips <kim.phillips@linaro.org>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
12 * Based on vfio based PCI device assignment support:
13 * Copyright Red Hat, Inc. 2012
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"
38559979
EA
21#include "qemu/event_notifier.h"
22#include "qemu/queue.h"
db1015e9 23#include "qom/object.h"
0ea2730b
EA
24
25#define TYPE_VFIO_PLATFORM "vfio-platform"
26
38559979
EA
27enum {
28 VFIO_IRQ_INACTIVE = 0,
29 VFIO_IRQ_PENDING = 1,
30 VFIO_IRQ_ACTIVE = 2,
31 /* VFIO_IRQ_ACTIVE_AND_PENDING cannot happen with VFIO */
32};
33
34typedef struct VFIOINTp {
35 QLIST_ENTRY(VFIOINTp) next; /* entry for IRQ list */
36 QSIMPLEQ_ENTRY(VFIOINTp) pqnext; /* entry for pending IRQ queue */
a22313de
EA
37 EventNotifier *interrupt; /* eventfd triggered on interrupt */
38 EventNotifier *unmask; /* eventfd for unmask on QEMU bypass */
38559979
EA
39 qemu_irq qemuirq;
40 struct VFIOPlatformDevice *vdev; /* back pointer to device */
41 int state; /* inactive, pending, active */
42 uint8_t pin; /* index */
43 uint32_t flags; /* IRQ info flags */
fb5f8164 44 bool kvm_accel; /* set when QEMU bypass through KVM enabled */
38559979
EA
45} VFIOINTp;
46
47/* function type for user side eventfd handler */
48typedef void (*eventfd_user_side_handler_t)(VFIOINTp *intp);
49
db1015e9 50struct VFIOPlatformDevice {
0ea2730b
EA
51 SysBusDevice sbdev;
52 VFIODevice vbasedev; /* not a QOM object */
53 VFIORegion **regions;
38559979
EA
54 QLIST_HEAD(, VFIOINTp) intp_list; /* list of IRQs */
55 /* queue of pending IRQs */
b58deb34 56 QSIMPLEQ_HEAD(, VFIOINTp) pending_intp_queue;
a49531eb
EA
57 char *compat; /* DT compatible values, separated by NUL */
58 unsigned int num_compat; /* number of compatible values */
38559979
EA
59 uint32_t mmap_timeout; /* delay to re-enable mmaps after interrupt */
60 QEMUTimer *mmap_timer; /* allows fast-path resume after IRQ hit */
61 QemuMutex intp_mutex; /* protect the intp_list IRQ state */
fb5f8164 62 bool irqfd_allowed; /* debug option to force irqfd on/off */
db1015e9
EH
63};
64typedef struct VFIOPlatformDevice VFIOPlatformDevice;
0ea2730b 65
db1015e9 66struct VFIOPlatformDeviceClass {
0ea2730b
EA
67 /*< private >*/
68 SysBusDeviceClass parent_class;
69 /*< public >*/
db1015e9
EH
70};
71typedef struct VFIOPlatformDeviceClass VFIOPlatformDeviceClass;
0ea2730b
EA
72
73#define VFIO_PLATFORM_DEVICE(obj) \
74 OBJECT_CHECK(VFIOPlatformDevice, (obj), TYPE_VFIO_PLATFORM)
75#define VFIO_PLATFORM_DEVICE_CLASS(klass) \
76 OBJECT_CLASS_CHECK(VFIOPlatformDeviceClass, (klass), TYPE_VFIO_PLATFORM)
77#define VFIO_PLATFORM_DEVICE_GET_CLASS(obj) \
78 OBJECT_GET_CLASS(VFIOPlatformDeviceClass, (obj), TYPE_VFIO_PLATFORM)
79
175de524 80#endif /* HW_VFIO_VFIO_PLATFORM_H */