From: Helge Deller <deller@kernel.org>
To: qemu-devel@nongnu.org
Cc: deller@gmx.de, Richard Henderson <richard.henderson@linaro.org>
Subject: [PATCH 10/11] hw/hppa: Implement memory ranges
Date: Mon, 30 Mar 2026 23:18:57 +0200 [thread overview]
Message-ID: <20260330211859.19317-11-deller@kernel.org> (raw)
In-Reply-To: <20260330211859.19317-1-deller@kernel.org>
From: Helge Deller <deller@gmx.de>
All 64-bit PA-RISC machines split the memory into (up to 3) different
memory ranges, which are mapped at specific addresses. This patch
mimics the mapping as it's done on physical machines, which includes the
3.75 GB split for C3700, and 1 GB split for newer 64-bit PAT machines
like the A400.
SeaBIOS-hppa needs to know how the memory split is done, so add a new
memsplit_addr variable which stores the specific split address and hand
this over to SeaBIOS-hppa via fwcfg.
Signed-off-by: Helge Deller <deller@gmx.de>
---
hw/hppa/hppa_hardware.h | 3 ++-
hw/hppa/machine.c | 58 ++++++++++++++++++++++++++++++-----------
2 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/hw/hppa/hppa_hardware.h b/hw/hppa/hppa_hardware.h
index 006aae63b9..e2b2faa4a3 100644
--- a/hw/hppa/hppa_hardware.h
+++ b/hw/hppa/hppa_hardware.h
@@ -8,7 +8,8 @@
#define FIRMWARE_END 0xf0100000
#define FIRMWARE_HIGH 0xfffffff0 /* upper 32-bits of 64-bit firmware address */
-#define RAM_MAP_HIGH 0x0100000000 /* memory above 3.75 GB is mapped here */
+#define RAM_MAP_HIGH1 0x0100000000 /* memory above 4 GB */
+#define RAM_MAP_HIGH2 0x4040000000 /* memory between 1 G and 3.75 GB */
#define MEM_PDC_ENTRY 0x4800 /* PDC entry address */
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 58e76bee2e..eece05ab65 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -43,6 +43,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(HppaMachineState, HPPA_COMMON_MACHINE)
struct HppaMachineState {
MachineState parent_obj;
+
+ uint64_t memsplit_addr;
};
#define MIN_SEABIOS_HPPA_VERSION 22 /* require at least this fw version */
@@ -208,6 +210,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus,
const char qemu_version[] = QEMU_VERSION;
MachineClass *mc = MACHINE_GET_CLASS(ms);
int btlb_entries = HPPA_BTLB_ENTRIES(&cpu[0]->env);
+ struct HppaMachineState *hpm = HPPA_COMMON_MACHINE(ms);
int len;
fw_cfg = fw_cfg_init_mem_nodma(addr, addr + 4, 1);
@@ -231,6 +234,10 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus,
fw_cfg_add_file(fw_cfg, "/etc/hppa/machine",
g_memdup2(mc->name, len), len);
+ val = cpu_to_le64(hpm->memsplit_addr);
+ fw_cfg_add_file(fw_cfg, "/etc/hppa/memsplit-addr",
+ g_memdup2(&val, sizeof(val)), sizeof(val));
+
val = cpu_to_le64(soft_power_reg);
fw_cfg_add_file(fw_cfg, "/etc/hppa/power-button-addr",
g_memdup2(&val, sizeof(val)), sizeof(val));
@@ -287,6 +294,8 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine)
TranslateFn *translate;
MemoryRegion *cpu_region;
uint64_t ram_max;
+ struct HppaMachineState *hpm;
+ hwaddr splitaddr;
/* Create CPUs. */
for (unsigned int i = 0; i < smp_cpus; i++) {
@@ -347,21 +356,36 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine)
info_report("Max RAM size limited to %" PRIu64 " MB", ram_max / MiB);
machine->ram_size = ram_max;
}
- if (machine->ram_size <= FIRMWARE_START) {
- /* contiguous memory up to 3.75 GB RAM */
- memory_region_add_subregion_overlap(addr_space, 0, machine->ram, -1);
- } else {
+
+ hpm = HPPA_COMMON_MACHINE(machine);
+ if (!hpm->memsplit_addr) {
/* non-contiguous: Memory above 3.75 GB is mapped at RAM_MAP_HIGH */
- MemoryRegion *mem_region;
- mem_region = g_new(MemoryRegion, 2);
- memory_region_init_alias(&mem_region[0], &addr_space->parent_obj,
- "LowMem", machine->ram, 0, FIRMWARE_START);
- memory_region_init_alias(&mem_region[1], &addr_space->parent_obj,
- "HighMem", machine->ram, FIRMWARE_START,
- machine->ram_size - FIRMWARE_START);
- memory_region_add_subregion_overlap(addr_space, 0, &mem_region[0], -1);
- memory_region_add_subregion_overlap(addr_space, RAM_MAP_HIGH,
- &mem_region[1], -1);
+ hpm->memsplit_addr = FIRMWARE_START;
+ }
+ splitaddr = hpm->memsplit_addr;
+
+ MemoryRegion *mem_region;
+ mem_region = g_new(MemoryRegion, 1);
+ memory_region_init_alias(&mem_region[0], &addr_space->parent_obj,
+ "Range0_Mem", machine->ram, 0, splitaddr);
+ memory_region_add_subregion_overlap(addr_space, 0, &mem_region[0], -1);
+ if (hppa_is_pa20(&cpu[0]->env)) {
+ if (machine->ram_size > 4 * GiB) {
+ mem_region = g_new(MemoryRegion, 1);
+ memory_region_init_alias(&mem_region[0], &addr_space->parent_obj,
+ "Range1_Mem", machine->ram, 4 * GiB,
+ machine->ram_size - 4 * GiB);
+ memory_region_add_subregion_overlap(addr_space, RAM_MAP_HIGH1,
+ &mem_region[0], -1);
+ }
+ if (machine->ram_size > splitaddr) {
+ mem_region = g_new(MemoryRegion, 1);
+ memory_region_init_alias(&mem_region[0], &addr_space->parent_obj,
+ "Range2_Mem", machine->ram, splitaddr,
+ 4 * GiB - splitaddr);
+ memory_region_add_subregion_overlap(addr_space, RAM_MAP_HIGH2,
+ &mem_region[0], -1);
+ }
}
return translate;
@@ -757,6 +781,10 @@ static void machine_HP_C3700_init(MachineState *machine)
*/
static void machine_HP_A400_init(MachineState *machine)
{
+ struct HppaMachineState *hpm;
+
+ hpm = HPPA_COMMON_MACHINE(machine);
+ hpm->memsplit_addr = 1 * GiB;
machine_HP_C3700_init(machine);
}
@@ -815,7 +843,7 @@ static void hppa_machine_common_class_init(ObjectClass *oc, const void *data)
mc->default_cpus = 1;
mc->max_cpus = HPPA_MAX_CPUS;
mc->default_boot_order = "cd";
- mc->default_ram_id = "ram";
+ mc->default_ram_id = "hppa.ram";
mc->default_nic = "tulip";
nc->nmi_monitor_handler = hppa_nmi;
--
2.53.0
next prev parent reply other threads:[~2026-03-30 21:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 21:18 [PATCH 00/11] HPPA Patches for qemu-v11 Helge Deller
2026-03-30 21:18 ` [PATCH 01/11] hw/pci-host/astro: Update copyright and documentation link Helge Deller
2026-03-31 9:35 ` Philippe Mathieu-Daudé
2026-03-30 21:18 ` [PATCH 02/11] hw/hppa: Disable Artist graphics card on 64-bit machines Helge Deller
2026-03-30 21:42 ` Philippe Mathieu-Daudé
2026-03-31 8:58 ` Helge Deller
2026-03-31 9:34 ` Philippe Mathieu-Daudé
2026-03-30 21:18 ` [PATCH 03/11] hw/pci-host/astro: Make astro address arrays accessible for other users Helge Deller
2026-03-30 21:18 ` [PATCH 04/11] hw/pci-host/astro: Fix initial addresses in IOC Helge Deller
2026-03-30 21:18 ` [PATCH 05/11] hw/pci-host/astro: Implement LMMIO registers Helge Deller
2026-03-30 21:18 ` [PATCH 06/11] hw/pci-host/astro: Fix LMMIO DIRECT mappings Helge Deller
2026-03-30 21:18 ` [PATCH 07/11] hw/pci-host/astro: Add GMMIO mapping Helge Deller
2026-03-30 21:56 ` Philippe Mathieu-Daudé
2026-03-30 22:29 ` Helge Deller
2026-03-31 9:14 ` Philippe Mathieu-Daudé
2026-03-30 21:18 ` [PATCH 08/11] hw/pci-host/astro: Add comment about Astro version numbers Helge Deller
2026-03-30 21:54 ` Philippe Mathieu-Daudé
2026-03-31 16:57 ` Helge Deller
2026-03-30 21:18 ` [PATCH 09/11] target/hppa: Fix TOC handler for 64-bit CPUs Helge Deller
2026-03-30 21:52 ` Philippe Mathieu-Daudé
2026-03-30 21:18 ` Helge Deller [this message]
2026-03-31 13:09 ` [PATCH 00/11] HPPA Patches for qemu-v11 Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260330211859.19317-11-deller@kernel.org \
--to=deller@kernel.org \
--cc=deller@gmx.de \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.