summaryrefslogtreecommitdiffstats
path: root/hw/i386
diff options
context:
space:
mode:
authorPaolo Bonzini2021-02-08 15:04:52 +0100
committerPaolo Bonzini2021-02-16 17:15:39 +0100
commitb2f73a0784b7a5eae2022ccf3293792bd008cc64 (patch)
treea47b15d77a93f19b58cd3f16a3e215ed4213981e /hw/i386
parentsev/i386: Require in-kernel irqchip support for SEV-ES guests (diff)
downloadqemu-b2f73a0784b7a5eae2022ccf3293792bd008cc64.tar.gz
qemu-b2f73a0784b7a5eae2022ccf3293792bd008cc64.tar.xz
qemu-b2f73a0784b7a5eae2022ccf3293792bd008cc64.zip
sev/i386: Allow AP booting under SEV-ES
When SEV-ES is enabled, it is not possible modify the guests register state after it has been initially created, encrypted and measured. Normally, an INIT-SIPI-SIPI request is used to boot the AP. However, the hypervisor cannot emulate this because it cannot update the AP register state. For the very first boot by an AP, the reset vector CS segment value and the EIP value must be programmed before the register has been encrypted and measured. Search the guest firmware for the guest for a specific GUID that tells Qemu the value of the reset vector to use. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Cc: Richard Henderson <richard.henderson@linaro.org> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Message-Id: <22db2bfb4d6551aed661a9ae95b4fdbef613ca21.1611682609.git.thomas.lendacky@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/pc_sysfw.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 6404b5a86f..9fe72b370e 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -256,6 +256,7 @@ static void pc_system_flash_map(PCMachineState *pcms,
MemoryRegion *flash_mem;
void *flash_ptr;
int flash_size;
+ int ret;
assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled);
@@ -308,6 +309,13 @@ static void pc_system_flash_map(PCMachineState *pcms,
* search for them
*/
pc_system_parse_ovmf_flash(flash_ptr, flash_size);
+
+ ret = sev_es_save_reset_vector(flash_ptr, flash_size);
+ if (ret) {
+ error_report("failed to locate and/or save reset vector");
+ exit(1);
+ }
+
sev_encrypt_flash(flash_ptr, flash_size, &error_fatal);
}
}