1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4*4882a593Smuzhiyun */ 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun #ifndef _UAPI_LINUX_NITRO_ENCLAVES_H_ 7*4882a593Smuzhiyun #define _UAPI_LINUX_NITRO_ENCLAVES_H_ 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun #include <linux/types.h> 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun /** 12*4882a593Smuzhiyun * DOC: Nitro Enclaves (NE) Kernel Driver Interface 13*4882a593Smuzhiyun */ 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun /** 16*4882a593Smuzhiyun * NE_CREATE_VM - The command is used to create a slot that is associated with 17*4882a593Smuzhiyun * an enclave VM. 18*4882a593Smuzhiyun * The generated unique slot id is an output parameter. 19*4882a593Smuzhiyun * The ioctl can be invoked on the /dev/nitro_enclaves fd, before 20*4882a593Smuzhiyun * setting any resources, such as memory and vCPUs, for an 21*4882a593Smuzhiyun * enclave. Memory and vCPUs are set for the slot mapped to an enclave. 22*4882a593Smuzhiyun * A NE CPU pool has to be set before calling this function. The 23*4882a593Smuzhiyun * pool can be set after the NE driver load, using 24*4882a593Smuzhiyun * /sys/module/nitro_enclaves/parameters/ne_cpus. 25*4882a593Smuzhiyun * Its format is the detailed in the cpu-lists section: 26*4882a593Smuzhiyun * https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html 27*4882a593Smuzhiyun * CPU 0 and its siblings have to remain available for the 28*4882a593Smuzhiyun * primary / parent VM, so they cannot be set for enclaves. Full 29*4882a593Smuzhiyun * CPU core(s), from the same NUMA node, need(s) to be included 30*4882a593Smuzhiyun * in the CPU pool. 31*4882a593Smuzhiyun * 32*4882a593Smuzhiyun * Context: Process context. 33*4882a593Smuzhiyun * Return: 34*4882a593Smuzhiyun * * Enclave file descriptor - Enclave file descriptor used with 35*4882a593Smuzhiyun * ioctl calls to set vCPUs and memory 36*4882a593Smuzhiyun * regions, then start the enclave. 37*4882a593Smuzhiyun * * -1 - There was a failure in the ioctl logic. 38*4882a593Smuzhiyun * On failure, errno is set to: 39*4882a593Smuzhiyun * * EFAULT - copy_to_user() failure. 40*4882a593Smuzhiyun * * ENOMEM - Memory allocation failure for internal 41*4882a593Smuzhiyun * bookkeeping variables. 42*4882a593Smuzhiyun * * NE_ERR_NO_CPUS_AVAIL_IN_POOL - No NE CPU pool set / no CPUs available 43*4882a593Smuzhiyun * in the pool. 44*4882a593Smuzhiyun * * Error codes from get_unused_fd_flags() and anon_inode_getfile(). 45*4882a593Smuzhiyun * * Error codes from the NE PCI device request. 46*4882a593Smuzhiyun */ 47*4882a593Smuzhiyun #define NE_CREATE_VM _IOR(0xAE, 0x20, __u64) 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun /** 50*4882a593Smuzhiyun * NE_ADD_VCPU - The command is used to set a vCPU for an enclave. The vCPU can 51*4882a593Smuzhiyun * be auto-chosen from the NE CPU pool or it can be set by the 52*4882a593Smuzhiyun * caller, with the note that it needs to be available in the NE 53*4882a593Smuzhiyun * CPU pool. Full CPU core(s), from the same NUMA node, need(s) to 54*4882a593Smuzhiyun * be associated with an enclave. 55*4882a593Smuzhiyun * The vCPU id is an input / output parameter. If its value is 0, 56*4882a593Smuzhiyun * then a CPU is chosen from the enclave CPU pool and returned via 57*4882a593Smuzhiyun * this parameter. 58*4882a593Smuzhiyun * The ioctl can be invoked on the enclave fd, before an enclave 59*4882a593Smuzhiyun * is started. 60*4882a593Smuzhiyun * 61*4882a593Smuzhiyun * Context: Process context. 62*4882a593Smuzhiyun * Return: 63*4882a593Smuzhiyun * * 0 - Logic succesfully completed. 64*4882a593Smuzhiyun * * -1 - There was a failure in the ioctl logic. 65*4882a593Smuzhiyun * On failure, errno is set to: 66*4882a593Smuzhiyun * * EFAULT - copy_from_user() / copy_to_user() failure. 67*4882a593Smuzhiyun * * ENOMEM - Memory allocation failure for internal 68*4882a593Smuzhiyun * bookkeeping variables. 69*4882a593Smuzhiyun * * EIO - Current task mm is not the same as the one 70*4882a593Smuzhiyun * that created the enclave. 71*4882a593Smuzhiyun * * NE_ERR_NO_CPUS_AVAIL_IN_POOL - No CPUs available in the NE CPU pool. 72*4882a593Smuzhiyun * * NE_ERR_VCPU_ALREADY_USED - The provided vCPU is already used. 73*4882a593Smuzhiyun * * NE_ERR_VCPU_NOT_IN_CPU_POOL - The provided vCPU is not available in the 74*4882a593Smuzhiyun * NE CPU pool. 75*4882a593Smuzhiyun * * NE_ERR_VCPU_INVALID_CPU_CORE - The core id of the provided vCPU is invalid 76*4882a593Smuzhiyun * or out of range. 77*4882a593Smuzhiyun * * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state 78*4882a593Smuzhiyun * (init = before being started). 79*4882a593Smuzhiyun * * NE_ERR_INVALID_VCPU - The provided vCPU is not in the available 80*4882a593Smuzhiyun * CPUs range. 81*4882a593Smuzhiyun * * Error codes from the NE PCI device request. 82*4882a593Smuzhiyun */ 83*4882a593Smuzhiyun #define NE_ADD_VCPU _IOWR(0xAE, 0x21, __u32) 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun /** 86*4882a593Smuzhiyun * NE_GET_IMAGE_LOAD_INFO - The command is used to get information needed for 87*4882a593Smuzhiyun * in-memory enclave image loading e.g. offset in 88*4882a593Smuzhiyun * enclave memory to start placing the enclave image. 89*4882a593Smuzhiyun * The image load info is an input / output parameter. 90*4882a593Smuzhiyun * It includes info provided by the caller - flags - 91*4882a593Smuzhiyun * and returns the offset in enclave memory where to 92*4882a593Smuzhiyun * start placing the enclave image. 93*4882a593Smuzhiyun * The ioctl can be invoked on the enclave fd, before 94*4882a593Smuzhiyun * an enclave is started. 95*4882a593Smuzhiyun * 96*4882a593Smuzhiyun * Context: Process context. 97*4882a593Smuzhiyun * Return: 98*4882a593Smuzhiyun * * 0 - Logic succesfully completed. 99*4882a593Smuzhiyun * * -1 - There was a failure in the ioctl logic. 100*4882a593Smuzhiyun * On failure, errno is set to: 101*4882a593Smuzhiyun * * EFAULT - copy_from_user() / copy_to_user() failure. 102*4882a593Smuzhiyun * * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state (init = 103*4882a593Smuzhiyun * before being started). 104*4882a593Smuzhiyun * * NE_ERR_INVALID_FLAG_VALUE - The value of the provided flag is invalid. 105*4882a593Smuzhiyun */ 106*4882a593Smuzhiyun #define NE_GET_IMAGE_LOAD_INFO _IOWR(0xAE, 0x22, struct ne_image_load_info) 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun /** 109*4882a593Smuzhiyun * NE_SET_USER_MEMORY_REGION - The command is used to set a memory region for an 110*4882a593Smuzhiyun * enclave, given the allocated memory from the 111*4882a593Smuzhiyun * userspace. Enclave memory needs to be from the 112*4882a593Smuzhiyun * same NUMA node as the enclave CPUs. 113*4882a593Smuzhiyun * The user memory region is an input parameter. It 114*4882a593Smuzhiyun * includes info provided by the caller - flags, 115*4882a593Smuzhiyun * memory size and userspace address. 116*4882a593Smuzhiyun * The ioctl can be invoked on the enclave fd, 117*4882a593Smuzhiyun * before an enclave is started. 118*4882a593Smuzhiyun * 119*4882a593Smuzhiyun * Context: Process context. 120*4882a593Smuzhiyun * Return: 121*4882a593Smuzhiyun * * 0 - Logic succesfully completed. 122*4882a593Smuzhiyun * * -1 - There was a failure in the ioctl logic. 123*4882a593Smuzhiyun * On failure, errno is set to: 124*4882a593Smuzhiyun * * EFAULT - copy_from_user() failure. 125*4882a593Smuzhiyun * * EINVAL - Invalid physical memory region(s) e.g. 126*4882a593Smuzhiyun * unaligned address. 127*4882a593Smuzhiyun * * EIO - Current task mm is not the same as 128*4882a593Smuzhiyun * the one that created the enclave. 129*4882a593Smuzhiyun * * ENOMEM - Memory allocation failure for internal 130*4882a593Smuzhiyun * bookkeeping variables. 131*4882a593Smuzhiyun * * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state 132*4882a593Smuzhiyun * (init = before being started). 133*4882a593Smuzhiyun * * NE_ERR_INVALID_MEM_REGION_SIZE - The memory size of the region is not 134*4882a593Smuzhiyun * multiple of 2 MiB. 135*4882a593Smuzhiyun * * NE_ERR_INVALID_MEM_REGION_ADDR - Invalid user space address given. 136*4882a593Smuzhiyun * * NE_ERR_UNALIGNED_MEM_REGION_ADDR - Unaligned user space address given. 137*4882a593Smuzhiyun * * NE_ERR_MEM_REGION_ALREADY_USED - The memory region is already used. 138*4882a593Smuzhiyun * * NE_ERR_MEM_NOT_HUGE_PAGE - The memory region is not backed by 139*4882a593Smuzhiyun * huge pages. 140*4882a593Smuzhiyun * * NE_ERR_MEM_DIFFERENT_NUMA_NODE - The memory region is not from the same 141*4882a593Smuzhiyun * NUMA node as the CPUs. 142*4882a593Smuzhiyun * * NE_ERR_MEM_MAX_REGIONS - The number of memory regions set for 143*4882a593Smuzhiyun * the enclave reached maximum. 144*4882a593Smuzhiyun * * NE_ERR_INVALID_PAGE_SIZE - The memory region is not backed by 145*4882a593Smuzhiyun * pages multiple of 2 MiB. 146*4882a593Smuzhiyun * * NE_ERR_INVALID_FLAG_VALUE - The value of the provided flag is invalid. 147*4882a593Smuzhiyun * * Error codes from get_user_pages(). 148*4882a593Smuzhiyun * * Error codes from the NE PCI device request. 149*4882a593Smuzhiyun */ 150*4882a593Smuzhiyun #define NE_SET_USER_MEMORY_REGION _IOW(0xAE, 0x23, struct ne_user_memory_region) 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun /** 153*4882a593Smuzhiyun * NE_START_ENCLAVE - The command is used to trigger enclave start after the 154*4882a593Smuzhiyun * enclave resources, such as memory and CPU, have been set. 155*4882a593Smuzhiyun * The enclave start info is an input / output parameter. It 156*4882a593Smuzhiyun * includes info provided by the caller - enclave cid and 157*4882a593Smuzhiyun * flags - and returns the cid (if input cid is 0). 158*4882a593Smuzhiyun * The ioctl can be invoked on the enclave fd, after an 159*4882a593Smuzhiyun * enclave slot is created and resources, such as memory and 160*4882a593Smuzhiyun * vCPUs are set for an enclave. 161*4882a593Smuzhiyun * 162*4882a593Smuzhiyun * Context: Process context. 163*4882a593Smuzhiyun * Return: 164*4882a593Smuzhiyun * * 0 - Logic succesfully completed. 165*4882a593Smuzhiyun * * -1 - There was a failure in the ioctl logic. 166*4882a593Smuzhiyun * On failure, errno is set to: 167*4882a593Smuzhiyun * * EFAULT - copy_from_user() / copy_to_user() failure. 168*4882a593Smuzhiyun * * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state 169*4882a593Smuzhiyun * (init = before being started). 170*4882a593Smuzhiyun * * NE_ERR_NO_MEM_REGIONS_ADDED - No memory regions are set. 171*4882a593Smuzhiyun * * NE_ERR_NO_VCPUS_ADDED - No vCPUs are set. 172*4882a593Smuzhiyun * * NE_ERR_FULL_CORES_NOT_USED - Full core(s) not set for the enclave. 173*4882a593Smuzhiyun * * NE_ERR_ENCLAVE_MEM_MIN_SIZE - Enclave memory is less than minimum 174*4882a593Smuzhiyun * memory size (64 MiB). 175*4882a593Smuzhiyun * * NE_ERR_INVALID_FLAG_VALUE - The value of the provided flag is invalid. 176*4882a593Smuzhiyun * * NE_ERR_INVALID_ENCLAVE_CID - The provided enclave CID is invalid. 177*4882a593Smuzhiyun * * Error codes from the NE PCI device request. 178*4882a593Smuzhiyun */ 179*4882a593Smuzhiyun #define NE_START_ENCLAVE _IOWR(0xAE, 0x24, struct ne_enclave_start_info) 180*4882a593Smuzhiyun 181*4882a593Smuzhiyun /** 182*4882a593Smuzhiyun * DOC: NE specific error codes 183*4882a593Smuzhiyun */ 184*4882a593Smuzhiyun 185*4882a593Smuzhiyun /** 186*4882a593Smuzhiyun * NE_ERR_VCPU_ALREADY_USED - The provided vCPU is already used. 187*4882a593Smuzhiyun */ 188*4882a593Smuzhiyun #define NE_ERR_VCPU_ALREADY_USED (256) 189*4882a593Smuzhiyun /** 190*4882a593Smuzhiyun * NE_ERR_VCPU_NOT_IN_CPU_POOL - The provided vCPU is not available in the 191*4882a593Smuzhiyun * NE CPU pool. 192*4882a593Smuzhiyun */ 193*4882a593Smuzhiyun #define NE_ERR_VCPU_NOT_IN_CPU_POOL (257) 194*4882a593Smuzhiyun /** 195*4882a593Smuzhiyun * NE_ERR_VCPU_INVALID_CPU_CORE - The core id of the provided vCPU is invalid 196*4882a593Smuzhiyun * or out of range of the NE CPU pool. 197*4882a593Smuzhiyun */ 198*4882a593Smuzhiyun #define NE_ERR_VCPU_INVALID_CPU_CORE (258) 199*4882a593Smuzhiyun /** 200*4882a593Smuzhiyun * NE_ERR_INVALID_MEM_REGION_SIZE - The user space memory region size is not 201*4882a593Smuzhiyun * multiple of 2 MiB. 202*4882a593Smuzhiyun */ 203*4882a593Smuzhiyun #define NE_ERR_INVALID_MEM_REGION_SIZE (259) 204*4882a593Smuzhiyun /** 205*4882a593Smuzhiyun * NE_ERR_INVALID_MEM_REGION_ADDR - The user space memory region address range 206*4882a593Smuzhiyun * is invalid. 207*4882a593Smuzhiyun */ 208*4882a593Smuzhiyun #define NE_ERR_INVALID_MEM_REGION_ADDR (260) 209*4882a593Smuzhiyun /** 210*4882a593Smuzhiyun * NE_ERR_UNALIGNED_MEM_REGION_ADDR - The user space memory region address is 211*4882a593Smuzhiyun * not aligned. 212*4882a593Smuzhiyun */ 213*4882a593Smuzhiyun #define NE_ERR_UNALIGNED_MEM_REGION_ADDR (261) 214*4882a593Smuzhiyun /** 215*4882a593Smuzhiyun * NE_ERR_MEM_REGION_ALREADY_USED - The user space memory region is already used. 216*4882a593Smuzhiyun */ 217*4882a593Smuzhiyun #define NE_ERR_MEM_REGION_ALREADY_USED (262) 218*4882a593Smuzhiyun /** 219*4882a593Smuzhiyun * NE_ERR_MEM_NOT_HUGE_PAGE - The user space memory region is not backed by 220*4882a593Smuzhiyun * contiguous physical huge page(s). 221*4882a593Smuzhiyun */ 222*4882a593Smuzhiyun #define NE_ERR_MEM_NOT_HUGE_PAGE (263) 223*4882a593Smuzhiyun /** 224*4882a593Smuzhiyun * NE_ERR_MEM_DIFFERENT_NUMA_NODE - The user space memory region is backed by 225*4882a593Smuzhiyun * pages from different NUMA nodes than the CPUs. 226*4882a593Smuzhiyun */ 227*4882a593Smuzhiyun #define NE_ERR_MEM_DIFFERENT_NUMA_NODE (264) 228*4882a593Smuzhiyun /** 229*4882a593Smuzhiyun * NE_ERR_MEM_MAX_REGIONS - The supported max memory regions per enclaves has 230*4882a593Smuzhiyun * been reached. 231*4882a593Smuzhiyun */ 232*4882a593Smuzhiyun #define NE_ERR_MEM_MAX_REGIONS (265) 233*4882a593Smuzhiyun /** 234*4882a593Smuzhiyun * NE_ERR_NO_MEM_REGIONS_ADDED - The command to start an enclave is triggered 235*4882a593Smuzhiyun * and no memory regions are added. 236*4882a593Smuzhiyun */ 237*4882a593Smuzhiyun #define NE_ERR_NO_MEM_REGIONS_ADDED (266) 238*4882a593Smuzhiyun /** 239*4882a593Smuzhiyun * NE_ERR_NO_VCPUS_ADDED - The command to start an enclave is triggered and no 240*4882a593Smuzhiyun * vCPUs are added. 241*4882a593Smuzhiyun */ 242*4882a593Smuzhiyun #define NE_ERR_NO_VCPUS_ADDED (267) 243*4882a593Smuzhiyun /** 244*4882a593Smuzhiyun * NE_ERR_ENCLAVE_MEM_MIN_SIZE - The enclave memory size is lower than the 245*4882a593Smuzhiyun * minimum supported. 246*4882a593Smuzhiyun */ 247*4882a593Smuzhiyun #define NE_ERR_ENCLAVE_MEM_MIN_SIZE (268) 248*4882a593Smuzhiyun /** 249*4882a593Smuzhiyun * NE_ERR_FULL_CORES_NOT_USED - The command to start an enclave is triggered and 250*4882a593Smuzhiyun * full CPU cores are not set. 251*4882a593Smuzhiyun */ 252*4882a593Smuzhiyun #define NE_ERR_FULL_CORES_NOT_USED (269) 253*4882a593Smuzhiyun /** 254*4882a593Smuzhiyun * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state when setting 255*4882a593Smuzhiyun * resources or triggering start. 256*4882a593Smuzhiyun */ 257*4882a593Smuzhiyun #define NE_ERR_NOT_IN_INIT_STATE (270) 258*4882a593Smuzhiyun /** 259*4882a593Smuzhiyun * NE_ERR_INVALID_VCPU - The provided vCPU is out of range of the available CPUs. 260*4882a593Smuzhiyun */ 261*4882a593Smuzhiyun #define NE_ERR_INVALID_VCPU (271) 262*4882a593Smuzhiyun /** 263*4882a593Smuzhiyun * NE_ERR_NO_CPUS_AVAIL_IN_POOL - The command to create an enclave is triggered 264*4882a593Smuzhiyun * and no CPUs are available in the pool. 265*4882a593Smuzhiyun */ 266*4882a593Smuzhiyun #define NE_ERR_NO_CPUS_AVAIL_IN_POOL (272) 267*4882a593Smuzhiyun /** 268*4882a593Smuzhiyun * NE_ERR_INVALID_PAGE_SIZE - The user space memory region is not backed by pages 269*4882a593Smuzhiyun * multiple of 2 MiB. 270*4882a593Smuzhiyun */ 271*4882a593Smuzhiyun #define NE_ERR_INVALID_PAGE_SIZE (273) 272*4882a593Smuzhiyun /** 273*4882a593Smuzhiyun * NE_ERR_INVALID_FLAG_VALUE - The provided flag value is invalid. 274*4882a593Smuzhiyun */ 275*4882a593Smuzhiyun #define NE_ERR_INVALID_FLAG_VALUE (274) 276*4882a593Smuzhiyun /** 277*4882a593Smuzhiyun * NE_ERR_INVALID_ENCLAVE_CID - The provided enclave CID is invalid, either 278*4882a593Smuzhiyun * being a well-known value or the CID of the 279*4882a593Smuzhiyun * parent / primary VM. 280*4882a593Smuzhiyun */ 281*4882a593Smuzhiyun #define NE_ERR_INVALID_ENCLAVE_CID (275) 282*4882a593Smuzhiyun 283*4882a593Smuzhiyun /** 284*4882a593Smuzhiyun * DOC: Image load info flags 285*4882a593Smuzhiyun */ 286*4882a593Smuzhiyun 287*4882a593Smuzhiyun /** 288*4882a593Smuzhiyun * NE_EIF_IMAGE - Enclave Image Format (EIF) 289*4882a593Smuzhiyun */ 290*4882a593Smuzhiyun #define NE_EIF_IMAGE (0x01) 291*4882a593Smuzhiyun 292*4882a593Smuzhiyun #define NE_IMAGE_LOAD_MAX_FLAG_VAL (0x02) 293*4882a593Smuzhiyun 294*4882a593Smuzhiyun /** 295*4882a593Smuzhiyun * struct ne_image_load_info - Info necessary for in-memory enclave image 296*4882a593Smuzhiyun * loading (in / out). 297*4882a593Smuzhiyun * @flags: Flags to determine the enclave image type 298*4882a593Smuzhiyun * (e.g. Enclave Image Format - EIF) (in). 299*4882a593Smuzhiyun * @memory_offset: Offset in enclave memory where to start placing the 300*4882a593Smuzhiyun * enclave image (out). 301*4882a593Smuzhiyun */ 302*4882a593Smuzhiyun struct ne_image_load_info { 303*4882a593Smuzhiyun __u64 flags; 304*4882a593Smuzhiyun __u64 memory_offset; 305*4882a593Smuzhiyun }; 306*4882a593Smuzhiyun 307*4882a593Smuzhiyun /** 308*4882a593Smuzhiyun * DOC: User memory region flags 309*4882a593Smuzhiyun */ 310*4882a593Smuzhiyun 311*4882a593Smuzhiyun /** 312*4882a593Smuzhiyun * NE_DEFAULT_MEMORY_REGION - Memory region for enclave general usage. 313*4882a593Smuzhiyun */ 314*4882a593Smuzhiyun #define NE_DEFAULT_MEMORY_REGION (0x00) 315*4882a593Smuzhiyun 316*4882a593Smuzhiyun #define NE_MEMORY_REGION_MAX_FLAG_VAL (0x01) 317*4882a593Smuzhiyun 318*4882a593Smuzhiyun /** 319*4882a593Smuzhiyun * struct ne_user_memory_region - Memory region to be set for an enclave (in). 320*4882a593Smuzhiyun * @flags: Flags to determine the usage for the memory region (in). 321*4882a593Smuzhiyun * @memory_size: The size, in bytes, of the memory region to be set for 322*4882a593Smuzhiyun * an enclave (in). 323*4882a593Smuzhiyun * @userspace_addr: The start address of the userspace allocated memory of 324*4882a593Smuzhiyun * the memory region to set for an enclave (in). 325*4882a593Smuzhiyun */ 326*4882a593Smuzhiyun struct ne_user_memory_region { 327*4882a593Smuzhiyun __u64 flags; 328*4882a593Smuzhiyun __u64 memory_size; 329*4882a593Smuzhiyun __u64 userspace_addr; 330*4882a593Smuzhiyun }; 331*4882a593Smuzhiyun 332*4882a593Smuzhiyun /** 333*4882a593Smuzhiyun * DOC: Enclave start info flags 334*4882a593Smuzhiyun */ 335*4882a593Smuzhiyun 336*4882a593Smuzhiyun /** 337*4882a593Smuzhiyun * NE_ENCLAVE_PRODUCTION_MODE - Start enclave in production mode. 338*4882a593Smuzhiyun */ 339*4882a593Smuzhiyun #define NE_ENCLAVE_PRODUCTION_MODE (0x00) 340*4882a593Smuzhiyun /** 341*4882a593Smuzhiyun * NE_ENCLAVE_DEBUG_MODE - Start enclave in debug mode. 342*4882a593Smuzhiyun */ 343*4882a593Smuzhiyun #define NE_ENCLAVE_DEBUG_MODE (0x01) 344*4882a593Smuzhiyun 345*4882a593Smuzhiyun #define NE_ENCLAVE_START_MAX_FLAG_VAL (0x02) 346*4882a593Smuzhiyun 347*4882a593Smuzhiyun /** 348*4882a593Smuzhiyun * struct ne_enclave_start_info - Setup info necessary for enclave start (in / out). 349*4882a593Smuzhiyun * @flags: Flags for the enclave to start with (e.g. debug mode) (in). 350*4882a593Smuzhiyun * @enclave_cid: Context ID (CID) for the enclave vsock device. If 0 as 351*4882a593Smuzhiyun * input, the CID is autogenerated by the hypervisor and 352*4882a593Smuzhiyun * returned back as output by the driver (in / out). 353*4882a593Smuzhiyun */ 354*4882a593Smuzhiyun struct ne_enclave_start_info { 355*4882a593Smuzhiyun __u64 flags; 356*4882a593Smuzhiyun __u64 enclave_cid; 357*4882a593Smuzhiyun }; 358*4882a593Smuzhiyun 359*4882a593Smuzhiyun #endif /* _UAPI_LINUX_NITRO_ENCLAVES_H_ */ 360