Re: [PATCH v5 5/8] x86/sev: Map only the RMP table entries instead of the full RMP range
From: Borislav Petkov
Date: Mon Nov 04 2024 - 01:29:15 EST
On Mon, Oct 28, 2024 at 02:32:40PM -0500, Tom Lendacky wrote:
> @@ -224,7 +246,14 @@ static int __init snp_rmptable_init(void)
> if (val & MSR_AMD64_SYSCFG_SNP_EN)
> goto skip_enable;
>
> - memset(rmptable_start, 0, probed_rmp_size);
> + /* Zero out the RMP bookkeeping area */
> + if (!init_rmptable_bookkeeping()) {
So let's call it what it is then:
diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
index 5871c924c0b2..8145a7b14fa2 100644
--- a/arch/x86/virt/svm/sev.c
+++ b/arch/x86/virt/svm/sev.c
@@ -173,7 +173,7 @@ void __init snp_fixup_e820_tables(void)
__snp_fixup_e820_tables(probed_rmp_base + probed_rmp_size);
}
-static bool __init init_rmptable_bookkeeping(void)
+static bool __init clear_rmptable_bookkeeping(void)
{
void *bk;
@@ -246,8 +246,7 @@ static int __init snp_rmptable_init(void)
if (val & MSR_AMD64_SYSCFG_SNP_EN)
goto skip_enable;
- /* Zero out the RMP bookkeeping area */
- if (!init_rmptable_bookkeeping()) {
+ if (!clear_rmptable_bookkeeping()) {
memunmap(rmptable_start);
goto nosnp;
}
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette