@@ -89,12 +89,16 @@ bool amd_sev_es_enabled(void)
return sev_es_enabled;
}
-efi_status_t setup_amd_sev_es(void)
+efi_status_t setup_vc_handler(void)
{
struct descriptor_table_ptr idtr;
idt_entry_t *idt;
idt_entry_t vc_handler_idt;
+ /*
+ * If AMD SEV-SNP is enabled, then SEV-ES is also enabled, so
+ * checking for SEV-ES covers both.
+ */
if (!amd_sev_es_enabled()) {
return EFI_UNSUPPORTED;
}
@@ -139,7 +139,7 @@ efi_status_t setup_amd_sev(void);
#define SEV_ES_GHCB_MSR_INDEX 0xc0010130
bool amd_sev_es_enabled(void);
-efi_status_t setup_amd_sev_es(void);
+efi_status_t setup_vc_handler(void);
void setup_ghcb_pte(pgd_t *page_table);
void handle_sev_es_vc(struct ex_regs *regs);
@@ -334,7 +334,7 @@ efi_status_t setup_efi(efi_bootinfo_t *efi_bootinfo)
/* Continue if AMD SEV is not supported, but skip SEV-ES setup */
if (status == EFI_SUCCESS) {
phase = "AMD SEV-ES";
- status = setup_amd_sev_es();
+ status = setup_vc_handler();
}
if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED) {
Re-organize the existing code to include a common helper function setup_vc_handler() to setup #VC handler that applies to both SEV-ES and SEV-SNP guests. On configuring KUT with --amdsev-efi-vc flag, This setup_vc_handler() continues to re-use UEFI's #VC handler. This is useful since it allows some KUT SNP tests to exercise aspects of OVMF's #VC handler support in addition to testing hypervisor support. However, if one prefers using SEV-ES/SNP's #VC handler, then --amdsev-efi-vc flag should not be passed during configuration. No functional change has been introduced in this patch. Signed-off-by: Pavan Kumar Paluri <papaluri@amd.com> --- lib/x86/amd_sev.c | 6 +++++- lib/x86/amd_sev.h | 2 +- lib/x86/setup.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-)