qemu/include/hw/remote/mpqemu-link.h
Jagannathan Raman ed5d001916 multi-process: setup memory manager for remote device
SyncSysMemMsg message format is defined. It is used to send
file descriptors of the RAM regions to remote device.
RAM on the remote device is configured with a set of file descriptors.
Old RAM regions are deleted and new regions, each with an fd, is
added to the RAM.

Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 7d2d1831d812e85f681e7a8ab99e032cf4704689.1611938319.git.jag.raman@oracle.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2021-02-10 09:23:28 +00:00

73 lines
1.5 KiB
C

/*
* Communication channel between QEMU and remote device process
*
* Copyright © 2018, 2021 Oracle and/or its affiliates.
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*
*/
#ifndef MPQEMU_LINK_H
#define MPQEMU_LINK_H
#include "qom/object.h"
#include "qemu/thread.h"
#include "io/channel.h"
#include "exec/hwaddr.h"
#define REMOTE_MAX_FDS 8
#define MPQEMU_MSG_HDR_SIZE offsetof(MPQemuMsg, data.u64)
/**
* MPQemuCmd:
*
* MPQemuCmd enum type to specify the command to be executed on the remote
* device.
*
* This uses a private protocol between QEMU and the remote process. vfio-user
* protocol would supersede this in the future.
*
*/
typedef enum {
MPQEMU_CMD_SYNC_SYSMEM,
MPQEMU_CMD_MAX,
} MPQemuCmd;
typedef struct {
hwaddr gpas[REMOTE_MAX_FDS];
uint64_t sizes[REMOTE_MAX_FDS];
off_t offsets[REMOTE_MAX_FDS];
} SyncSysmemMsg;
/**
* MPQemuMsg:
* @cmd: The remote command
* @size: Size of the data to be shared
* @data: Structured data
* @fds: File descriptors to be shared with remote device
*
* MPQemuMsg Format of the message sent to the remote device from QEMU.
*
*/
typedef struct {
int cmd;
size_t size;
union {
uint64_t u64;
SyncSysmemMsg sync_sysmem;
} data;
int fds[REMOTE_MAX_FDS];
int num_fds;
} MPQemuMsg;
bool mpqemu_msg_send(MPQemuMsg *msg, QIOChannel *ioc, Error **errp);
bool mpqemu_msg_recv(MPQemuMsg *msg, QIOChannel *ioc, Error **errp);
bool mpqemu_msg_valid(MPQemuMsg *msg);
#endif