Skip to content

x86: Confine early 1:1 mapped startup code

Ard Biesheuvel lkml 6 versions – Applied

Status from this message: The following commit has been merged into the x86/boot branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest9 patches 28 repliesApplied
  2. v610 patches 3 repliesSuperseded
  3. v516 patches 2 repliesApplied
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v411 patches25 repliesSuperseded
v319 patches28 repliesApplied
v217 patches3 repliesSuperseded

Changes in v7 from the cover letter

- Drop flawed patch to move some SME/SEV related calls out of the early boot path to avoid the potential need for backporting patches #6/#7 to kernels where SEV support may not be crucial. This problem will be dealt with if/when it arises while doing those backports.

Patches in v7 Applied

#Subject and filesSizeRepliesApplied
1/9x86/startup_64: Simplify CR4 handling in startup codearch/x86/kernel/head_64.S+12 -182 replies
2/9x86/startup_64: Defer assignment of 5-level paging global variablesarch/x86/include/asm/pgtable_64_types.h arch/x86/kernel/head64.c+15 -319 replies
3/9x86/startup_64: Simplify calculation of initial page table addressarch/x86/kernel/head_64.S+7 -181 reply
4/9x86/startup_64: Simplify virtual switch on primary bootarch/x86/kernel/head_64.S+21 -213 replies
5/9efi/libstub: Add generic support for parsing mem_encrypt=drivers/firmware/efi/libstub/efi-stub-helper.c drivers/firmware/efi/libstub/efistub.h+9 -11 reply
6/9x86/boot: Move mem_encrypt= parsing to the decompressorarch/x86/boot/compressed/misc.c arch/x86/include/uapi/asm/bootparam.h arch/x86/lib/Makefile +2 more+22 -423 replies
7/9x86/sme: Move early SME kernel encryption handling into .head.textarch/x86/include/asm/mem_encrypt.h arch/x86/mm/mem_encrypt_identity.c+21 -290 replies
8/9x86/sev: Move early startup code into .head.text sectionarch/x86/boot/compressed/sev.c arch/x86/include/asm/sev.h arch/x86/kernel/sev-shared.c +1 more+26 -240 replies
9/9x86/startup_64: Drop global variables keeping track of LA57 statearch/x86/boot/compressed/misc.h arch/x86/boot/compressed/pgtable_64.c arch/x86/boot/compressed/vmlinux.lds.S +5 more+25 -825 replies

Reviews trailers per patch

4 of 9 patches have a Reviewed-by or Acked-by.

PatchBorislav Petkov (AMD)Tom Lendacky
SeriesT-b
1/9
2/9R-b
3/9R-b
4/9R-b
5/9R-b
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/9] x86: Confine early 1:1 mapped startup code

From: Ard Biesheuvel <[email protected]>

This is resend #2 of v5 [0] with some touchups applied.

Changes since v6:
- Drop flawed patch to move some SME/SEV related calls out of the early boot path to avoid the potential need for backporting patches #6/#7 to kernels where SEV support may not be crucial. This problem will be dealt with if/when it arises while doing those backports.

Changes since v5:
- drop patches that have been merged
- rebase onto latest tip/x86/boot
- fix comment regarding CR4.PGE wrt flushing of global TLB entries
- avoid adding startup code to .noinstr.text as it triggers objtool warnings

[0] https://lore.kernel.org/all/[email protected]/

Cc Kevin Loughlin <[email protected]>
Cc Tom Lendacky <[email protected]>
Cc Dionna Glaze <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Brian Gerst <[email protected]>

Ard Biesheuvel (9):
x86/startup_64: Simplify CR4 handling in startup code x86/startup_64: Defer assignment of 5-level paging global variables x86/startup_64: Simplify calculation of initial page table address x86/startup_64: Simplify virtual switch on primary boot efi/libstub: Add generic support for parsing mem_encrypt= x86/boot: Move mem_encrypt= parsing to the decompressor x86/sme: Move early SME kernel encryption handling into .head.text x86/sev: Move early startup code into .head.text section x86/startup_64: Drop global variables keeping track of LA57 state

 arch/x86/boot/compressed/misc.c                | 15 ++++
 arch/x86/boot/compressed/misc.h                |  4 -
 arch/x86/boot/compressed/pgtable_64.c          | 12 ---
 arch/x86/boot/compressed/sev.c                 |  3 +
 arch/x86/boot/compressed/vmlinux.lds.S         |  1 +
 arch/x86/include/asm/mem_encrypt.h             |  8 +-
 arch/x86/include/asm/pgtable_64_types.h        | 43 ++++-----
 arch/x86/include/asm/sev.h                     | 10 +--
 arch/x86/include/uapi/asm/bootparam.h          |  1 +
 arch/x86/kernel/cpu/common.c                   |  2 -
 arch/x86/kernel/head64.c                       | 61 ++-----------
 arch/x86/kernel/head_64.S                      | 93 ++++++++------------
 arch/x86/kernel/sev-shared.c                   | 23 +++--
 arch/x86/kernel/sev.c                          | 14 +--
 arch/x86/lib/Makefile                          | 13 ---
 arch/x86/mm/kasan_init_64.c                    |  3 -
 arch/x86/mm/mem_encrypt_identity.c             | 83 +++++------------
 drivers/firmware/efi/libstub/efi-stub-helper.c |  8 ++
 drivers/firmware/efi/libstub/efistub.h         |  2 +-
 drivers/firmware/efi/libstub/x86-stub.c        |  3 +
 20 files changed, 147 insertions(+), 255 deletions(-)
Signature · 1 line
2.44.0.rc1.240.g4c46232300-goog