c32210235bf5d3664a6421f955ecaf4130579d76
[linux-2.6-microblaze.git] / arch / x86 / include / uapi / asm / sgx.h
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 #define SGX_IOC_ENCLAVE_PROVISION \
29         _IOW(SGX_MAGIC, 0x03, struct sgx_enclave_provision)
30
31 /**
32  * struct sgx_enclave_create - parameter structure for the
33  *                             %SGX_IOC_ENCLAVE_CREATE ioctl
34  * @src:        address for the SECS page data
35  */
36 struct sgx_enclave_create  {
37         __u64   src;
38 };
39
40 /**
41  * struct sgx_enclave_add_pages - parameter structure for the
42  *                                %SGX_IOC_ENCLAVE_ADD_PAGE ioctl
43  * @src:        start address for the page data
44  * @offset:     starting page offset
45  * @length:     length of the data (multiple of the page size)
46  * @secinfo:    address for the SECINFO data
47  * @flags:      page control flags
48  * @count:      number of bytes added (multiple of the page size)
49  */
50 struct sgx_enclave_add_pages {
51         __u64 src;
52         __u64 offset;
53         __u64 length;
54         __u64 secinfo;
55         __u64 flags;
56         __u64 count;
57 };
58
59 /**
60  * struct sgx_enclave_init - parameter structure for the
61  *                           %SGX_IOC_ENCLAVE_INIT ioctl
62  * @sigstruct:  address for the SIGSTRUCT data
63  */
64 struct sgx_enclave_init {
65         __u64 sigstruct;
66 };
67
68 /**
69  * struct sgx_enclave_provision - parameter structure for the
70  *                                %SGX_IOC_ENCLAVE_PROVISION ioctl
71  * @fd:         file handle of /dev/sgx_provision
72  */
73 struct sgx_enclave_provision {
74         __u64 fd;
75 };
76
77 #endif /* _UAPI_ASM_X86_SGX_H */