qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2.4] hw/arm/boot: Increase fdt alignment


From: Alexander Graf
Subject: [Qemu-devel] [PATCH 2.4] hw/arm/boot: Increase fdt alignment
Date: Mon, 13 Jul 2015 17:56:37 +0200

The Linux kernel on aarch64 creates a page table entry at early bootup
that spans the 2MB range on memory spanning the fdt start address:

  [ ALIGN_DOWN(fdt, 2MB) ... ALIGN_DOWN(fdt, 2MB) + 2MB ]

This means that when our current 4k alignment happens to fall at the end
of the aligned region, Linux tries to access memory that is not mapped.

The easy fix is to instead increase the alignment to 2MB, making Linux's
logic always succeed.

Reported-by: Andreas Schwab <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
 hw/arm/boot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index f48ed2d..7594d7a 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -735,12 +735,12 @@ static void arm_load_kernel_notify(Notifier *notifier, 
void *data)
          * we point to the kernel args.
          */
         if (have_dtb(info)) {
-            /* Place the DTB after the initrd in memory. Note that some
-             * kernels will trash anything in the 4K page the initrd
-             * ends in, so make sure the DTB isn't caught up in that.
+            /* Place the DTB after the initrd in memory. Note that the kernel
+             * maps [ ALIGN_DOWN(fdt, 2MB) ... ALGIN_DOWN(fdt, 2MB) + 2MB ]
+             * and thus needs the fdt be preferably in its own 2MB window.
              */
             hwaddr dtb_start = QEMU_ALIGN_UP(info->initrd_start + initrd_size,
-                                             4096);
+                                             2 * 1024 * 1024);
             if (load_dtb(dtb_start, info, 0) < 0) {
                 exit(1);
             }
-- 
1.7.12.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]