-
Shuo Liu authored
The VM management interfaces expose several VM operations to ACRN userspace via ioctls. For example, creating VM, starting VM, destroying VM and so on. The ACRN Hypervisor needs to exchange data with the ACRN userspace during the VM operations. HSM provides VM operation ioctls to the ACRN userspace and communicates with the ACRN Hypervisor for VM operations via hypercalls. HSM maintains a list of User VM. Each User VM will be bound to an existing file descriptor of /dev/acrn_hsm. The User VM will be destroyed when the file descriptor is closed. Cc: Zhi Wang <zhi.a.wang@intel.com> Cc: Zhenyu Wang <zhenyuw@linux.intel.com> Cc: Yu Wang <yu1.wang@intel.com> Cc: Reinette Chatre <reinette.chatre@intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by:
Zhi Wang <zhi.a.wang@intel.com> Reviewed-by:
Reinette Chatre <reinette.chatre@intel.com> Signed-off-by:
Shuo Liu <shuo.a.liu@intel.com> Link: https://lore.kernel.org/r/20210207031040.49576-7-shuo.a.liu@intel.com Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9c5137ae
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
hypercall.h 1.67 KiB
/* SPDX-License-Identifier: GPL-2.0 */
/*
* ACRN HSM: hypercalls of ACRN Hypervisor
*/
#ifndef __ACRN_HSM_HYPERCALL_H
#define __ACRN_HSM_HYPERCALL_H
#include <asm/acrn.h>
/*
* Hypercall IDs of the ACRN Hypervisor
*/
#define _HC_ID(x, y) (((x) << 24) | (y))
#define HC_ID 0x80UL
#define HC_ID_VM_BASE 0x10UL
#define HC_CREATE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x00)
#define HC_DESTROY_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x01)
#define HC_START_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x02)
#define HC_PAUSE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x03)
#define HC_RESET_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x05)
/**
* hcall_create_vm() - Create a User VM
* @vminfo: Service VM GPA of info of User VM creation
*
* Return: 0 on success, <0 on failure
*/
static inline long hcall_create_vm(u64 vminfo)
{
return acrn_hypercall1(HC_CREATE_VM, vminfo);
}
/**
* hcall_start_vm() - Start a User VM
* @vmid: User VM ID
*
* Return: 0 on success, <0 on failure
*/
static inline long hcall_start_vm(u64 vmid)
{
return acrn_hypercall1(HC_START_VM, vmid);
}
/**
* hcall_pause_vm() - Pause a User VM
* @vmid: User VM ID
*
* Return: 0 on success, <0 on failure
*/
static inline long hcall_pause_vm(u64 vmid)
{
return acrn_hypercall1(HC_PAUSE_VM, vmid);
}
/**
* hcall_destroy_vm() - Destroy a User VM
* @vmid: User VM ID
*
* Return: 0 on success, <0 on failure
*/
static inline long hcall_destroy_vm(u64 vmid)
{
return acrn_hypercall1(HC_DESTROY_VM, vmid);
}
/**
* hcall_reset_vm() - Reset a User VM
* @vmid: User VM ID
*
* Return: 0 on success, <0 on failure
*/
static inline long hcall_reset_vm(u64 vmid)
{
return acrn_hypercall1(HC_RESET_VM, vmid);
}
#endif /* __ACRN_HSM_HYPERCALL_H */