Skip to contentSkip to conversation

x86/sgx: Initialize metadata for Enclave Page Cache (EPC) sections

PATCH Superseded Jarkko Sakkinen 1 participant 1 message Sep 14, 2020

Subsystems (2)

v37 of 40 Superseded Latest is v40 →

lore
Share & tools
lore
#0 lore raw

PATCH v37 8/24 x86/sgx: Initialize metadata for Enclave Page Cache (EPC) sections

From: Sean Christopherson <[email protected]>

Enumerate Enclave Page Cache (EPC) sections via CPUID and add the data structures necessary to track EPC pages so that they can be easily borrowed for different uses.

Embed section index to the first eight bits of the EPC page descriptor. Existing client hardware supports only a single section, while upcoming server hardware will support at most eight sections. Thus, eight bits should be enough for long term needs.

---
 arch/x86/Kconfig                 |  17 +++
 arch/x86/kernel/cpu/Makefile     |   1 +
 arch/x86/kernel/cpu/sgx/Makefile |   2 +
 arch/x86/kernel/cpu/sgx/main.c   | 216 +++++++++++++++++++++++++++++++
 arch/x86/kernel/cpu/sgx/sgx.h    |  52 ++++++++
 5 files changed, 288 insertions(+)
 create mode 100644 arch/x86/kernel/cpu/sgx/Makefile
 create mode 100644 arch/x86/kernel/cpu/sgx/main.c
 create mode 100644 arch/x86/kernel/cpu/sgx/sgx.h
arch/x86/Kconfig +17 -0
index 7101ac64bb20..90fe47577dd7 100644
@@ -1927,6 +1927,23 @@ config X86_INTEL_TSX_MODE_AUTO
 	  side channel attacks- equals the tsx=auto command line parameter.
 endchoice
 
+config INTEL_SGX
+	bool "Intel SGX"
+	depends on X86_64 && CPU_SUP_INTEL
+	depends on CRYPTO=y
+	depends on CRYPTO_SHA256=y
+	select SRCU
+	select MMU_NOTIFIER
+	help
+	  Intel(R) Software Guard eXtensions (SGX) is a set of CPU instructions
+	  that can be used by applications to set aside private regions of code
+	  and data, referred to as enclaves. An enclave's private memory can
+	  only be accessed by code running within the enclave. Accesses from
+	  outside the enclave, including other enclaves, are disallowed by
+	  hardware.
+
+	  If unsure, say N.
+
 config EFI
 	bool "EFI runtime service support"
 	depends on ACPI
arch/x86/kernel/cpu/Makefile +1 -0
index 93792b457b81..c80d804fd02b 100644
@@ -48,6 +48,7 @@ obj-$(CONFIG_X86_MCE)			+= mce/
 obj-$(CONFIG_MTRR)			+= mtrr/
 obj-$(CONFIG_MICROCODE)			+= microcode/
 obj-$(CONFIG_X86_CPU_RESCTRL)		+= resctrl/
+obj-$(CONFIG_INTEL_SGX)			+= sgx/
 
 obj-$(CONFIG_X86_LOCAL_APIC)		+= perfctr-watchdog.o
 
arch/x86/kernel/cpu/sgx/Makefile new file +2 -0
new file mode 100644
index 000000000000..79510ce01b3b
@@ -0,0 +1,2 @@
+obj-y += \
+	main.o
arch/x86/kernel/cpu/sgx/main.c new file +216 -0

216 lines not on this page · raw message

arch/x86/kernel/cpu/sgx/sgx.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.25.1