From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: x86@kernel.org, mingo@kernel.org, linux-kernel@vger.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: [PATCH v3 0/7] x86: Refactor and consolidate startup code
Date: Tue, 8 Apr 2025 10:52:55 +0200 [thread overview]
Message-ID: <20250408085254.836788-9-ardb+git@google.com> (raw)
From: Ard Biesheuvel <ardb@kernel.org>
Reorganize C code that is used during early boot, either in the
decompressor/EFI stub or the kernel proper, but before the kernel
virtual mapping is up.
v3:
- keep rip_rel_ptr() around in PIC code - sadly, it is still needed in
some cases
- remove RIP_REL_REF() uses in separate patches
- keep __head annotations for now, they will all be removed later
- disable objtool validation for library objects (i.e., pieces that are
not linked into vmlinux)
I will follow up with a series that gets rid of .head.text altogether,
as it will no longer be needed at all once the startup code is checked
for absolute relocations.
The SEV startup code needs to be moved first, though, and this is a bit
more complicated, so I will decouple that effort from this series, also
because there is a known issue that needs to be fixed first related to
memory acceptance from the EFI stub.
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Dionna Amalie Glaze <dionnaglaze@google.com>
Cc: Kevin Loughlin <kevinloughlin@google.com>
Ard Biesheuvel (7):
x86/boot/startup: Disable objtool validation for library code
x86/asm: Make rip_rel_ptr() usable from fPIC code
x86/boot: Move the early GDT/IDT setup code into startup/
x86/boot: Move early kernel mapping code into startup/
x86/boot: Drop RIP_REL_REF() uses from early mapping code
x86/boot: Move early SME init code into startup/
x86/boot: Drop RIP_REL_REF() uses from SME startup code
arch/x86/boot/compressed/Makefile | 2 +-
arch/x86/boot/startup/Makefile | 22 ++
arch/x86/boot/startup/gdt_idt.c | 83 ++++++
arch/x86/boot/startup/map_kernel.c | 225 ++++++++++++++++
arch/x86/{mm/mem_encrypt_identity.c => boot/startup/sme.c} | 19 +-
arch/x86/coco/sev/core.c | 2 +-
arch/x86/coco/sev/shared.c | 4 +-
arch/x86/include/asm/asm.h | 2 +-
arch/x86/include/asm/coco.h | 2 +-
arch/x86/include/asm/mem_encrypt.h | 2 +-
arch/x86/kernel/head64.c | 285 +-------------------
arch/x86/mm/Makefile | 6 -
12 files changed, 346 insertions(+), 308 deletions(-)
create mode 100644 arch/x86/boot/startup/gdt_idt.c
create mode 100644 arch/x86/boot/startup/map_kernel.c
rename arch/x86/{mm/mem_encrypt_identity.c => boot/startup/sme.c} (97%)
base-commit: 4f2d1bbc2c92a32fd612e6c3b51832d5c1c3678e
--
2.49.0.504.g3bcea36a83-goog
next reply other threads:[~2025-04-08 8:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 8:52 Ard Biesheuvel [this message]
2025-04-08 8:52 ` [PATCH v3 1/7] x86/boot/startup: Disable objtool validation for library code Ard Biesheuvel
2025-04-09 8:15 ` Borah, Chaitanya Kumar
2025-04-09 9:53 ` Ingo Molnar
2025-04-08 8:52 ` [PATCH v3 2/7] x86/asm: Make rip_rel_ptr() usable from fPIC code Ard Biesheuvel
2025-04-08 8:52 ` [PATCH v3 3/7] x86/boot: Move the early GDT/IDT setup code into startup/ Ard Biesheuvel
2025-04-09 10:05 ` Ingo Molnar
2025-04-09 10:07 ` Ingo Molnar
2025-04-09 11:42 ` Ard Biesheuvel
2025-04-09 12:01 ` Ingo Molnar
2025-04-08 8:52 ` [PATCH v3 4/7] x86/boot: Move early kernel mapping " Ard Biesheuvel
2025-04-08 8:53 ` [PATCH v3 5/7] x86/boot: Drop RIP_REL_REF() uses from early mapping code Ard Biesheuvel
2025-04-08 8:53 ` [PATCH v3 6/7] x86/boot: Move early SME init code into startup/ Ard Biesheuvel
2025-04-08 8:53 ` [PATCH v3 7/7] x86/boot: Drop RIP_REL_REF() uses from SME startup code Ard Biesheuvel
2025-04-08 18:16 ` [PATCH v3 0/7] x86: Refactor and consolidate " Brian Gerst
2025-04-09 6:47 ` 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=20250408085254.836788-9-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=mingo@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;
as well as URLs for NNTP newsgroup(s).