[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH] hw/arm/boot: Increase compliance wit
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH] hw/arm/boot: Increase compliance with kernel arm64 boot protocol. |
Date: |
Tue, 16 Oct 2018 00:05:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
Hi Stewart,
On 15/10/2018 23:26, Stewart Hildebrand wrote:
> "The Image must be placed text_offset bytes from a 2MB aligned base
> address anywhere in usable system RAM and called there."
>
> For the virt board, we write our startup bootloader at the very
> bottom of RAM, so that bit can't be used for the image. To avoid
> overlap in case the image requests to be loaded at an offset
> smaller than our bootloader, we increment the load offset to the
> next 2MB.
>
> This fixes a boot failure for Xen AArch64.
>
> Signed-off-by: Stewart Hildebrand <address@hidden>
> ---
> hw/arm/boot.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index 20c71d7d96..559ddbcd53 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -919,6 +919,16 @@ static uint64_t load_aarch64_image(const char *filename,
> hwaddr mem_base,
> memcpy(&hdrvals, buffer + ARM64_TEXT_OFFSET_OFFSET, sizeof(hdrvals));
> if (hdrvals[1] != 0) {
> kernel_load_offset = le64_to_cpu(hdrvals[0]);
> +
> + /* For the virt board, we write our startup "bootloader" at the
> very
> + * bottom of RAM, so that bit can't be used for the image. To
> avoid
> + * overlap in case the image requests to be loaded at an offset
> + * smaller than our bootloader, we increment the load offset to
> the
> + * next 2MB.
> + */
> + if (kernel_load_offset < FIXUP_MAX) {
I don't understand how this is related to FIXUP_MAX...
> + kernel_load_offset += 2 << 20;
You can use += 2 * MiB; which is easier to review.
> + }
> }
> }
>
>