Skip to content

Commit 6d41abe

Browse files
author
Rafael Aquini
committed
x86/kvm: Fix SEV check in sev_map_percpu_data()
JIRA: https://issues.redhat.com/browse/RHEL-84184 This patch is a backport of the following upstream commit: commit a9ef277 Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Date: Wed Jan 24 15:03:17 2024 +0200 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: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Fixes: 4d96f91 ("x86/sev: Replace occurrences of sev_active() with cc_platform_has()") Suggested-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: David Rientjes <rientjes@google.com> Message-Id: <20240124130317.495519-1-kirill.shutemov@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Rafael Aquini <raquini@redhat.com>
1 parent 934ed90 commit 6d41abe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kernel/kvm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ static void __init sev_map_percpu_data(void)
435435
{
436436
int cpu;
437437

438-
if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
438+
if (cc_vendor != CC_VENDOR_AMD ||
439+
!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
439440
return;
440441

441442
for_each_possible_cpu(cpu) {

0 commit comments

Comments
 (0)