mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
The Arm zImage loader currently computes the kernel load address and places the DTB/initrd in one local flow. The hardware-domain memory allocator needs to reuse those placement rules before it chooses bank 0, but open-coding the same calculations there would make the fix harder to audit. Split the existing logic into small helpers: - kernel_zimage_place_in_bank() computes the zImage load address for a given bank. - first_bank_can_fit_modules() checks the aggregate first-bank footprint. - find_dtb_initrd_placement() chooses the DTB/initrd location within a known bank and kernel range. Rename place_modules() to place_dtb_initrd() so the code distinguishes the kernel image from the DTB/initrd placement area. Also update the comments linking the hypervisor and toolstack placement paths. While moving the code, spell the 2MB alignment mask with MB(2) rather than open-coding (2 << 20). This is mechanical and keeps the generated value unchanged. The caller still panics in the same cases as before, so this is intended to be behavior preserving. Signed-off-by: Mykola Kvach <mykola_kvach@epam.com> Reviewed-by: Michal Orzel <michal.orzel@amd.com> Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>