2 * Communication channel between QEMU and remote device process
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.
14 #include "qom/object.h"
15 #include "qemu/thread.h"
16 #include "io/channel.h"
17 #include "exec/hwaddr.h"
18 #include "io/channel-socket.h"
19 #include "hw/remote/proxy.h"
21 #define REMOTE_MAX_FDS 8
23 #define MPQEMU_MSG_HDR_SIZE offsetof(MPQemuMsg, data.u64)
28 * MPQemuCmd enum type to specify the command to be executed on the remote
31 * This uses a private protocol between QEMU and the remote process. vfio-user
32 * protocol would supersede this in the future.
36 MPQEMU_CMD_SYNC_SYSMEM
,
38 MPQEMU_CMD_PCI_CFGWRITE
,
39 MPQEMU_CMD_PCI_CFGREAD
,
43 MPQEMU_CMD_DEVICE_RESET
,
48 hwaddr gpas
[REMOTE_MAX_FDS
];
49 uint64_t sizes
[REMOTE_MAX_FDS
];
50 off_t offsets
[REMOTE_MAX_FDS
];
68 * @cmd: The remote command
69 * @size: Size of the data to be shared
70 * @data: Structured data
71 * @fds: File descriptors to be shared with remote device
73 * MPQemuMsg Format of the message sent to the remote device from QEMU.
83 PciConfDataMsg pci_conf_data
;
84 SyncSysmemMsg sync_sysmem
;
85 BarAccessMsg bar_access
;
88 int fds
[REMOTE_MAX_FDS
];
92 bool mpqemu_msg_send(MPQemuMsg
*msg
, QIOChannel
*ioc
, Error
**errp
);
93 bool mpqemu_msg_recv(MPQemuMsg
*msg
, QIOChannel
*ioc
, Error
**errp
);
95 uint64_t mpqemu_msg_send_and_await_reply(MPQemuMsg
*msg
, PCIProxyDev
*pdev
,
97 bool mpqemu_msg_valid(MPQemuMsg
*msg
);