xref: /qemu/include/hw/remote/proxy.h (revision b355f08a)
1 /*
2  * Copyright © 2018, 2021 Oracle and/or its affiliates.
3  *
4  * This work is licensed under the terms of the GNU GPL, version 2 or later.
5  * See the COPYING file in the top-level directory.
6  *
7  */
8 
9 #ifndef PROXY_H
10 #define PROXY_H
11 
12 #include "hw/pci/pci.h"
13 #include "io/channel.h"
14 #include "hw/remote/proxy-memory-listener.h"
15 #include "qemu/event_notifier.h"
16 
17 #define TYPE_PCI_PROXY_DEV "x-pci-proxy-dev"
18 OBJECT_DECLARE_SIMPLE_TYPE(PCIProxyDev, PCI_PROXY_DEV)
19 
20 typedef struct ProxyMemoryRegion {
21     PCIProxyDev *dev;
22     MemoryRegion mr;
23     bool memory;
24     bool present;
25     uint8_t type;
26 } ProxyMemoryRegion;
27 
28 struct PCIProxyDev {
29     PCIDevice parent_dev;
30     char *fd;
31 
32     /*
33      * Mutex used to protect the QIOChannel fd from
34      * the concurrent access by the VCPUs since proxy
35      * blocks while awaiting for the replies from the
36      * process remote.
37      */
38     QemuMutex io_mutex;
39     QIOChannel *ioc;
40     Error *migration_blocker;
41     ProxyMemoryListener proxy_listener;
42     int virq;
43     EventNotifier intr;
44     EventNotifier resample;
45     ProxyMemoryRegion region[PCI_NUM_REGIONS];
46 };
47 
48 #endif /* PROXY_H */
49