History

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.

Shuo Liu committed 5 years ago

Commit 9c5137a1 parent 666834c8 files · +301 −4Browse files

Showing the changes to include/uapi (1 of 8 files). Show all

Unified · Split

include/uapi/linux/acrn.h+58−0
@@ -0,0 +1,58 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+/*
3+ * Userspace interface for /dev/acrn_hsm - ACRN Hypervisor Service Module
4+ *
5+ * This file can be used by applications that need to communicate with the HSM
6+ * via the ioctl interface.
7+ *
8+ * Copyright (C) 2021 Intel Corporation. All rights reserved.
9+ */
10+
11+#ifndef _UAPI_ACRN_H
12+#define _UAPI_ACRN_H
13+
14+#include <linux/types.h>
15+#include <linux/uuid.h>
16+
17+/**
18+ * struct acrn_vm_creation - Info to create a User VM
19+ * @vmid: User VM ID returned from the hypervisor
20+ * @reserved0: Reserved and must be 0
21+ * @vcpu_num: Number of vCPU in the VM. Return from hypervisor.
22+ * @reserved1: Reserved and must be 0
23+ * @uuid: UUID of the VM. Pass to hypervisor directly.
24+ * @vm_flag: Flag of the VM creating. Pass to hypervisor directly.
25+ * @ioreq_buf: Service VM GPA of I/O request buffer. Pass to
26+ * hypervisor directly.
27+ * @cpu_affinity: CPU affinity of the VM. Pass to hypervisor directly.
28+ * It's a bitmap which indicates CPUs used by the VM.
29+ */
30+struct acrn_vm_creation {
31+ __u16 vmid;
32+ __u16 reserved0;
33+ __u16 vcpu_num;
34+ __u16 reserved1;
35+ guid_t uuid;
36+ __u64 vm_flag;
37+ __u64 ioreq_buf;
38+ __u64 cpu_affinity;
39+};
40+
41+/* The ioctl type, documented in ioctl-number.rst */
42+#define ACRN_IOCTL_TYPE 0xA2
43+
44+/*
45+ * Common IOCTL IDs definition for ACRN userspace
46+ */
47+#define ACRN_IOCTL_CREATE_VM \
48+ _IOWR(ACRN_IOCTL_TYPE, 0x10, struct acrn_vm_creation)
49+#define ACRN_IOCTL_DESTROY_VM \
50+ _IO(ACRN_IOCTL_TYPE, 0x11)
51+#define ACRN_IOCTL_START_VM \
52+ _IO(ACRN_IOCTL_TYPE, 0x12)
53+#define ACRN_IOCTL_PAUSE_VM \
54+ _IO(ACRN_IOCTL_TYPE, 0x13)
55+#define ACRN_IOCTL_RESET_VM \
56+ _IO(ACRN_IOCTL_TYPE, 0x15)
57+
58+#endif /* _UAPI_ACRN_H */