From: Sean Christopherson <seanjc@xxxxxxxxxx> Skip the SEV-ES setup if SEV is unsupported. Also update the printf to include error codes. Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- lib/x86/setup.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/x86/setup.c b/lib/x86/setup.c index 86ff400..68ee74c 100644 --- a/lib/x86/setup.c +++ b/lib/x86/setup.c @@ -300,29 +300,24 @@ efi_status_t setup_efi(efi_bootinfo_t *efi_bootinfo) } status = setup_amd_sev(); + /* Continue if AMD SEV is not supported, but skip SEV-ES setup */ + if (status == EFI_UNSUPPORTED) { + goto continue_setup_after_sev; + } + if (status != EFI_SUCCESS) { - switch (status) { - case EFI_UNSUPPORTED: - /* Continue if AMD SEV is not supported */ - break; - default: - printf("Set up AMD SEV failed\n"); - return status; - } + printf("AMD SEV setup failed, error = 0x%lx\n", status); + return status; } status = setup_amd_sev_es(); - if (status != EFI_SUCCESS) { - switch (status) { - case EFI_UNSUPPORTED: - /* Continue if AMD SEV-ES is not supported */ - break; - default: - printf("Set up AMD SEV-ES failed\n"); - return status; - } + if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED) { + printf("AMD SEV-ES setup failed, error = 0x%lx\n", status); + return status; } +continue_setup_after_sev: + reset_apic(); setup_gdt_tss(); setup_idt(); -- 2.33.0