[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 058/136] ppc/e500: drop RAM size fixup
From: |
Paolo Bonzini |
Subject: |
[PULL 058/136] ppc/e500: drop RAM size fixup |
Date: |
Tue, 25 Feb 2020 12:49:48 +0100 |
From: Igor Mammedov <address@hidden>
If user provided non-sense RAM size, board will complain and
continue running with max RAM size supported.
Also RAM is going to be allocated by generic code, so it won't be
possible for board to fix things up for user.
Make it error message and exit to force user fix CLI,
instead of accepting non-sense CLI values.
While at it, replace usage of global ram_size with
machine->ram_size
Signed-off-by: Igor Mammedov <address@hidden>
Acked-by: David Gibson <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
---
hw/ppc/e500.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 886442e..960024b 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -906,12 +906,14 @@ void ppce500_init(MachineState *machine)
env = firstenv;
- /* Fixup Memory size on a alignment boundary */
- ram_size &= ~(RAM_SIZES_ALIGN - 1);
- machine->ram_size = ram_size;
+ if (!QEMU_IS_ALIGNED(machine->ram_size, RAM_SIZES_ALIGN)) {
+ error_report("RAM size must be multiple of %" PRIu64, RAM_SIZES_ALIGN);
+ exit(EXIT_FAILURE);
+ }
/* Register Memory */
- memory_region_allocate_system_memory(ram, NULL, "mpc8544ds.ram", ram_size);
+ memory_region_allocate_system_memory(ram, NULL, "mpc8544ds.ram",
+ machine->ram_size);
memory_region_add_subregion(address_space_mem, 0, ram);
dev = qdev_create(NULL, "e500-ccsr");
@@ -1083,7 +1085,7 @@ void ppce500_init(MachineState *machine)
kernel_base = cur_base;
kernel_size = load_image_targphys(machine->kernel_filename,
cur_base,
- ram_size - cur_base);
+ machine->ram_size - cur_base);
if (kernel_size < 0) {
error_report("could not load kernel '%s'",
machine->kernel_filename);
@@ -1097,7 +1099,7 @@ void ppce500_init(MachineState *machine)
if (machine->initrd_filename) {
initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
- ram_size - initrd_base);
+ machine->ram_size - initrd_base);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
@@ -1115,7 +1117,7 @@ void ppce500_init(MachineState *machine)
* ensures enough space between kernel and initrd.
*/
dt_base = (loadaddr + payload_size + DTC_LOAD_PAD) & ~DTC_PAD_MASK;
- if (dt_base + DTB_MAX_SIZE > ram_size) {
+ if (dt_base + DTB_MAX_SIZE > machine->ram_size) {
error_report("not enough memory for device tree");
exit(1);
}
--
1.8.3.1
- [PULL 052/136] mips/mips_fulong2e: use memdev for RAM, (continued)
- [PULL 052/136] mips/mips_fulong2e: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 057/136] mips/mips_r4k: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 051/136] mips/mips_fulong2e: drop RAM size fixup, Paolo Bonzini, 2020/02/25
- [PULL 067/136] ppc/spapr: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 064/136] ppc/ppc405_boards: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 049/136] m68k/next-cube: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 053/136] mips/mips_jazz: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 059/136] ppc/e500: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 063/136] ppc/ppc405_boards: add RAM size checks, Paolo Bonzini, 2020/02/25
- [PULL 062/136] ppc/pnv: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 058/136] ppc/e500: drop RAM size fixup,
Paolo Bonzini <=
- [PULL 065/136] ppc/{ppc440_bamboo, sam460ex}: drop RAM size fixup, Paolo Bonzini, 2020/02/25
- [PULL 066/136] ppc/{ppc440_bamboo, sam460ex}: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 061/136] ppc/mac_oldworld: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 060/136] ppc/mac_newworld: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 071/136] sparc/niagara: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 069/136] sparc/leon3: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 076/136] hostmem: introduce "prealloc-threads" property, Paolo Bonzini, 2020/02/25
- [PULL 078/136] tests/numa-test: make top level args dynamic and g_autofree(cli) cleanups, Paolo Bonzini, 2020/02/25
- [PULL 074/136] exec: drop bogus mem_path from qemu_ram_alloc_from_fd(), Paolo Bonzini, 2020/02/25
- [PULL 068/136] ppc/virtex_ml507: use memdev for RAM, Paolo Bonzini, 2020/02/25