[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 18/19] hw/riscv: virt: Limit RAM size in a 32-bit system
From: |
Alistair Francis |
Subject: |
[PULL v2 18/19] hw/riscv: virt: Limit RAM size in a 32-bit system |
Date: |
Thu, 4 Mar 2021 09:46:50 -0500 |
From: Bin Meng <bin.meng@windriver.com>
RV32 supports 34-bit physical address hence the maximum RAM size
should be limited. Limit the RAM size to 10 GiB, which leaves
some room for PCIe high mmio space.
For 32-bit host, this is not needed as machine->ram_size cannot
represent a RAM size that big. Use a #if size test to only do
the size limitation for the 64-bit host.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20210220144807.819-4-bmeng.cn@gmail.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
hw/riscv/virt.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 1d05bb3ef9..c4b8f455f8 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -590,6 +590,16 @@ static void virt_machine_init(MachineState *machine)
}
}
+ if (riscv_is_32bit(&s->soc[0])) {
+#if HOST_LONG_BITS == 64
+ /* limit RAM size in a 32-bit system */
+ if (machine->ram_size > 10 * GiB) {
+ machine->ram_size = 10 * GiB;
+ error_report("Limiting RAM size to 10 GiB");
+ }
+#endif
+ }
+
/* register system main memory (actual RAM) */
memory_region_init_ram(main_mem, NULL, "riscv_virt_board.ram",
machine->ram_size, &error_fatal);
--
2.30.1
- [PULL v2 09/19] hw/riscv: sifive_u: Add QSPI2 controller and connect an SD card, (continued)
- [PULL v2 09/19] hw/riscv: sifive_u: Add QSPI2 controller and connect an SD card, Alistair Francis, 2021/03/04
- [PULL v2 08/19] hw/riscv: sifive_u: Add QSPI0 controller and connect a flash, Alistair Francis, 2021/03/04
- [PULL v2 10/19] hw/riscv: sifive_u: Change SIFIVE_U_GEM_IRQ to decimal value, Alistair Francis, 2021/03/04
- [PULL v2 12/19] docs/system: Add RISC-V documentation, Alistair Francis, 2021/03/04
- [PULL v2 13/19] docs/system: riscv: Add documentation for sifive_u machine, Alistair Francis, 2021/03/04
- [PULL v2 11/19] docs/system: Sort targets in alphabetical order, Alistair Francis, 2021/03/04
- [PULL v2 14/19] goldfish_rtc: re-arm the alarm after migration, Alistair Francis, 2021/03/04
- [PULL v2 16/19] hw/riscv: Drop 'struct MemmapEntry', Alistair Francis, 2021/03/04
- [PULL v2 15/19] MAINTAINERS: Add a SiFive machine section, Alistair Francis, 2021/03/04
- [PULL v2 17/19] hw/riscv: virt: Drop the 'link_up' parameter of gpex_pcie_init(), Alistair Francis, 2021/03/04
- [PULL v2 18/19] hw/riscv: virt: Limit RAM size in a 32-bit system,
Alistair Francis <=
- [PULL v2 19/19] hw/riscv: virt: Map high mmio for PCIe, Alistair Francis, 2021/03/04
- Re: [PULL v2 00/19] riscv-to-apply queue, Peter Maydell, 2021/03/05