summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/sgx.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2021-11-10 13:01:20 +0300
committerPeter Zijlstra <peterz@infradead.org>2021-12-11 11:09:49 +0300
commit5ce8e39f55521c762f0e6d1bba9597284b1f2e69 (patch)
treee7986c4b43cd54721e3d3f461a6c4b5ff8867499 /arch/x86/include/asm/sgx.h
parentfedb24cda1ca5407e1965b261e349ea85d6c03dc (diff)
downloadlinux-5ce8e39f55521c762f0e6d1bba9597284b1f2e69.tar.xz
x86/sgx: Remove .fixup usage
Create EX_TYPE_FAULT_SGX which does as EX_TYPE_FAULT does, except adds this extra bit that SGX really fancies having. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/20211110101325.961246679@infradead.org
Diffstat (limited to 'arch/x86/include/asm/sgx.h')
-rw-r--r--arch/x86/include/asm/sgx.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h
index 05f3e21f01a7..3f9334ef67cd 100644
--- a/arch/x86/include/asm/sgx.h
+++ b/arch/x86/include/asm/sgx.h
@@ -46,6 +46,24 @@ enum sgx_encls_function {
};
/**
+ * SGX_ENCLS_FAULT_FLAG - flag signifying an ENCLS return code is a trapnr
+ *
+ * ENCLS has its own (positive value) error codes and also generates
+ * ENCLS specific #GP and #PF faults. And the ENCLS values get munged
+ * with system error codes as everything percolates back up the stack.
+ * Unfortunately (for us), we need to precisely identify each unique
+ * error code, e.g. the action taken if EWB fails varies based on the
+ * type of fault and on the exact SGX error code, i.e. we can't simply
+ * convert all faults to -EFAULT.
+ *
+ * To make all three error types coexist, we set bit 30 to identify an
+ * ENCLS fault. Bit 31 (technically bits N:31) is used to differentiate
+ * between positive (faults and SGX error codes) and negative (system
+ * error codes) values.
+ */
+#define SGX_ENCLS_FAULT_FLAG 0x40000000
+
+/**
* enum sgx_return_code - The return code type for ENCLS, ENCLU and ENCLV
* %SGX_NOT_TRACKED: Previous ETRACK's shootdown sequence has not
* been completed yet.