mbox series

[RFC,0/7] Clean up x86_64 boot code

Message ID cover.1556708225.git.dwmw2@infradead.org (mailing list archive)
Headers show
Series Clean up x86_64 boot code | expand

Message

David Woodhouse May 1, 2019, 11:17 a.m. UTC
Some cleanups for the boot path, originally inspired by an attempt to
avoid scribbling on arbitrarily-chosen low memory.

In the no-real-mode case we don't need to bounce through low memory at
all; we can run the 32-bit trampoline in-place in the Xen image.

The variables containing information which is optionally discovered by
the real-mode boot code can be put back in place in the Xen image and we
can dispense with the bootsym() pointer gymnastics in C code which
access them in low memory.

I haven't yet got to reloc(), which I think exists only to ensure that
the various breadcrumbs left all over the place by the Multiboot
bootloader aren't scribbled on when we copy the 16-bit boot trampoline
into low memory. I'd quite like to kill reloc() and pass the original
pointer up to 64-bit code to be handled in C.

That would require finding a *safe* location to put the 16-bit boot
trampoline though, which doesn't already contain anything that the
bootloader created for us.

In fact, isn't there already a chance that head.S will choose a location
for the trampoline which is already part of a module or contains one of
the Multiboot breadcrumbs?

David Woodhouse (7):
  x86/wakeup: Stop using %fs for lidt/lgdt
  x86/boot: Remove gratuitous call back into low-memory code
  x86/boot: Only jump into low trampoline code for real-mode boot
  x86/boot: Split bootsym() into four types of relocations
  x86/boot: Rename trampoline_{start,end} to boot_trampoline_{start,end}
  x86/boot: Copy 16-bit boot variables back up to Xen image
  x86/boot: Do not use trampoline for no-real-mode boot paths

 xen/arch/x86/acpi/power.c         |   6 +-
 xen/arch/x86/boot/edd.S           |  18 ++--
 xen/arch/x86/boot/head.S          |  89 ++++++++++++------
 xen/arch/x86/boot/mem.S           |  35 +++-----
 xen/arch/x86/boot/trampoline.S    | 145 +++++++++++++++++++++++-------
 xen/arch/x86/boot/video.S         |  36 ++++----
 xen/arch/x86/boot/wakeup.S        |  23 ++---
 xen/arch/x86/cpu/common.c         |   2 +-
 xen/arch/x86/cpu/intel.c          |   2 +-
 xen/arch/x86/efi/efi-boot.h       |  31 +------
 xen/arch/x86/mm.c                 |   2 +-
 xen/arch/x86/platform_hypercall.c |  18 ++--
 xen/arch/x86/setup.c              |  72 ++++++++++++---
 xen/arch/x86/smpboot.c            |   6 +-
 xen/arch/x86/tboot.c              |   6 +-
 xen/arch/x86/x86_64/mm.c          |   2 +-
 xen/arch/x86/xen.lds.S            |  27 ++++--
 xen/include/asm-x86/acpi.h        |   2 +-
 xen/include/asm-x86/config.h      |  10 +--
 xen/include/asm-x86/e820.h        |   5 +-
 xen/include/asm-x86/edd.h         |   1 -
 21 files changed, 339 insertions(+), 199 deletions(-)