summaryrefslogtreecommitdiffstats
path: root/drivers/virt/acrn/acrn_drv.h
diff options
context:
space:
mode:
authorShuo Liu <shuo.a.liu@intel.com>2021-02-07 04:10:28 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-02-09 10:58:18 +0100
commit9c5137aedd112f78a968bdd2325de2ea06df46c0 (patch)
treea5733316d34de05dcdbc90818c5af5affe74020c /drivers/virt/acrn/acrn_drv.h
parentvirt: acrn: Introduce ACRN HSM basic driver (diff)
downloadlinux-9c5137aedd112f78a968bdd2325de2ea06df46c0.tar.xz
linux-9c5137aedd112f78a968bdd2325de2ea06df46c0.zip
virt: acrn: Introduce VM management interfaces
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>
Diffstat (limited to 'drivers/virt/acrn/acrn_drv.h')
-rw-r--r--drivers/virt/acrn/acrn_drv.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/virt/acrn/acrn_drv.h b/drivers/virt/acrn/acrn_drv.h
index 29eedd696327..e5aba86cad8c 100644
--- a/drivers/virt/acrn/acrn_drv.h
+++ b/drivers/virt/acrn/acrn_drv.h
@@ -3,16 +3,35 @@
#ifndef __ACRN_HSM_DRV_H
#define __ACRN_HSM_DRV_H
+#include <linux/acrn.h>
+#include <linux/dev_printk.h>
+#include <linux/miscdevice.h>
#include <linux/types.h>
+#include "hypercall.h"
+
+extern struct miscdevice acrn_dev;
+
#define ACRN_INVALID_VMID (0xffffU)
+#define ACRN_VM_FLAG_DESTROYED 0U
/**
* struct acrn_vm - Properties of ACRN User VM.
+ * @list: Entry within global list of all VMs
* @vmid: User VM ID
+ * @vcpu_num: Number of virtual CPUs in the VM
+ * @flags: Flags (ACRN_VM_FLAG_*) of the VM. This is VM flag management
+ * in HSM which is different from the &acrn_vm_creation.vm_flag.
*/
struct acrn_vm {
- u16 vmid;
+ struct list_head list;
+ u16 vmid;
+ int vcpu_num;
+ unsigned long flags;
};
+struct acrn_vm *acrn_vm_create(struct acrn_vm *vm,
+ struct acrn_vm_creation *vm_param);
+int acrn_vm_destroy(struct acrn_vm *vm);
+
#endif /* __ACRN_HSM_DRV_H */