qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stewart Hildebrand <Stewart.Hildebrand@dornerworks.com>
To: "qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Andre Przywara <andre.przywara@arm.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Julien Grall <julien.grall@arm.com>
Subject: [Qemu-devel] [PATCH] hw/arm/boot: Increase compliance with kernel arm64 boot protocol.
Date: Mon, 15 Oct 2018 21:26:39 +0000	[thread overview]
Message-ID: <40eb19fb56b24e10a5eaa99ccb78aff6@dornerworks.com> (raw)

"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) {
+                kernel_load_offset += 2 << 20;
+            }
         }
     }
 
-- 
2.17.1

             reply	other threads:[~2018-10-15 21:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15 21:26 Stewart Hildebrand [this message]
2018-10-15 22:05 ` [Qemu-devel] [PATCH] hw/arm/boot: Increase compliance with kernel arm64 boot protocol Philippe Mathieu-Daudé
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=40eb19fb56b24e10a5eaa99ccb78aff6@dornerworks.com \
    --to=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).