Re: [PATCH v7 21/22] x86/boot: Move startup code out of __head section

Ard Biesheuvel
2025-09-03T09:21:07Z

On Thu, 28 Aug 2025 at 12:23, Ard Biesheuvel <ardb+git@google.com> wrote:
>
> From: Ard Biesheuvel <ardb@kernel.org>
>
> Move startup code out of the __head section, now that this no longer has
> a special significance. Move everything into .text or .init.text as
> appropriate, so that startup code is not kept around unnecessarily.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> arch/x86/boot/compressed/sev.c | 3 --
> arch/x86/boot/startup/gdt_idt.c | 4 +--
> arch/x86/boot/startup/map_kernel.c | 4 +--
> arch/x86/boot/startup/sev-shared.c | 36 ++++++++++----------
> arch/x86/boot/startup/sev-startup.c | 14 ++++----
> arch/x86/boot/startup/sme.c | 26 +++++++-------
> arch/x86/include/asm/init.h | 6 ----
> arch/x86/kernel/head_32.S | 2 +-
> arch/x86/kernel/head_64.S | 2 +-
> arch/x86/platform/pvh/head.S | 2 +-
> 10 files changed, 45 insertions(+), 54 deletions(-)
>

As reported here [0], this patch needs the next hunk folded in to
avoid breaking CPU hotplug on i386

--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -136,6 +136,9 @@ SYM_CODE_END(startup_32)
* If cpu hotplug is not supported then this code can go in init section
* which will be freed later
*/
+#ifdef CONFIG_HOTPLUG_CPU
+ .text
+#endif
SYM_FUNC_START(startup_32_smp)
cld
movl $(__BOOT_DS),%eax

[0] https://lore.kernel.org/all/202509022207.56fd97f4-lkp@intel.com/T/#u