Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Martin L Roth: Looks good to me, approved
mainboard/qemu-aarch64: Map entire RAM space as read-write memory

Commit 977b8e83cb0a ("mb/emulation/qemu-aarch64: Add MMU support") adds
MMU support for ARM64 QEMU VMs, but registers a limited 1GiB region for
the DRAM, with a note that ramstage should update it.

However on recent versions of QEMU "virt" VMs, accessing RAM outside
this registered region results in an exception even if the address is
backed by actual RAM. This interferes with RAM detection which catches
these exceptions, effectively limiting us to detecting a maximum 1GiB of
RAM even if more is available.

Register the entire RAM space to MMU instead of just the 1GiB, so that
probing RAM addresses can correctly detect how much RAM we have.

Change-Id: I3afbd27b91ab37304a29a62506f965ac3cfb1c06
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80321
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
---
M src/mainboard/emulation/qemu-aarch64/bootblock.c
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mainboard/emulation/qemu-aarch64/bootblock.c b/src/mainboard/emulation/qemu-aarch64/bootblock.c
index 5fe0888..5561d6f 100644
--- a/src/mainboard/emulation/qemu-aarch64/bootblock.c
+++ b/src/mainboard/emulation/qemu-aarch64/bootblock.c
@@ -10,8 +10,7 @@

/* Everything below DRAM is device memory */
mmu_config_range((void *)0, (uintptr_t)_dram, MA_DEV | MA_RW);
- /* Set a dummy value for DRAM. ramstage should update the mapping. */
- mmu_config_range(_dram, 1 * GiB, MA_MEM | MA_RW);
+ mmu_config_range(_dram, (uintptr_t)CONFIG_DRAM_SIZE_MB * MiB, MA_MEM | MA_RW);

mmu_config_range(_ttb, REGION_SIZE(ttb), MA_MEM | MA_S | MA_RW);
mmu_config_range(_bootblock, REGION_SIZE(bootblock), MA_MEM | MA_S | MA_RW);

To view, visit change 80321. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I3afbd27b91ab37304a29a62506f965ac3cfb1c06
Gerrit-Change-Number: 80321
Gerrit-PatchSet: 2
Gerrit-Owner: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Julius Werner <jwerner@chromium.org>
Gerrit-Reviewer: Martin L Roth <gaumless@gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged