On 23.08.24 21:36, Jason Andryuk wrote: > The PVH entry point is 32bit. For a 64bit kernel, the entry point must > switch to 64bit mode, which requires a set of page tables. In the past, > PVH used init_top_pgt. > > This works fine when the kernel is loaded at LOAD_PHYSICAL_ADDR, as the > page tables are prebuilt for this address. If the kernel is loaded at a > different address, they need to be adjusted. > > __startup_64() adjusts the prebuilt page tables for the physical load > address, but it is 64bit code. The 32bit PVH entry code can't call it > to adjust the page tables, so it can't readily be re-used. > > 64bit PVH entry needs page tables set up for identity map, the kernel > high map and the direct map. pvh_start_xen() enters identity mapped. > Inside xen_prepare_pvh(), it jumps through a pv_ops function pointer > into the highmap. The direct map is used for __va() on the initramfs > and other guest physical addresses. > > Add a dedicated set of prebuild page tables for PVH entry. They are > adjusted in assembly before loading. > > Add XEN_ELFNOTE_PHYS32_RELOC to indicate support for relocation > along with the kernel's loading constraints. The maximum load address, > KERNEL_IMAGE_SIZE - 1, is determined by a single pvh_level2_ident_pgt > page. It could be larger with more pages. > > Signed-off-by: Jason Andryuk Reviewed-by: Juergen Gross Juergen