From e7473e600e0271ea65d4b8be490f674f83830688 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 8 Nov 2022 12:44:40 -0800 Subject: [PATCH] aarch64: load arm64 kernels at physical address 0 There is no reason to leave an 8 MB gap at the beginning of guest memory; shift the kernel load address down to the very beginning of RAM. This accomodates alternate ELF kernels that want to be loaded at address 0 as well. BUG=b:254601048 TEST=boot crostini on arm Change-Id: Iaa58efc5b20046732ef0f75b3c779134a3ee454b Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4015002 Reviewed-by: Alexandre Courbot Commit-Queue: Daniel Verkamp --- aarch64/src/lib.rs | 4 ++-- docs/book/src/appendix/memory_layout.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aarch64/src/lib.rs b/aarch64/src/lib.rs index 888eac7a72..7a0bcf994a 100644 --- a/aarch64/src/lib.rs +++ b/aarch64/src/lib.rs @@ -68,8 +68,8 @@ use vm_memory::GuestMemoryError; mod fdt; -// We place the kernel at offset 8MB -const AARCH64_KERNEL_OFFSET: u64 = 0x800000; +// We place the kernel at the very beginning of physical memory. +const AARCH64_KERNEL_OFFSET: u64 = 0; const AARCH64_FDT_MAX_SIZE: u64 = 0x200000; const AARCH64_INITRD_ALIGN: u64 = 0x1000000; diff --git a/docs/book/src/appendix/memory_layout.md b/docs/book/src/appendix/memory_layout.md index 9cc01c0971..9c6d22a66b 100644 --- a/docs/book/src/appendix/memory_layout.md +++ b/docs/book/src/appendix/memory_layout.md @@ -69,7 +69,7 @@ These apply when no bootloader is passed, so crosvm boots a kernel directly. | Name/source link | Address | End (exclusive) | Size | Notes | | ------------------------- | ----------------- | --------------- | ----- | ---------------------------- | -| [`AARCH64_KERNEL_OFFSET`] | `8080_0000` | | | Kernel load location in RAM | +| [`AARCH64_KERNEL_OFFSET`] | `8000_0000` | | | Kernel load location in RAM | | [`initrd_addr`] | after kernel | | | Linux initrd location in RAM | | [`fdt_address`] | before end of RAM | | 2 MiB | Flattened device tree in RAM |