mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
hw/vfio/platform: add irq assignment
This patch adds the code requested to assign interrupts to a guest. The interrupts are mediated through user handled eventfds only. Signed-off-by: Eric Auger <eric.auger@linaro.org> Tested-by: Vikram Sethi <vikrams@codeaurora.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
0ea2730bef
commit
38559979bf
3 changed files with 368 additions and 1 deletions
|
@ -18,14 +18,45 @@
|
|||
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/vfio/vfio-common.h"
|
||||
#include "qemu/event_notifier.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "hw/irq.h"
|
||||
|
||||
#define TYPE_VFIO_PLATFORM "vfio-platform"
|
||||
|
||||
enum {
|
||||
VFIO_IRQ_INACTIVE = 0,
|
||||
VFIO_IRQ_PENDING = 1,
|
||||
VFIO_IRQ_ACTIVE = 2,
|
||||
/* VFIO_IRQ_ACTIVE_AND_PENDING cannot happen with VFIO */
|
||||
};
|
||||
|
||||
typedef struct VFIOINTp {
|
||||
QLIST_ENTRY(VFIOINTp) next; /* entry for IRQ list */
|
||||
QSIMPLEQ_ENTRY(VFIOINTp) pqnext; /* entry for pending IRQ queue */
|
||||
EventNotifier interrupt; /* eventfd triggered on interrupt */
|
||||
EventNotifier unmask; /* eventfd for unmask on QEMU bypass */
|
||||
qemu_irq qemuirq;
|
||||
struct VFIOPlatformDevice *vdev; /* back pointer to device */
|
||||
int state; /* inactive, pending, active */
|
||||
uint8_t pin; /* index */
|
||||
uint32_t flags; /* IRQ info flags */
|
||||
} VFIOINTp;
|
||||
|
||||
/* function type for user side eventfd handler */
|
||||
typedef void (*eventfd_user_side_handler_t)(VFIOINTp *intp);
|
||||
|
||||
typedef struct VFIOPlatformDevice {
|
||||
SysBusDevice sbdev;
|
||||
VFIODevice vbasedev; /* not a QOM object */
|
||||
VFIORegion **regions;
|
||||
QLIST_HEAD(, VFIOINTp) intp_list; /* list of IRQs */
|
||||
/* queue of pending IRQs */
|
||||
QSIMPLEQ_HEAD(pending_intp_queue, VFIOINTp) pending_intp_queue;
|
||||
char *compat; /* compatibility string */
|
||||
uint32_t mmap_timeout; /* delay to re-enable mmaps after interrupt */
|
||||
QEMUTimer *mmap_timer; /* allows fast-path resume after IRQ hit */
|
||||
QemuMutex intp_mutex; /* protect the intp_list IRQ state */
|
||||
} VFIOPlatformDevice;
|
||||
|
||||
typedef struct VFIOPlatformDeviceClass {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue