xref: /linux/arch/x86/include/uapi/asm/sgx.h (revision 9d0c151b41fed7b879030f4e533143d098781701)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Copyright(c) 2016-20 Intel Corporation.
4  */
5 #ifndef _UAPI_ASM_X86_SGX_H
6 #define _UAPI_ASM_X86_SGX_H
7 
8 #include <linux/types.h>
9 #include <linux/ioctl.h>
10 
11 /**
12  * enum sgx_epage_flags - page control flags
13  * %SGX_PAGE_MEASURE:	Measure the page contents with a sequence of
14  *			ENCLS[EEXTEND] operations.
15  */
16 enum sgx_page_flags {
17 	SGX_PAGE_MEASURE	= 0x01,
18 };
19 
20 #define SGX_MAGIC 0xA4
21 
22 #define SGX_IOC_ENCLAVE_CREATE \
23 	_IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create)
24 #define SGX_IOC_ENCLAVE_ADD_PAGES \
25 	_IOWR(SGX_MAGIC, 0x01, struct sgx_enclave_add_pages)
26 #define SGX_IOC_ENCLAVE_INIT \
27 	_IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init)
28 
29 /**
30  * struct sgx_enclave_create - parameter structure for the
31  *                             %SGX_IOC_ENCLAVE_CREATE ioctl
32  * @src:	address for the SECS page data
33  */
34 struct sgx_enclave_create  {
35 	__u64	src;
36 };
37 
38 /**
39  * struct sgx_enclave_add_pages - parameter structure for the
40  *                                %SGX_IOC_ENCLAVE_ADD_PAGE ioctl
41  * @src:	start address for the page data
42  * @offset:	starting page offset
43  * @length:	length of the data (multiple of the page size)
44  * @secinfo:	address for the SECINFO data
45  * @flags:	page control flags
46  * @count:	number of bytes added (multiple of the page size)
47  */
48 struct sgx_enclave_add_pages {
49 	__u64 src;
50 	__u64 offset;
51 	__u64 length;
52 	__u64 secinfo;
53 	__u64 flags;
54 	__u64 count;
55 };
56 
57 /**
58  * struct sgx_enclave_init - parameter structure for the
59  *                           %SGX_IOC_ENCLAVE_INIT ioctl
60  * @sigstruct:	address for the SIGSTRUCT data
61  */
62 struct sgx_enclave_init {
63 	__u64 sigstruct;
64 };
65 
66 #endif /* _UAPI_ASM_X86_SGX_H */
67