NE_ADD_VCPU(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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, errno is set to one of these besties:
    • EFAULT β€” copy_from_user / copy_to_user failure 😭
    • 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 πŸ¦‹


πŸ’– 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