qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Stewart Hildebrand <Stewart.Hildebrand@dornerworks.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Andre Przywara <andre.przywara@arm.com>,
	Julien Grall <julien.grall@arm.com>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] hw/arm/boot: Increase compliance with kernel arm64 boot protocol.
Date: Tue, 16 Oct 2018 00:05:26 +0200	[thread overview]
Message-ID: <73dcea68-2342-63b7-9691-a151f00a42e8@redhat.com> (raw)
In-Reply-To: <40eb19fb56b24e10a5eaa99ccb78aff6@dornerworks.com>

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 <stewart.hildebrand@dornerworks.com>
> ---
>  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.

> +            }
>          }
>      }
>  
> 

  reply	other threads:[~2018-10-15 22:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15 21:26 [Qemu-devel] [PATCH] hw/arm/boot: Increase compliance with kernel arm64 boot protocol Stewart Hildebrand
2018-10-15 22:05 ` Philippe Mathieu-Daudé [this message]
2018-10-16  1:19   ` Stewart Hildebrand
2018-10-16 10:02     ` Andre Przywara
2018-10-16 10:04       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73dcea68-2342-63b7-9691-a151f00a42e8@redhat.com \
    --to=philmd@redhat.com \
    --cc=Stewart.Hildebrand@dornerworks.com \
    --cc=andre.przywara@arm.com \
    --cc=julien.grall@arm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).