qemu-devel
[Top][All Lists]
Advanced

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

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


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH 2.4] hw/arm/boot: Increase fdt alignment
Date: Mon, 13 Jul 2015 18:39:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 07/13/15 18:27, Peter Maydell wrote:
On 13 July 2015 at 17:20, Alexander Graf <address@hidden> wrote:
On 07/13/15 18:13, Peter Maydell wrote:
On 13 July 2015 at 16:56, Alexander Graf <address@hidden> wrote:
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.
This is a kernel bug and should be fixed there. The booting
protocol document is pretty clear:
https://www.kernel.org/doc/Documentation/arm64/booting.txt

"The device tree blob (dtb) must be placed on an 8-byte boundary"

While I tend to agree, we can't fix old / released kernels. So maybe we
should just fix it in both?
Maybe. The trouble with just bumping up the alignment though is that
not all boards have so much RAM that they can trivially waste another
meg or two on alignment padding without noticing it. AArch64 boards
are probably OK but some of the old 32 bit boards are not anywhere
near as well supplied with RAM. Picking dtb alignment based on 32/64
bits might be safer.

Ugh, we don't know the size yet at this point. And calling load_fdt multiple times feels like a can of worms I don't want to open. So yeah, I'll just make it depend on the RAM size - if there are >= 128MB RAM in our VM we align on 2MB.


Alex




reply via email to

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