Commit a9ef2774 authored by Kirill A. Shutemov's avatar Kirill A. Shutemov Committed by Paolo Bonzini

x86/kvm: Fix SEV check in sev_map_percpu_data()

The function sev_map_percpu_data() checks if it is running on an SEV
platform by checking the CC_ATTR_GUEST_MEM_ENCRYPT attribute. However,
this attribute is also defined for TDX.

To avoid false positives, add a cc_vendor check.
Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fixes: 4d96f910 ("x86/sev: Replace occurrences of sev_active() with cc_platform_has()")
Suggested-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Message-Id: <20240124130317.495519-1-kirill.shutemov@linux.intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent d52734d0
...@@ -434,7 +434,8 @@ static void __init sev_map_percpu_data(void) ...@@ -434,7 +434,8 @@ static void __init sev_map_percpu_data(void)
{ {
int cpu; int cpu;
if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) if (cc_vendor != CC_VENDOR_AMD ||
!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
return; return;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment