xref: /qemu/include/hw/remote/proxy.h (revision c746b74a7d881c7da4afdd7b29353a90c445a8ab)
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 
16 #define TYPE_PCI_PROXY_DEV "x-pci-proxy-dev"
17 OBJECT_DECLARE_SIMPLE_TYPE(PCIProxyDev, PCI_PROXY_DEV)
18 
19 typedef struct ProxyMemoryRegion {
20     PCIProxyDev *dev;
21     MemoryRegion mr;
22     bool memory;
23     bool present;
24     uint8_t type;
25 } ProxyMemoryRegion;
26 
27 struct PCIProxyDev {
28     PCIDevice parent_dev;
29     char *fd;
30 
31     /*
32      * Mutex used to protect the QIOChannel fd from
33      * the concurrent access by the VCPUs since proxy
34      * blocks while awaiting for the replies from the
35      * process remote.
36      */
37     QemuMutex io_mutex;
38     QIOChannel *ioc;
39     Error *migration_blocker;
40     ProxyMemoryListener proxy_listener;
41     ProxyMemoryRegion region[PCI_NUM_REGIONS];
42 };
43 
44 #endif /* PROXY_H */
45