All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/4] x86/pvh: Support relocating dom0 kernel
@ 2024-03-27 21:50 Jason Andryuk
  2024-03-27 21:50 ` [PATCH v6 1/4] tools/init-xenstore-domain: Replace variable MB() usage Jason Andryuk
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Jason Andryuk @ 2024-03-27 21:50 UTC (permalink / raw)
  To: xen-devel
  Cc: Jason Andryuk, Juergen Gross, Julien Grall, Anthony PERARD,
	Jan Beulich, Andrew Cooper, Roger Pau Monné,
	George Dunlap, Stefano Stabellini

Xen tries to load a PVH dom0 kernel at the fixed guest physical address
from the elf headers.  For Linux, this defaults to 0x1000000 (16MB), but
it can be configured.

Unfortunately there exist firmwares that have reserved regions at this
address, so Xen fails to load the dom0 kernel since it's not RAM.

The other issue is that the Linux PVH entry point is not
position-independent.  It expects to run at the compiled
CONFIG_PHYSICAL_ADDRESS.

This patch set expands the PVH dom0 builder to try to relocate the
kernel if needed and possible.  XEN_ELFNOTE_PHYS32_RELOC is added for
kernels to indicate they are relocatable and their acceptable address
range and alignment.

v6:
Choose the alignment from the Note if specified, or the Maximum PHDR
p_align value if greater than PAGE_SIZE.  Otherwise, it falls back to
the default 2MB.

Patches from v5 commited:
853c71dfbf xen/elfnote: Specify ELF Notes are x86-specific
7d8c9b4e8d libelf: Expand ELF note printing
8802230bfa Revert "xen/x86: bzImage parse kernel_alignment"

The first and second patches move MB/GB() to common-macros.h.

The third patch stores the maximum p_align value from the ELF PHDRs.

The fourth patch expands the pvh dom0 kernel placement code.

I'll post an additional patch showing the Linux changes to make PVH
relocatable.

Jason Andryuk (4):
  tools/init-xenstore-domain: Replace variable MB() usage
  tools: Move MB/GB() to common-macros.h
  libelf: Store maximum PHDR p_align
  x86/PVH: Support relocatable dom0 kernels

 tools/firmware/hvmloader/util.h         |   3 -
 tools/helpers/init-xenstore-domain.c    |  11 ++-
 tools/include/xen-tools/common-macros.h |   4 +
 tools/libs/light/libxl_internal.h       |   4 -
 xen/arch/x86/hvm/dom0_build.c           | 108 ++++++++++++++++++++++++
 xen/common/libelf/libelf-dominfo.c      |  35 ++++++++
 xen/common/libelf/libelf-loader.c       |  15 +++-
 xen/common/libelf/libelf-private.h      |   1 +
 xen/include/public/elfnote.h            |  16 +++-
 xen/include/xen/libelf.h                |   5 ++
 10 files changed, 186 insertions(+), 16 deletions(-)

-- 
2.44.0



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

end of thread, other threads:[~2024-04-04 14:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 21:50 [PATCH v6 0/4] x86/pvh: Support relocating dom0 kernel Jason Andryuk
2024-03-27 21:50 ` [PATCH v6 1/4] tools/init-xenstore-domain: Replace variable MB() usage Jason Andryuk
2024-04-03 12:41   ` Anthony PERARD
2024-04-03 12:51     ` Jason Andryuk
2024-04-04 10:09   ` Jan Beulich
2024-04-04 13:55     ` Jason Andryuk
2024-03-27 21:51 ` [PATCH v6 2/4] tools: Move MB/GB() to common-macros.h Jason Andryuk
2024-04-03 12:57   ` Anthony PERARD
2024-03-27 21:51 ` [PATCH v6 3/4] libelf: Store maximum PHDR p_align Jason Andryuk
2024-03-28 16:47   ` Jan Beulich
2024-03-29 14:41     ` Jason Andryuk
2024-04-02  6:44       ` Jan Beulich
2024-04-04 14:00         ` Jason Andryuk
2024-03-27 21:51 ` [PATCH v6 4/4] x86/PVH: Support relocatable dom0 kernels Jason Andryuk
2024-04-02 14:34   ` Jan Beulich
2024-04-04 14:01     ` Jason Andryuk
2024-03-27 21:55 ` [PATCH v6] RFC: x86/pvh: Make Xen PVH entrypoint PIC for x86-64 Jason Andryuk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.