[kvm-unit-tests RFC PATCH 04/13] x86 AMD SEV-ES: Rename setup_amd_sev_es() to setup_vc_handler()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Re-organize the existing code to include a common helper function
setup_vc_handler() to setup #VC handler that now serves as a common #VC
handler for 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 will be useful
in understanding how UEFI modifies SNP CPUID table and also useful in
studying the behavior of OVMF's IOIO and MSR #VC handlers as well.

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@xxxxxxx>
---
 lib/x86/amd_sev.c | 6 +++++-
 lib/x86/amd_sev.h | 2 +-
 lib/x86/setup.c   | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/x86/amd_sev.c b/lib/x86/amd_sev.c
index 987b59f9d650..ff435c90eeea 100644
--- a/lib/x86/amd_sev.c
+++ b/lib/x86/amd_sev.c
@@ -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;
 	}
diff --git a/lib/x86/amd_sev.h b/lib/x86/amd_sev.h
index efd439fb5036..b5715082284b 100644
--- a/lib/x86/amd_sev.h
+++ b/lib/x86/amd_sev.h
@@ -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);
 
diff --git a/lib/x86/setup.c b/lib/x86/setup.c
index 65f5972adb29..d79a9f86eda4 100644
--- a/lib/x86/setup.c
+++ b/lib/x86/setup.c
@@ -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) {
-- 
2.34.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux