qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/arm/boot: Increase compliance with kernel arm64 boot protocol.
@ 2018-10-15 21:26 Stewart Hildebrand
  2018-10-15 22:05 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 5+ messages in thread
From: Stewart Hildebrand @ 2018-10-15 21:26 UTC (permalink / raw)
  To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
  Cc: Andre Przywara, Peter Maydell, Julien Grall

"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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-16 10:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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é
2018-10-16  1:19   ` Stewart Hildebrand
2018-10-16 10:02     ` Andre Przywara
2018-10-16 10:04       ` Peter Maydell

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).