Branch: refs/heads/master Home: https://github.com/tianocore/edk2 Commit: dca5d26bc57ef4a554448e41d302e732bca03d8a https://github.com/tianocore/edk2/commit/dca5d26bc57ef4a554448e41d302e732bca03d8a Author: Tom Lendacky <thomas.lenda...@amd.com> Date: 2025-05-02 (Fri, 02 May 2025)
Changed paths: M UefiCpuPkg/Library/MpInitLib/AmdSev.c M UefiCpuPkg/Library/MpInitLib/MpEqu.inc M UefiCpuPkg/Library/MpInitLib/MpLib.h M UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c M UefiCpuPkg/Library/MpInitLib/X64/AmdSev.nasm M UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm Log Message: ----------- UefiCpuPkg/MpInitLib: Fix SNP AP creation when using known APIC IDs A typical initial AP boot up will choose a CpuNumber based on the ApIndex value that it gets back after a locked increment of the ApIndex value. The ApIndex to APIC ID relationship is random, which is not an issue when a broadcast INIT-SIPI is performed. With SNP and a hypervisor that supports retrieval of the known APIC IDs, the broadcast INIT-SIPI method is replaced by waking each individual vCPU. In this situation, a specific VMSA is associated with a specific APIC ID. However, random assignment of an ApIndex can break this association. This isn't typically an issue, because the AP bring-up finishes with the AP issuing a HLT instruction, which is intercepted by the hypervisor and the AP won't run again until the next INIT-SIPI. However, when HLT isn't intercepted by the hypervisor (Qemu '-overcommit cpu-pm=on' parameter), then the HLT does not exit to the hypervisor. On the next INIT-SIPI, it can happen that a VMRUN is executed with a different VMSA address than was originally used, and if that VMSA is still in a VMRUN on another AP, then the executing VMRUN will fail, crashing the guest. To fix this issue, add a CPU exchange info field, SevSnpKnownInitApicId, that indicates the APs are starting with an already known initial APIC ID and set the initial APIC ID and APIC ID in the CPU_INFO_IN_HOB HOB. During AP boot, the SevSnpKnownInitApicId field will result in the CpuNumber being set to the index with a matching APIC ID (similar to AP booting when the InitFlag != ApInitConfig). Signed-off-by: Tom Lendacky <thomas.lenda...@amd.com> To unsubscribe from these emails, change your notification settings at https://github.com/tianocore/edk2/settings/notifications _______________________________________________ edk2-commits mailing list edk2-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-commits