Elena Ufimtseva | 9f81120 | 2021-01-29 11:46:14 -0500 | [diff] [blame] | 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 | |
Markus Armbruster | edf5ca5 | 2022-12-22 11:03:28 +0100 | [diff] [blame] | 12 | #include "hw/pci/pci_device.h" |
Elena Ufimtseva | 9f81120 | 2021-01-29 11:46:14 -0500 | [diff] [blame] | 13 | #include "io/channel.h" |
Jagannathan Raman | c746b74 | 2021-01-29 11:46:18 -0500 | [diff] [blame] | 14 | #include "hw/remote/proxy-memory-listener.h" |
Jagannathan Raman | bd36adb | 2021-01-29 11:46:19 -0500 | [diff] [blame] | 15 | #include "qemu/event_notifier.h" |
Elena Ufimtseva | 9f81120 | 2021-01-29 11:46:14 -0500 | [diff] [blame] | 16 | |
| 17 | #define TYPE_PCI_PROXY_DEV "x-pci-proxy-dev" |
| 18 | OBJECT_DECLARE_SIMPLE_TYPE(PCIProxyDev, PCI_PROXY_DEV) |
| 19 | |
Jagannathan Raman | 7ee3f82 | 2021-01-29 11:46:17 -0500 | [diff] [blame] | 20 | typedef struct ProxyMemoryRegion { |
| 21 | PCIProxyDev *dev; |
| 22 | MemoryRegion mr; |
| 23 | bool memory; |
| 24 | bool present; |
| 25 | uint8_t type; |
| 26 | } ProxyMemoryRegion; |
| 27 | |
Elena Ufimtseva | 9f81120 | 2021-01-29 11:46:14 -0500 | [diff] [blame] | 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; |
Jagannathan Raman | c746b74 | 2021-01-29 11:46:18 -0500 | [diff] [blame] | 41 | ProxyMemoryListener proxy_listener; |
Jagannathan Raman | bd36adb | 2021-01-29 11:46:19 -0500 | [diff] [blame] | 42 | int virq; |
| 43 | EventNotifier intr; |
| 44 | EventNotifier resample; |
Jagannathan Raman | 7ee3f82 | 2021-01-29 11:46:17 -0500 | [diff] [blame] | 45 | ProxyMemoryRegion region[PCI_NUM_REGIONS]; |
Elena Ufimtseva | 9f81120 | 2021-01-29 11:46:14 -0500 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | #endif /* PROXY_H */ |