]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/apic: Initialize APIC ID for Secure AVIC
authorNeeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Thu, 28 Aug 2025 11:02:41 +0000 (16:32 +0530)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 1 Sep 2025 10:21:55 +0000 (12:21 +0200)
Initialize the APIC ID in the Secure AVIC APIC backing page with the APIC_ID
MSR value read from the hypervisor. CPU topology evaluation later during boot
would catch and report any duplicate APIC ID for two CPUs.

Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tianyu Lan <tiala@microsoft.com>
Link: https://lore.kernel.org/20250828110255.208779-2-Neeraj.Upadhyay@amd.com
arch/x86/kernel/apic/x2apic_savic.c

index 5479605429c1a8fe06a7cf6e769c01bc4ade96c9..56c51ea4e5ab7bce7ebb0aaa43dbad9c18515d00 100644 (file)
@@ -150,6 +150,12 @@ static void savic_setup(void)
        enum es_result res;
        unsigned long gpa;
 
+       /*
+        * Before Secure AVIC is enabled, APIC MSR reads are intercepted.
+        * APIC_ID MSR read returns the value from the hypervisor.
+        */
+       apic_set_reg(ap, APIC_ID, native_apic_msr_read(APIC_ID));
+
        gpa = __pa(ap);
 
        /*