[PATCH] x86/mm: Check cc_vendor when printing memory encryption info

From: Jeremi Piotrowski
Date: Thu Nov 09 2023 - 11:15:12 EST


Check the value of cc_vendor to see if we're in an Intel TDX protected VM
instead of checking for the TDX_GUEST CPU feature. The rest of the function
already uses the abstractions available in cc_platform.h to check for
confidential computing features. For Intel, cc_vendor is set from
tdx_early_init() or hv_vtom_init(), so the new code correctly handles both
cases. The previous check relied on the Linux-controlled TDX_GUEST CPU feature
which is only set in tdx_early_init().

Signed-off-by: Jeremi Piotrowski <jpiotrowski@xxxxxxxxxxxxxxxxxxx>
---
arch/x86/mm/mem_encrypt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
index c290c55b632b..d3bd39aad8b6 100644
--- a/arch/x86/mm/mem_encrypt.c
+++ b/arch/x86/mm/mem_encrypt.c
@@ -44,7 +44,7 @@ static void print_mem_encrypt_feature_info(void)
{
pr_info("Memory Encryption Features active:");

- if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) {
+ if (cc_vendor == CC_VENDOR_INTEL) {
pr_cont(" Intel TDX\n");
return;
}
--
2.39.2