Skip to content

Commit d0ad411

Browse files
committed
hw/hppa: Support up to 256 GiB RAM on 64-bit machines
Allow up to 256 GB RAM, which is the maximum a rp8440 machine (the very last 64-bit PA-RISC machine) physically supports. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
1 parent 32a97c5 commit d0ad411

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

hw/hppa/hppa_hardware.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@
4949
#define CPU_HPA_CR_REG 7 /* store CPU HPA in cr7 (SeaBIOS internal) */
5050
#define PIM_STORAGE_SIZE 600 /* storage size of pdc_pim_toc_struct (64bit) */
5151

52+
#define RAM_MAP_HIGH 0x0100000000 /* memory above 3.75 GB is mapped here */
53+
5254
#endif

hw/hppa/machine.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,13 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine)
283283
cpu[i] = HPPA_CPU(cpu_create(machine->cpu_type));
284284
}
285285

286-
/*
287-
* For now, treat address layout as if PSW_W is clear.
288-
* TODO: create a proper hppa64 board model and load elf64 firmware.
289-
*/
286+
/* Initialize memory */
290287
if (hppa_is_pa20(&cpu[0]->env)) {
291288
translate = translate_pa20;
292-
ram_max = 0xf0000000; /* 3.75 GB (limited by 32-bit firmware) */
289+
ram_max = 256 * GiB; /* like HP rp8440 */
293290
} else {
294291
translate = translate_pa10;
295-
ram_max = 0xf0000000; /* 3.75 GB (32-bit CPU) */
292+
ram_max = FIRMWARE_START; /* 3.75 GB (32-bit CPU) */
296293
}
297294

298295
soft_power_reg = translate(NULL, HPA_POWER_BUTTON);
@@ -320,7 +317,22 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine)
320317
info_report("Max RAM size limited to %" PRIu64 " MB", ram_max / MiB);
321318
machine->ram_size = ram_max;
322319
}
323-
memory_region_add_subregion_overlap(addr_space, 0, machine->ram, -1);
320+
if (machine->ram_size <= FIRMWARE_START) {
321+
/* contiguous memory up to 3.75 GB RAM */
322+
memory_region_add_subregion_overlap(addr_space, 0, machine->ram, -1);
323+
} else {
324+
/* non-contiguous: Memory above 3.75 GB is mapped at RAM_MAP_HIGH */
325+
MemoryRegion *mem_region;
326+
mem_region = g_new(MemoryRegion, 2);
327+
memory_region_init_alias(&mem_region[0], &addr_space->parent_obj,
328+
"LowMem", machine->ram, 0, FIRMWARE_START);
329+
memory_region_init_alias(&mem_region[1], &addr_space->parent_obj,
330+
"HighMem", machine->ram, FIRMWARE_START,
331+
machine->ram_size - FIRMWARE_START);
332+
memory_region_add_subregion_overlap(addr_space, 0, &mem_region[0], -1);
333+
memory_region_add_subregion_overlap(addr_space, RAM_MAP_HIGH,
334+
&mem_region[1], -1);
335+
}
324336

325337
return translate;
326338
}

0 commit comments

Comments
 (0)