public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	 Ard Biesheuvel <ardb@kernel.org>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	 Dionna Amalie Glaze <dionnaglaze@google.com>,
	Kevin Loughlin <kevinloughlin@google.com>
Subject: [RFC PATCH 0/6] x86: Refactor and consolidate startup code
Date: Tue,  1 Apr 2025 15:34:17 +0200	[thread overview]
Message-ID: <20250401133416.1436741-8-ardb+git@google.com> (raw)

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


             reply	other threads:[~2025-04-01 13:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01 13:34 Ard Biesheuvel [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250401133416.1436741-8-ardb+git@google.com \
    --to=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=dionnaglaze@google.com \
    --cc=kevinloughlin@google.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox