public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] x86/pvh: Make PVH entry relocatable
@ 2024-04-10 19:48 Jason Andryuk
  2024-04-10 19:48 ` [PATCH 1/5] xen: sync elfnote.h from xen tree Jason Andryuk
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Jason Andryuk @ 2024-04-10 19:48 UTC (permalink / raw)
  To: Juergen Gross, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	Stefano Stabellini, Oleksandr Tyshchenko, Paolo Bonzini
  Cc: xen-devel, linux-kernel, Jason Andryuk

Using the PVH entry point, the uncompressed vmlinux is loaded at
LOAD_PHYSICAL_ADDR, and execution starts in 32bit mode at the
address in XEN_ELFNOTE_PHYS32_ENTRY, pvh_start_xen, with paging
disabled.

Loading at LOAD_PHYSICAL_ADDR has not been a problem in the past as
virtual machines don't have conflicting memory maps.  But Xen now
supports a PVH dom0, which uses the host memory map, and there are
Coreboot/EDK2 firmwares that have reserved regions conflicting with
LOAD_PHYSICAL_ADDR.  Xen recently added XEN_ELFNOTE_PHYS32_RELOC to
specify an alignment, minimum and maximum load address when
LOAD_PHYSICAL_ADDR cannot be used.  This patch series makes the PVH
entry path PIC to support relocation.

Only x86-64 is converted.  The 32bit entry path calling into vmlinux,
which is not PIC, will not support relocation.

The entry path needs pages tables to switch to 64bit mode.  A new
pvh_init_top_pgt is added to make the transition into the startup_64
when the regular init_top_pgt pagetables are setup.  This duplication is
unfortunate, but it keeps the changes simpler.  __startup_64() can't be
used to setup init_top_pgt for PVH entry because it is 64bit code - the
32bit entry code doesn't have page tables to use.

This is the straight forward implementation to make it work.  Other
approaches could be pursued.

checkpatch.pl gives an error: "ERROR: Macros with multiple statements
should be enclosed in a do - while loop" about the moved PMDS macro.
But PMDS is an assembler macro, so its not applicable.  There are some
false positive warnings "WARNING: space prohibited between function name
and open parenthesis '('" about the macro, too.

Jason Andryuk (5):
  xen: sync elfnote.h from xen tree
  x86/pvh: Make PVH entrypoint PIC for x86-64
  x86/pvh: Set phys_base when calling xen_prepare_pvh()
  x86/kernel: Move page table macros to new header
  x86/pvh: Add 64bit relocation page tables

 arch/x86/kernel/head_64.S            |  22 +---
 arch/x86/kernel/pgtable_64_helpers.h |  28 +++++
 arch/x86/platform/pvh/head.S         | 157 +++++++++++++++++++++++++--
 include/xen/interface/elfnote.h      |  93 +++++++++++++++-
 4 files changed, 265 insertions(+), 35 deletions(-)
 create mode 100644 arch/x86/kernel/pgtable_64_helpers.h

-- 
2.44.0


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

end of thread, other threads:[~2024-05-23 14:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10 19:48 [PATCH 0/5] x86/pvh: Make PVH entry relocatable Jason Andryuk
2024-04-10 19:48 ` [PATCH 1/5] xen: sync elfnote.h from xen tree Jason Andryuk
2024-05-10  8:09   ` Jürgen Groß
2024-04-10 19:48 ` [PATCH 2/5] x86/pvh: Make PVH entrypoint PIC for x86-64 Jason Andryuk
2024-04-10 21:00   ` Brian Gerst
2024-04-11 15:26     ` Jason Andryuk
2024-04-11 18:15       ` Brian Gerst
2024-04-10 19:48 ` [PATCH 3/5] x86/pvh: Set phys_base when calling xen_prepare_pvh() Jason Andryuk
2024-05-23 11:14   ` Jürgen Groß
2024-04-10 19:48 ` [PATCH 4/5] x86/kernel: Move page table macros to new header Jason Andryuk
2024-05-23 11:40   ` Juergen Gross
2024-05-23 13:59   ` Thomas Gleixner
2024-05-23 14:07     ` Borislav Petkov
2024-04-10 19:48 ` [PATCH 5/5] x86/pvh: Add 64bit relocation page tables Jason Andryuk
2024-05-23 12:11   ` Juergen Gross

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