2 * IO Hub for remote device
4 * Copyright © 2018, 2021 Oracle and/or its affiliates.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
11 #ifndef REMOTE_IOHUB_H
12 #define REMOTE_IOHUB_H
14 #include "hw/pci/pci_device.h"
15 #include "qemu/event_notifier.h"
16 #include "qemu/thread-posix.h"
17 #include "hw/remote/mpqemu-link.h"
19 #define REMOTE_IOHUB_NB_PIRQS PCI_DEVFN_MAX
21 typedef struct ResampleToken
{
26 typedef struct RemoteIOHubState
{
28 EventNotifier irqfds
[REMOTE_IOHUB_NB_PIRQS
];
29 EventNotifier resamplefds
[REMOTE_IOHUB_NB_PIRQS
];
30 unsigned int irq_level
[REMOTE_IOHUB_NB_PIRQS
];
31 ResampleToken token
[REMOTE_IOHUB_NB_PIRQS
];
32 QemuMutex irq_level_lock
[REMOTE_IOHUB_NB_PIRQS
];
35 int remote_iohub_map_irq(PCIDevice
*pci_dev
, int intx
);
36 void remote_iohub_set_irq(void *opaque
, int pirq
, int level
);
37 void process_set_irqfd_msg(PCIDevice
*pci_dev
, MPQemuMsg
*msg
);
39 void remote_iohub_init(RemoteIOHubState
*iohub
);
40 void remote_iohub_finalize(RemoteIOHubState
*iohub
);