summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/RiscVVirt/Sec/Memory.c
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2025-03-27 14:30:58 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-05-02 23:38:20 +0000
commitdca5d26bc57ef4a554448e41d302e732bca03d8a (patch)
tree02accd80084aecd0871fd2885c8e96d3f5621b56 /OvmfPkg/RiscVVirt/Sec/Memory.c
parentdd8c272555cb9fed7730acd386d103e287d7e4cd (diff)
downloadedk2-master.tar.gz
edk2-master.tar.bz2
edk2-master.zip
UefiCpuPkg/MpInitLib: Fix SNP AP creation when using known APIC IDsHEADmaster
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.lendacky@amd.com>
Diffstat (limited to 'OvmfPkg/RiscVVirt/Sec/Memory.c')
0 files changed, 0 insertions, 0 deletions