xref: /linux-6.15/include/uapi/linux/acrn.h (revision 9c5137ae)
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 */
59