On Wed, 15 Jan 2020, Igor Mammedov wrote: > 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. > > Signed-off-by: Igor Mammedov > --- > v2: > * fix format string cousing build failure on 32-bit host > (Philippe Mathieu-Daudé ) > > CC: philmd@redhat.com > CC: amarkovic@wavecomp.com > CC: aurelien@aurel32.net > CC: aleksandar.rikalo@rt-rk.com > --- > hw/mips/mips_fulong2e.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c > index 9eaa6e2..7e7dcd6 100644 > --- a/hw/mips/mips_fulong2e.c > +++ b/hw/mips/mips_fulong2e.c > @@ -296,7 +296,6 @@ static void mips_fulong2e_init(MachineState *machine) > MemoryRegion *address_space_mem = get_system_memory(); > MemoryRegion *ram = g_new(MemoryRegion, 1); > MemoryRegion *bios = g_new(MemoryRegion, 1); > - ram_addr_t ram_size = machine->ram_size; > long bios_size; > uint8_t *spd_data; > Error *err = NULL; > @@ -315,10 +314,14 @@ static void mips_fulong2e_init(MachineState *machine) > qemu_register_reset(main_cpu_reset, cpu); > > /* TODO: support more than 256M RAM as highmem */ > - ram_size = 256 * MiB; > + if (machine->ram_size != 256 * MiB) { > + error_report("Invalid RAM size, should be %" PRIu64, 256 * MiB); Should this just print 256M without any format string or print it in MiB instead of bytes like for mips_r4k (considering that default for -m option is value as postfixed by M so it makes more sense for the user to print that what they can easily specify in the option). Regards, BALATON Zoltan