Thread (61 messages) 61 messages, 6 authors, 2021-03-10

Re: [PATCH 02/25] x86/cpufeatures: Add SGX1 and SGX2 sub-features

From: Kai Huang <hidden>
Date: 2021-03-01 10:22:28
Also in: lkml

On Mon, 2021-03-01 at 11:00 +0100, Borislav Petkov wrote:
On Mon, Mar 01, 2021 at 10:44:29PM +1300, Kai Huang wrote:
quoted
From: Sean Christopherson <seanjc@google.com>

Add SGX1 and SGX2 feature flags, via CPUID.0x12.0x0.EAX, as scattered
features, since adding a new leaf for only two bits would be wasteful.
As part of virtualizing SGX, KVM will expose the SGX CPUID leafs to its
guest, and to do so correctly needs to query hardware and kernel support
for SGX1 and SGX2.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Acked-by: Dave Hansen <redacted>
Signed-off-by: Kai Huang <redacted>
---
 arch/x86/include/asm/cpufeatures.h | 2 ++
 arch/x86/kernel/cpu/cpuid-deps.c   | 2 ++
 arch/x86/kernel/cpu/scattered.c    | 2 ++
 3 files changed, 6 insertions(+)
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index cc96e26d69f7..9502c445a3e9 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -290,6 +290,8 @@
 #define X86_FEATURE_FENCE_SWAPGS_KERNEL	(11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */
 #define X86_FEATURE_SPLIT_LOCK_DETECT	(11*32+ 6) /* #AC for split lock */
 #define X86_FEATURE_PER_THREAD_MBA	(11*32+ 7) /* "" Per-thread Memory Bandwidth Allocation */
+#define X86_FEATURE_SGX1		(11*32+ 8) /* "" Basic SGX */
+#define X86_FEATURE_SGX2        	(11*32+ 9) /* SGX Enclave Dynamic Memory Management (EDMM) */
"sgx1" is not gonna show in /proc/cpuinfo but "sgx2" will. Because...?
There's already X86_FEATURE_SGX, which shows "sgx" in /proc/cpuinfo. Showing "sgx1"
doesn't add anything. "sgx2" is useful because it adds additional functionality.

Both Sean and Paolo suggested this. Please see below discussion:

https://www.spinics.net/lists/kvm/msg234533.html
Also, you send a patchset once a week - not after two days. Please limit
your spamming.
OK. Thanks for reminding.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help