NE_ADD_VCPU(9)
π ne_add_vcpu(9) β Kernel API Manual π
okay bestie, welcome to the NE_ADD_VCPU glow-up β¨ this is from the Kernel API Manual and it's literally the ioctl that gives your enclave a vCPU. let's get into it π«Ά
β¨ NAME β¨
NE_ADD_VCPU β the command used to set a vCPU for an enclave π₯
so here's the vibe: the vCPU can either be auto-chosen from the NE CPU pool, or set by the caller β but heads up, if you're picking it yourself it needs to be available in the NE CPU pool. also, full CPU core(s), from the same NUMA node, need(s) to be associated with an enclave. no mixing, no matching, periodt π
the vCPU id is an input / output parameter β iconic behavior honestly. if its value is 0, then a CPU is chosen from the enclave CPU pool and returned via this parameter. the ioctl can be invoked on the enclave fd, before an enclave is started. iykyk π¦
πΈ SYNOPSIS πΈ
NE_ADD_VCPU
π CONTEXT π
Process context. that's it, that's the whole mood π
π RETURN π
0β logic successfully completed. slay, we ate π-1β there was a failure in the ioctl logic. on failure,errnois set to one of these besties:EFAULTβcopy_from_user/copy_to_userfailure πENOMEMβ memory allocation failure for internal bookkeeping variables πEIOβ current task mm is not the same as the one that created the enclave. not the main character, not allowed πNE_ERR_NO_CPUS_AVAIL_IN_POOLβ no CPUs available in the NE CPU pool πNE_ERR_VCPU_ALREADY_USEDβ the provided vCPU is already used. someone got there first, bestie βNE_ERR_VCPU_NOT_IN_CPU_POOLβ the provided vCPU is not available in the NE CPU pool π§NE_ERR_VCPU_INVALID_CPU_COREβ the core id of the provided vCPU is invalid or out of range π«NE_ERR_NOT_IN_INIT_STATEβ the enclave is not in init state (init = before being started) β°NE_ERR_INVALID_VCPUβ the provided vCPU is not in the available CPUs range π- Error codes from the NE PCI device request. (the PCI device said what it said π)
π¦ SEE ALSO π¦
- Kernel file
./include/uapi/linux/nitro_enclaves.h - Nitro Enclaves (NE) Kernel Driver Interface(9)
NE_CREATE_VM(9)NE_GET_IMAGE_LOAD_INFO(9)NE_SET_USER_MEMORY_REGION(9)NE_START_ENCLAVE(9)- NE specific error codes(9)
NE_ERR_VCPU_ALREADY_USED(9)NE_ERR_VCPU_NOT_IN_CPU_POOL(9)NE_ERR_VCPU_INVALID_CPU_CORE(9)NE_ERR_INVALID_MEM_REGION_SIZE(9)NE_ERR_INVALID_MEM_REGION_ADDR(9)NE_ERR_UNALIGNED_MEM_REGION_ADDR(9)NE_ERR_MEM_REGION_ALREADY_USED(9)NE_ERR_MEM_NOT_HUGE_PAGE(9)NE_ERR_MEM_DIFFERENT_NUMA_NODE(9)NE_ERR_MEM_MAX_REGIONS(9)NE_ERR_NO_MEM_REGIONS_ADDED(9)NE_ERR_NO_VCPUS_ADDED(9)NE_ERR_ENCLAVE_MEM_MIN_SIZE(9)NE_ERR_FULL_CORES_NOT_USED(9)NE_ERR_NOT_IN_INIT_STATE(9)NE_ERR_INVALID_VCPU(9)NE_ERR_NO_CPUS_AVAIL_IN_POOL(9)NE_ERR_INVALID_PAGE_SIZE(9)NE_ERR_INVALID_FLAG_VALUE(9)NE_ERR_INVALID_ENCLAVE_CID(9)- Image load info flags(9)
NE_EIF_IMAGE(9)struct ne_image_load_info(9)- User memory region flags(9)
NE_DEFAULT_MEMORY_REGION(9)struct ne_user_memory_region(9)- Enclave start info flags(9)
NE_ENCLAVE_PRODUCTION_MODE(9)NE_ENCLAVE_DEBUG_MODE(9)struct ne_enclave_start_info(9)
π reminder bestie: the vCPU you hand over has to live in the NE CPU pool, on the same NUMA node, and the enclave has to still be in init state. don't come at it with a rogue core, it's not gonna go well π
that's the whole page, no cap π this one ships out of ./include/uapi/linux and the date on it is October 2026 β mwah, go read the whole enclave saga, it's giving lore ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms