x86/sgx: Add wrappers for ENCLS functions
authorJarkko Sakkinen <jarkko@kernel.org>
Thu, 12 Nov 2020 22:01:13 +0000 (00:01 +0200)
committerBorislav Petkov <bp@suse.de>
Tue, 17 Nov 2020 13:36:12 +0000 (14:36 +0100)
commit2c273671d0dfcf89c9c8a319ed093406e3ff665c
tree994d4a33976350a8393bab4fb32e0e358a23f4a3
parent70d3b8ddcd20d3c859676f56c43c7b2360c70266
x86/sgx: Add wrappers for ENCLS functions

ENCLS is the userspace instruction which wraps virtually all
unprivileged SGX functionality for managing enclaves.  It is essentially
the ioctl() of instructions with each function implementing different
SGX-related functionality.

Add macros to wrap the ENCLS functionality. There are two main groups,
one for functions which do not return error codes and a “ret_” set for
those that do.

ENCLS functions are documented in Intel SDM section 36.6.

Co-developed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Jethro Beekman <jethro@fortanix.com>
Link: https://lkml.kernel.org/r/20201112220135.165028-3-jarkko@kernel.org
arch/x86/kernel/cpu/sgx/encls.h [new file with mode: 0644]