[PATCH v7 0/2] x86/pvh: Support relocating dom0 kernel

Jason Andryuk posted 2 patches 3 weeks, 4 days ago
Failed in applying to current master (apply log)
xen/arch/x86/hvm/dom0_build.c      | 108 +++++++++++++++++++++++++++++
xen/common/libelf/libelf-dominfo.c |  35 ++++++++++
xen/common/libelf/libelf-loader.c  |   5 ++
xen/common/libelf/libelf-private.h |   1 +
xen/include/public/elfnote.h       |  20 +++++-
xen/include/xen/libelf.h           |   5 ++
6 files changed, 173 insertions(+), 1 deletion(-)
[PATCH v7 0/2] x86/pvh: Support relocating dom0 kernel
Posted by Jason Andryuk 3 weeks, 4 days 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_PHYS32_RELOC is added for
kernels to indicate they are relocatable and their acceptable address
range and alignment.

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 v6 commited:
  tools/init-xenstore-domain: Replace variable MB() usage
  tools: Move MB/GB() to common-macros.h

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

The second patch expands the pvh dom0 kernel placement code.

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

Jason Andryuk (2):
  libelf: Store maximum PHDR p_align
  x86/PVH: Support relocatable dom0 kernels

 xen/arch/x86/hvm/dom0_build.c      | 108 +++++++++++++++++++++++++++++
 xen/common/libelf/libelf-dominfo.c |  35 ++++++++++
 xen/common/libelf/libelf-loader.c  |   5 ++
 xen/common/libelf/libelf-private.h |   1 +
 xen/include/public/elfnote.h       |  20 +++++-
 xen/include/xen/libelf.h           |   5 ++
 6 files changed, 173 insertions(+), 1 deletion(-)

-- 
2.44.0