[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240408074049.7049-11-vsntk18@gmail.com>
Date: Mon, 8 Apr 2024 09:40:49 +0200
From: vsntk18@...il.com
To: x86@...nel.org
Cc: cfir@...gle.com,
dan.j.williams@...el.com,
dave.hansen@...ux.intel.com,
ebiederm@...ssion.com,
erdemaktas@...gle.com,
hpa@...or.com,
jgross@...e.com,
jroedel@...e.de,
jslaby@...e.cz,
keescook@...omium.org,
kexec@...ts.infradead.org,
kvm@...r.kernel.org,
linux-coco@...ts.linux.dev,
linux-kernel@...r.kernel.org,
luto@...nel.org,
martin.b.radev@...il.com,
mhiramat@...nel.org,
mstunes@...are.com,
nivedita@...m.mit.edu,
peterz@...radead.org,
rientjes@...gle.com,
seanjc@...gle.com,
stable@...r.kernel.org,
thomas.lendacky@....com,
virtualization@...ts.linux-foundation.org,
vkarasulli@...e.de,
ashish.kalra@....com,
michael.roth@....com,
Borislav.Petkov@....com,
Dhaval.Giani@....com
Subject: [PATCH v5 10/10] x86/sev: Exclude AP jump table related code for SEV-SNP guests
From: Vasant Karasulli <vkarasulli@...e.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@...e.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 aa53e8eb4cd5..d915d9158926 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
Powered by blists - more mailing lists