Re: [PATCH v8 12/17] x86/e820: temporarily enable KHO scratch for memory below 1M

Mike Rapoport
2025-11-25T13:53:22Z

On Mon, Nov 24, 2025 at 04:56:34PM -0800, H. Peter Anvin wrote:
> On November 24, 2025 11:24:58 AM PST, Usama Arif <usamaarif642@gmail.com> wrote:
>
> >diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
> >index 88be32026768c..1cd80293a3e23 100644
> >--- a/arch/x86/realmode/init.c
> >+++ b/arch/x86/realmode/init.c
> >@@ -66,8 +66,9 @@ void __init reserve_real_mode(void)
> > * setup_arch().
> > */
> > memblock_reserve(0, SZ_1M);
> >-
> >+#ifdef CONFIG_MEMBLOCK_KHO_SCRATCH
> > memblock_clear_kho_scratch(0, SZ_1M);
> >+#endif
> > }
> >
> > static void __init sme_sev_setup_real_mode(struct trampoline_header *th)
>
> What does "scratch" mean in this exact context? (Sorry, don't have the code in front of me.)

In this context it's the memory kexec handover used to bootstrap the
kexec'ed kernel. Everything beyond these scratch areas could contain
preserved data and kexec handover limits all early memory allocations to
these scratch areas.

--
Sincerely yours,
Mike.