acrn-hypervisor/devicemodel/include/monitor.h
Wu Zhou c77fb77e78 dm: vm_event: add vm_event support in cmd monitor
This patch added vm_event support in command monitor, so that vm_event
can be sent to a client (e.g., Libvirt) through the monitor.
As the command monitor works in socket server mode, the vm_event sending
process is designed in this way:
1. If a client wishes to receive vm_event, it issues a
   REGISTER_VM_EVENT_CLIENT command to the monitor.
2. Command monitor then handles the REGISTER_VM_EVENT_CLIENT command. If
   it is legitimate, the client is registered as as vm_event receiver.
   The command monitor then send a ACK to the client, and keeps the socket
   connection.
3. When a vm_event is generated, the command monitor send it out through
   the socket connection.
4. Only one event client is allowed.
5. The registration is cancelled on socket disconnection.

Tracked-On: #8547
Signed-off-by: Wu Zhou <wu.zhou@intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
2024-02-01 17:01:31 +08:00

43 lines
918 B
C

/*
* Project Acrn
* Acrn-dm-monitor
*
* Copyright (C) 2018-2022 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*
* Author: TaoYuhong <yuhong.tao@intel.com>
*/
/* acrn-dm monitor APIS */
#ifndef MONITOR_H
#define MONITOR_H
int monitor_init(struct vmctx *ctx);
void monitor_close(void);
struct monitor_vm_ops {
int (*stop) (void *arg);
int (*resume) (void *arg);
int (*suspend) (void *arg);
int (*pause) (void *arg);
int (*unpause) (void *arg);
int (*query) (void *arg);
int (*rescan)(void *arg, char *devargs);
};
int monitor_register_vm_ops(struct monitor_vm_ops *ops, void *arg,
const char *name);
/* helper functions for vm_ops callback developer */
unsigned get_wakeup_reason(void);
int set_wakeup_timer(time_t t);
int acrn_parse_intr_monitor(const char *opt);
int vm_monitor_blkrescan(void *arg, char *devargs);
int vm_monitor_send_vm_event(const char *msg);
#endif