[PATCH v2 0/3] x86/pvh: Support relocating dom0 kernel

Jason Andryuk posted 3 patches 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20240313193021.241764-1-jason.andryuk@amd.com
There is a newer version of this series
xen/arch/x86/bzimage.c             |   4 +-
xen/arch/x86/hvm/dom0_build.c      | 112 ++++++++++++++++++++++++++++-
xen/arch/x86/include/asm/bzimage.h |   2 +-
xen/arch/x86/pv/dom0_build.c       |   2 +-
xen/common/libelf/libelf-dominfo.c |  72 +++++++++++++------
xen/include/public/elfnote.h       |  11 +++
xen/include/xen/libelf.h           |   3 +
7 files changed, 177 insertions(+), 29 deletions(-)
[PATCH v2 0/3] x86/pvh: Support relocating dom0 kernel
Posted by Jason Andryuk 1 month, 2 weeks ago
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_PVH_RELOCATION is added for
kernels to indicate they are relocatable and their acceptable address
range and alignment.

The first patch reverts "xen/x86: bzImage parse kernel_alignment" since
the alignment will be specified by the ELF note.

The second patch expands ELF note printing so arrays of values can be
handled.

The third patch expands the pvh dom0 kernel placement code.

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

Jason Andryuk (3):
  Revert "xen/x86: bzImage parse kernel_alignment"
  libelf: Expand ELF note printing
  x86/PVH: Support relocatable dom0 kernels

 xen/arch/x86/bzimage.c             |   4 +-
 xen/arch/x86/hvm/dom0_build.c      | 112 ++++++++++++++++++++++++++++-
 xen/arch/x86/include/asm/bzimage.h |   2 +-
 xen/arch/x86/pv/dom0_build.c       |   2 +-
 xen/common/libelf/libelf-dominfo.c |  72 +++++++++++++------
 xen/include/public/elfnote.h       |  11 +++
 xen/include/xen/libelf.h           |   3 +
 7 files changed, 177 insertions(+), 29 deletions(-)

-- 
2.44.0