Real hardware allows to plug in up to 4Gb RAM into memory slots. So allow user specify up to 4Gb and map all of it into guest address space.
PS: * guest will still see 3840m being reported in cpu[0]->env.gr[26] and won't be avare of remaining ~248Mb, as it doesn't have other means to discover RAM above firmware ROM. * use local ram_size to avoid changing global one which shouldn't be changed boards and will be removed in the future Requested-by: Helge Deller <del...@gmx.de> Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- v2: - make main ram -1 prio, so it wouldn't conflict with other regions starting from 0xf9000000 (Philippe Mathieu-Daudé <phi...@redhat.com>) - avoid type size comparision error on migw32 host with ram_addr_t - simplify code a bit using local ram_size var. - rewrite commit message v3: - drop "hppa: drop RAM size fixup" - rewrite commit message - use 64-bit local ram_size to workaround always false condition "if (ram_size > 4 * GiB)" when building on 32-bit host (mingw-32) as it's preffered over ifdefs. --- hw/hppa/machine.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 5d0de26..d63b61e 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -73,10 +73,9 @@ static void machine_hppa_init(MachineState *machine) MemoryRegion *ram_region; MemoryRegion *cpu_region; long i; + uint64_t ram_size = machine->ram_size; unsigned int smp_cpus = machine->smp.cpus; - ram_size = machine->ram_size; - /* Create CPUs. */ for (i = 0; i < smp_cpus; i++) { char *name = g_strdup_printf("cpu%ld-io-eir", i); @@ -91,15 +90,17 @@ static void machine_hppa_init(MachineState *machine) } /* Limit main memory. */ - if (ram_size > FIRMWARE_START) { - machine->ram_size = ram_size = FIRMWARE_START; + if (ram_size > 4 * GiB) { + error_report("RAM size more than 4Gb is not supported"); + exit(EXIT_FAILURE); } + ram_size = ram_size > FIRMWARE_START ? FIRMWARE_START : ram_size; /* Main memory region. */ ram_region = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(ram_region, OBJECT(machine), "ram", ram_size); - memory_region_add_subregion(addr_space, 0, ram_region); + memory_region_add_subregion_overlap(addr_space, 0, ram_region, -1); /* Init Dino (PCI host bus chip). */ pci_bus = dino_init(addr_space, &rtc_irq, &serial_irq); @@ -246,6 +247,8 @@ static void machine_hppa_init(MachineState *machine) static void hppa_machine_reset(MachineState *ms) { unsigned int smp_cpus = ms->smp.cpus; + uint64_t ram_size = ms->ram_size > FIRMWARE_START ? FIRMWARE_START : + ms->ram_size; int i; qemu_devices_reset(); -- 2.7.4