public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] x86: Refactor and consolidate startup code
@ 2025-04-01 13:34 Ard Biesheuvel
  2025-04-01 13:34 ` [RFC PATCH 1/6] x86/boot/compressed: Merge local pgtable.h include into asm/boot.h Ard Biesheuvel
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Ard Biesheuvel @ 2025-04-01 13:34 UTC (permalink / raw)
  To: linux-efi
  Cc: linux-kernel, x86, Ard Biesheuvel, Tom Lendacky,
	Dionna Amalie Glaze, Kevin Loughlin

From: Ard Biesheuvel <ardb@kernel.org>

Start refactoring the x86 startup code so we keep all the code that is
shared between different boot stages (EFI stub, decompressor, early
startup in the core kernel *) and/or needs to be built in a special way
(due to the fact that it is C code that runs from the 1:1 mapping of
RAM) in a single place, sharing all the C flags and other runes that are
needed to disable instrumentation, sanitizers, etc.

This is an RFC so I have left some things for later, e.g., the SEV-SNP
init code in arch/x86/coco that is shared between all of the above [*]
and will be tricky to disentangle; there are also some known issues in
that code related to EFI boot that we are addressing in parallel.

Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Dionna Amalie Glaze <dionnaglaze@google.com>
Cc: Kevin Loughlin <kevinloughlin@google.com>

Ard Biesheuvel (6):
  x86/boot/compressed: Merge local pgtable.h include into asm/boot.h
  x86/boot: Move 5-level paging trampoline into startup code
  x86/boot: Move EFI mixed mode startup code back under arch/x86
  x86/boot: Move early GDT/IDT setup code into startup/
  x86/boot: Move early kernel mapping code into startup/
  x86/boot: Move early SME init code into startup/

 arch/x86/Makefile                                                             |   1 +
 arch/x86/boot/compressed/Makefile                                             |   4 +-
 arch/x86/boot/compressed/head_64.S                                            |   1 -
 arch/x86/boot/compressed/misc.c                                               |   1 -
 arch/x86/boot/compressed/pgtable.h                                            |  18 --
 arch/x86/boot/compressed/pgtable_64.c                                         |   1 -
 arch/x86/boot/startup/Makefile                                                |  22 ++
 drivers/firmware/efi/libstub/x86-mixed.S => arch/x86/boot/startup/efi-mixed.S |   0
 arch/x86/boot/startup/gdt_idt.c                                               |  82 ++++++
 arch/x86/boot/{compressed => startup}/la57toggle.S                            |   1 -
 arch/x86/boot/startup/map_kernel.c                                            | 232 +++++++++++++++
 arch/x86/{mm/mem_encrypt_identity.c => boot/startup/sme.c}                    |  45 ++-
 arch/x86/include/asm/boot.h                                                   |  10 +
 arch/x86/include/asm/mem_encrypt.h                                            |   2 +-
 arch/x86/kernel/head64.c                                                      | 302 +-------------------
 arch/x86/mm/Makefile                                                          |   6 -
 drivers/firmware/efi/libstub/Makefile                                         |   1 -
 17 files changed, 372 insertions(+), 357 deletions(-)
 delete mode 100644 arch/x86/boot/compressed/pgtable.h
 create mode 100644 arch/x86/boot/startup/Makefile
 rename drivers/firmware/efi/libstub/x86-mixed.S => arch/x86/boot/startup/efi-mixed.S (100%)
 create mode 100644 arch/x86/boot/startup/gdt_idt.c
 rename arch/x86/boot/{compressed => startup}/la57toggle.S (99%)
 create mode 100644 arch/x86/boot/startup/map_kernel.c
 rename arch/x86/{mm/mem_encrypt_identity.c => boot/startup/sme.c} (92%)

-- 
2.49.0.472.ge94155a9ec-goog


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2025-04-09 12:00 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 13:34 [RFC PATCH 0/6] x86: Refactor and consolidate startup code Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 1/6] x86/boot/compressed: Merge local pgtable.h include into asm/boot.h Ard Biesheuvel
2025-04-06 18:33   ` [tip: x86/boot] x86/boot/compressed: Merge the local pgtable.h include into <asm/boot.h> tip-bot2 for Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 2/6] x86/boot: Move 5-level paging trampoline into startup code Ard Biesheuvel
2025-04-06 18:33   ` [tip: x86/boot] x86/boot: Move the 5-level paging trampoline into /startup tip-bot2 for Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 3/6] x86/boot: Move EFI mixed mode startup code back under arch/x86 Ard Biesheuvel
2025-04-06 18:33   ` [tip: x86/boot] x86/boot: Move the EFI mixed mode startup code back under arch/x86, into startup/ tip-bot2 for Ard Biesheuvel
2025-04-07  7:38     ` Aithal, Srikanth
2025-04-07  8:30       ` Ard Biesheuvel
2025-04-07  9:41         ` Aithal, Srikanth
2025-04-09 11:54           ` Aithal, Srikanth
2025-04-09 12:00             ` Ingo Molnar
2025-04-01 13:34 ` [RFC PATCH 4/6] x86/boot: Move early GDT/IDT setup code " Ard Biesheuvel
2025-04-06 18:33   ` [tip: x86/boot] x86/boot: Move the " tip-bot2 for Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 5/6] x86/boot: Move early kernel mapping " Ard Biesheuvel
2025-04-06 18:32   ` [tip: x86/boot] x86/boot: Move the " tip-bot2 for Ard Biesheuvel
2025-04-06 18:51   ` [RFC PATCH 5/6] x86/boot: Move " Ingo Molnar
2025-04-06 19:24     ` Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 6/6] x86/boot: Move early SME init " Ard Biesheuvel
2025-04-06 18:32   ` [tip: x86/boot] x86/boot: Move the " tip-bot2 for Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox