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. XENFEAT_pvh_relocatable is added for kernels to indicate they are relocatable. However, we may want to switch to an additional ELF note with the kernel alignment. Linux specifies a kernel alignment in the bzImage boot_params.setup_header, but that is not present the ELF vmlinux file. The first patch fixes some whitespace in features.h The second patch enhances bzimage_parse to pull the kernel_alignment into an optional align pointer. 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): features.h: Replace hard tabs xen/x86: bzImage parse kernel_alignment x86/PVH: Support relocatable dom0 kernels xen/arch/x86/bzimage.c | 4 +- xen/arch/x86/hvm/dom0_build.c | 113 ++++++++++++++++++++++++++++- xen/arch/x86/include/asm/bzimage.h | 3 +- xen/arch/x86/pv/dom0_build.c | 2 +- xen/include/public/features.h | 9 ++- 5 files changed, 124 insertions(+), 7 deletions(-) -- 2.44.0