[PATCH v6 10/10] x86/sev: Exclude AP jump table related code for SEV-SNP guests
vsntk18 at gmail.com
vsntk18 at gmail.com
Mon Jun 10 03:21:13 PDT 2024
From: Vasant Karasulli <vkarasulli at suse.de>
Unlike SEV-ES, AP jump table technique is not used in SEV-SNP
when transitioning from one layer of code to another
(e.g. when going from UEFI to the OS).
Signed-off-by: Vasant Karasulli <vkarasulli at suse.de>
---
arch/x86/kernel/sev.c | 6 +++++-
arch/x86/realmode/init.c | 5 +++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index e64320507da2..a9cf74512269 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -1392,7 +1392,8 @@ STACK_FRAME_NON_STANDARD(sev_jumptable_ap_park);
void sev_es_stop_this_cpu(void)
{
if (!(cc_vendor == CC_VENDOR_AMD) ||
- !cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT))
+ !cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT) ||
+ cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
return;
/* Only park in the AP jump table when the code has been installed */
@@ -1468,6 +1469,9 @@ bool sev_kexec_supported(void)
if (!cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT))
return true;
+ if (cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
+ return false;
+
/*
* KEXEC with SEV-ES and more than one CPU is only supported
* when the AP jump table is installed.
diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
index f9bc444a3064..ed798939be5d 100644
--- a/arch/x86/realmode/init.c
+++ b/arch/x86/realmode/init.c
@@ -80,8 +80,9 @@ static void __init sme_sev_setup_real_mode(struct trampoline_header *th)
*/
th->start = (u64) secondary_startup_64_no_verify;
- if (sev_es_setup_ap_jump_table(real_mode_header))
- panic("Failed to get/update SEV-ES AP Jump Table");
+ if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
+ if (sev_es_setup_ap_jump_table(real_mode_header))
+ panic("Failed to get/update SEV-ES AP Jump Table");
}
#endif
}
--
2.34.1
More information about the kexec
mailing list