Alper Nebi Yasak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81365?usp=email )
Change subject: mainboard/qemu-riscv: Further limit DRAM size for safe probing ......................................................................
mainboard/qemu-riscv: Further limit DRAM size for safe probing
On QEMU 64-bit RISC-V virtual machines, the PCIe MMIO base is shortly after the top of DRAM, aligned to 16 GiB. Probing DRAM can't distinguish this MMIO range from actual RAM, so commit 8e365396d427 ("riscv/mb/qemu: fix DRAM probing") reduces the default DRAM probe size to 16 GiB on the qemu-riscv mainboards to avoid it entirely.
However, DRAM starts at 2 GiB on these VMs so we can end up probing addresses up to 18 GiB. In particular, making 14 GiB of DRAM available to the VM means top of RAM is at 16GiB with the MMIO range immediately after it, which still triggers this confusion.
Decrease the 64-bit limit further by 2 GiB to account for the DRAM start address. The MMIO base is fixed at 12 GiB for 32-bit RISC-V VMs, so also limit to 10 GiB there, although things are further limited by 32-bit uintptr_t on those.
Fixes: 8e365396d427 ("riscv/mb/qemu: fix DRAM probing") Change-Id: If95d80054dcd8a6bd2381066d1b7c5eaebd46d65 Signed-off-by: Alper Nebi Yasak alpernebiyasak@gmail.com --- M src/mainboard/emulation/qemu-riscv/Kconfig 1 file changed, 6 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/81365/1
diff --git a/src/mainboard/emulation/qemu-riscv/Kconfig b/src/mainboard/emulation/qemu-riscv/Kconfig index 94f9e56..9d56c9c 100644 --- a/src/mainboard/emulation/qemu-riscv/Kconfig +++ b/src/mainboard/emulation/qemu-riscv/Kconfig @@ -70,10 +70,13 @@
config DRAM_SIZE_MB int - default 16383 + default 14335 if ARCH_RISCV_RV64 + default 10239 if ARCH_RISCV_RV32 help - Qemu maps MMIO at ALIGN_UP(top_of_mem, 16 * GiB) - To avoid confusing the dram probing algorithm, avoid large dram sizes (16G - 1m) + QEMU maps MMIO at ALIGN_UP(top_of_mem, 16 * GiB) on RV64. + To avoid confusing the DRAM probing algorithm, avoid large DRAM sizes. + DRAM start is at 2G, so we can safely probe up to 16G - 1M - 2G of RAM. + On RV32, MMIO is at 12 GiB, so we have to limit to 12G - 1M - 2G.
config OPENSBI_PLATFORM string