acrn-hypervisor/devicemodel/include/monitor.h

40 lines
885 B
C
Raw Normal View History

/*
* Project Acrn
* Acrn-dm-monitor
*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* 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);
DM: Virtio-Blk Rescan This patch adds support to trigger rescan of virtio-blk device by the guest VM. This is an alternate to hot-plugging virtio-blk device. This feature stems from the kata requirement, which hot-plugs container rootfs after the VM is launched. As part of virtio-blk rescan, 1. Update the backing file for the virtio-blk device with valid file. Basically update the empty file (with dummy bctxt) that was passed during VM launch. 2. Update virtio-blk device configurations for udpated backing file. 3. Update size associated with valid backing file in the config space. 4. Notify guest OS, of the new config change. 5. On this notification, guest will do the following. (i). Update virtio-blk capacity. (ii). Revalidate the disk. (iii). Identify the newly plugged block device. v5 -> v6: - Removed use of dummy file and added a new parameter "nodisk" to virtio-blk which indicates user wants to create a virtio-blk device with dummy backend. - Moved vm_monitor_rescan from pci core to virtio-blk as it currently applies to only virtio-blk. v4 -> v5: - Reverted back logic, so that blkrescan is only supported when VM is launched with empty backend file. v3 -> v4: - Close block context before allocating a new one - Allow backend filepath with additional options to be more generic - Remove blank lines introduced as part of previous patches. v2 -> v3: - Renamed vdev ops vdev_blk rescan to vdev_rescan - Renamed montior ops virtio_blkrescan_ops to virtio_rescan_ops - Consolidated virtio-blk configuration specific part into a separate function - Removed size requirement in acrnctl command. v1 -> v2: - Added more comments in the code. - Renamed APIs from displug to blkrescan, inline with acrnctl cmd. - Split the patch into two. This corresponds to changes in acrn-dm. Tracked-On: #3051 Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
2019-04-18 08:49:26 +08:00
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);
DM: Virtio-Blk Rescan This patch adds support to trigger rescan of virtio-blk device by the guest VM. This is an alternate to hot-plugging virtio-blk device. This feature stems from the kata requirement, which hot-plugs container rootfs after the VM is launched. As part of virtio-blk rescan, 1. Update the backing file for the virtio-blk device with valid file. Basically update the empty file (with dummy bctxt) that was passed during VM launch. 2. Update virtio-blk device configurations for udpated backing file. 3. Update size associated with valid backing file in the config space. 4. Notify guest OS, of the new config change. 5. On this notification, guest will do the following. (i). Update virtio-blk capacity. (ii). Revalidate the disk. (iii). Identify the newly plugged block device. v5 -> v6: - Removed use of dummy file and added a new parameter "nodisk" to virtio-blk which indicates user wants to create a virtio-blk device with dummy backend. - Moved vm_monitor_rescan from pci core to virtio-blk as it currently applies to only virtio-blk. v4 -> v5: - Reverted back logic, so that blkrescan is only supported when VM is launched with empty backend file. v3 -> v4: - Close block context before allocating a new one - Allow backend filepath with additional options to be more generic - Remove blank lines introduced as part of previous patches. v2 -> v3: - Renamed vdev ops vdev_blk rescan to vdev_rescan - Renamed montior ops virtio_blkrescan_ops to virtio_rescan_ops - Consolidated virtio-blk configuration specific part into a separate function - Removed size requirement in acrnctl command. v1 -> v2: - Added more comments in the code. - Renamed APIs from displug to blkrescan, inline with acrnctl cmd. - Split the patch into two. This corresponds to changes in acrn-dm. Tracked-On: #3051 Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
2019-04-18 08:49:26 +08:00
int vm_monitor_blkrescan(void *arg, char *devargs);
#endif