aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2013-01-24 19:02:28 +0000
committerBlue Swirl <blauwirbel@gmail.com>2013-01-26 13:28:16 +0000
commit98ed805c388baaf4ce7d9acbbbc04bbf185f30fc (patch)
treef20c29810411e4db9dd5c1e2ed3606cda1e5e85b /hw
parent390999910bf1b1be59e04a0314867f4dea7a28f3 (diff)
downloadqemu-98ed805c388baaf4ce7d9acbbbc04bbf185f30fc.zip
qemu-98ed805c388baaf4ce7d9acbbbc04bbf185f30fc.tar.gz
qemu-98ed805c388baaf4ce7d9acbbbc04bbf185f30fc.tar.bz2
hw/arm_boot: Align device tree to 4KB boundary, not page
Align the device tree blob to a 4KB boundary, not to QEMU's idea of a page boundary -- the latter is the smallest possible page size for the architecture, which on ARM is 1KB. The documentation for Linux does not impose separation or alignment requirements on the device tree blob, but in practice some kernels will happily trash the entire page the initrd ends in after they have finished uncompressing the initrd. So 4KB-align the DTB to ensure it does not get trampled by these kernels. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/arm_boot.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 115f583..4065424 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -441,9 +441,12 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
* we point to the kernel args.
*/
if (info->dtb_filename) {
- /* Place the DTB after the initrd in memory */
- hwaddr dtb_start = TARGET_PAGE_ALIGN(info->initrd_start +
- initrd_size);
+ /* 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.
+ */
+ hwaddr dtb_start = QEMU_ALIGN_UP(info->initrd_start + initrd_size,
+ 4096);
if (load_dtb(dtb_start, info)) {
exit(1);
}