blob: 0cfd9665bedf174aa5594dc5e17c50eda5b52377 [file] [log] [blame]
Elena Ufimtseva9f811202021-01-29 11:46:14 -05001/*
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
Markus Armbrusteredf5ca52022-12-22 11:03:28 +010012#include "hw/pci/pci_device.h"
Elena Ufimtseva9f811202021-01-29 11:46:14 -050013#include "io/channel.h"
Jagannathan Ramanc746b742021-01-29 11:46:18 -050014#include "hw/remote/proxy-memory-listener.h"
Jagannathan Ramanbd36adb2021-01-29 11:46:19 -050015#include "qemu/event_notifier.h"
Elena Ufimtseva9f811202021-01-29 11:46:14 -050016
17#define TYPE_PCI_PROXY_DEV "x-pci-proxy-dev"
18OBJECT_DECLARE_SIMPLE_TYPE(PCIProxyDev, PCI_PROXY_DEV)
19
Jagannathan Raman7ee3f822021-01-29 11:46:17 -050020typedef struct ProxyMemoryRegion {
21 PCIProxyDev *dev;
22 MemoryRegion mr;
23 bool memory;
24 bool present;
25 uint8_t type;
26} ProxyMemoryRegion;
27
Elena Ufimtseva9f811202021-01-29 11:46:14 -050028struct 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;
Jagannathan Ramanc746b742021-01-29 11:46:18 -050041 ProxyMemoryListener proxy_listener;
Jagannathan Ramanbd36adb2021-01-29 11:46:19 -050042 int virq;
43 EventNotifier intr;
44 EventNotifier resample;
Jagannathan Raman7ee3f822021-01-29 11:46:17 -050045 ProxyMemoryRegion region[PCI_NUM_REGIONS];
Elena Ufimtseva9f811202021-01-29 11:46:14 -050046};
47
48#endif /* PROXY_H */