[PATCH v4 08/15] x86/tdx: Enable shared memory protected guest flags for TDX guest

From
Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Date
2021-08-05 00:53:53
Also in
linux-alpha, linux-doc, linux-mips, linux-pci, lkml, sparclinux
Reply to
Kuppuswamy Sathyanarayanan, 2021-08-05
In TDX guest, since the memory is private to guest, it needs some
extra configuration before sharing any data with VMM. AMD SEV also
implements similar features and hence code can be shared. Currently
memory sharing related code in the kernel is protected by
PATTR_GUEST_MEM_ENCRYPT and PATTR_GUEST_SHARED_MAPPING_INIT flags.
So enable them for TDX guest as well.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
 arch/x86/kernel/tdx.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/tdx.c b/arch/x86/kernel/tdx.c
index 01b758496e84..1cf2443edb90 100644
--- a/arch/x86/kernel/tdx.c
+++ b/arch/x86/kernel/tdx.c
@@ -78,6 +78,8 @@ bool tdx_prot_guest_has(unsigned long flag)
 	switch (flag) {
 	case PATTR_GUEST_TDX:
 	case PATTR_GUEST_UNROLL_STRING_IO:
+	case PATTR_GUEST_MEM_ENCRYPT:
+	case PATTR_GUEST_SHARED_MAPPING_INIT:
 		return cpu_feature_enabled(X86_FEATURE_TDX_GUEST);
 	}
 
-- 
2.25.1
Thread (55 messages) 55 messages, 7 authors, last reply 2021-09-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help