selftests/sgx: Introduce TCS initialization enclave operation
authorReinette Chatre <reinette.chatre@intel.com>
Tue, 10 May 2022 18:09:02 +0000 (11:09 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Thu, 7 Jul 2022 17:13:04 +0000 (10:13 -0700)
commitb564982fda13be6314e49f2344e7c422565e34d3
treedf2b4b9204c3aedf3fb37be02be9e50939c4e97a
parent7eb4370152beb2f1e25543088bce2e3f0621ab81
selftests/sgx: Introduce TCS initialization enclave operation

The Thread Control Structure (TCS) contains meta-data used by the
hardware to save and restore thread specific information when
entering/exiting the enclave. A TCS can be added to an initialized
enclave by first adding a new regular enclave page, initializing the
content of the new page from within the enclave, and then changing that
page's type to a TCS.

Support the initialization of a TCS from within the enclave.
The variable information needed that should be provided from outside
the enclave is the address of the TCS, address of the State Save Area
(SSA), and the entry point that the thread should use to enter the
enclave. With this information provided all needed fields of a TCS
can be initialized.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lkml.kernel.org/r/bad6052056188bde753a54313da1ac8f1e29088a.1652137848.git.reinette.chatre@intel.com
tools/testing/selftests/sgx/defines.h
tools/testing/selftests/sgx/test_encl.c