diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 8f24df9bc2..89b5831691 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -878,8 +878,13 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, what = L"Allocation"; file->addr = min(1UL << (32 + PAGE_SHIFT), HYPERVISOR_VIRT_END - DIRECTMAP_VIRT_START); - /* For config files allocate an extra byte to put a NUL there. */ - ret = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData, + /* + * For config files allocate an extra byte to put a NUL there. There's + * also no constraint on addresses for them. + */ + ret = efi_bs->AllocatePages(file != &cfg ? AllocateMaxAddress + : AllocateAnyPages, + EfiLoaderData, PFN_UP(size + (file == &cfg)), &file->addr); if ( EFI_ERROR(ret) ) goto fail; @@ -931,7 +936,7 @@ static bool __init read_section(const EFI_LOADED_IMAGE *image, if ( file == &cfg && file->size && !iscntrl(file->str[file->size - 1]) ) { EFI_PHYSICAL_ADDRESS addr; - EFI_STATUS ret = efi_bs->AllocatePages(AllocateMaxAddress, + EFI_STATUS ret = efi_bs->AllocatePages(AllocateAnyPages, EfiLoaderData, PFN_UP(file->size + 1), &addr);