From nobody Thu Apr 2 01:08:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1774983196; cv=none; d=zohomail.com; s=zohoarc; b=UyKAbLlUeYlvAgLW1f6OkYvBWWl8PKlK5cm9tyVGIGoMdqoPH3jWrGsZmnOTti+sbTWywZu1hqv+3jD3a64IvQJRC1NebwSDTmnp8vb4+zuJXYgBpERXnc40g/fA3LaLnPMAMW7fV8LY1rxoeYM4OvM0KMPgrb7J7lkBydk6c14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774983196; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Dvj/cFnHutoDuzNT4EN5SKggCUWLeQAsAgr9B1lelc8=; b=F0EMk9lyfw3Y2ti0yY0FdJwuDgwQLz/32akQToYT1zWlYXO8ejhOJrCuXCjf0kaWlY9ehMHaIvKJEPn14a8jnRPqnsmjvhtuD1oQoEefR+V+Nuh2pHSJuBVGJxlWeB0cb2eHEqrLKOPfMxTx2+oiIcMeg/QEh8P7JQk7HtsjOKI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774983196496492.52241943954016; Tue, 31 Mar 2026 11:53:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7eCZ-0000E1-U5; Tue, 31 Mar 2026 14:52:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7eCY-0000Da-QA for qemu-devel@nongnu.org; Tue, 31 Mar 2026 14:52:34 -0400 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7eCX-0001Y8-54 for qemu-devel@nongnu.org; Tue, 31 Mar 2026 14:52:34 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 45A424359E; Tue, 31 Mar 2026 18:52:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F4BFC19423; Tue, 31 Mar 2026 18:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774983152; bh=gO1P5J3CHs5yjk6CA0dIlb4QEqGW5QSlz1afpeN9G+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1uIrPiHgu8q8SzMo57hAmCMvswwPJn8TvuA3pVrvx/cWuCGGsUch6gPUmIYgmkbI Jzd1+cTPOerJVSOgcMYDp4OfBe2XYcdOgo3GK1G83aYp07EMWbpM6SJjLh/1Iw5IZI 1G6sWMbJCM0mOCP7p+scx4NyPgB+B0CBkz07UtqIx3mC24nQcfyeSttcqzxmPXr3ya 2AP4XlOxqQxirkOfammoyju9icS+KphcFRHG/8zoWaIbroWlMpdoCfU47I+DohwhiR 6e2jZvAR4xQ8sFb0PzoWipKk7mdqYOeKV/ZnpBAkd4G0KRLIEsqcIf9bj/Iwlw6IRE guK0Tz9RNztqQ== From: Helge Deller To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson Subject: [PULL 7/8] hw/hppa: Implement memory ranges Date: Tue, 31 Mar 2026 20:52:18 +0200 Message-ID: <20260331185219.12187-8-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331185219.12187-1-deller@kernel.org> References: <20260331185219.12187-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1774983199467154100 Content-Type: text/plain; charset="utf-8" From: Helge Deller 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 --- 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 ad= dress */ =20 -#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 */ =20 #define MEM_PDC_ENTRY 0x4800 /* PDC entry address */ =20 diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 3663bac53b..abd75dfe7d 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -43,6 +43,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(HppaMachineState, HPPA_COMMON_= MACHINE) =20 struct HppaMachineState { MachineState parent_obj; + + uint64_t memsplit_addr; }; =20 #define MIN_SEABIOS_HPPA_VERSION 22 /* require at least this fw version */ @@ -208,6 +210,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIB= us *pci_bus, const char qemu_version[] =3D QEMU_VERSION; MachineClass *mc =3D MACHINE_GET_CLASS(ms); int btlb_entries =3D HPPA_BTLB_ENTRIES(&cpu[0]->env); + struct HppaMachineState *hpm =3D HPPA_COMMON_MACHINE(ms); int len; =20 fw_cfg =3D fw_cfg_init_mem_nodma(addr, addr + 4, 1); @@ -231,6 +234,10 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCI= Bus *pci_bus, fw_cfg_add_file(fw_cfg, "/etc/hppa/machine", g_memdup2(mc->name, len), len); =20 + val =3D cpu_to_le64(hpm->memsplit_addr); + fw_cfg_add_file(fw_cfg, "/etc/hppa/memsplit-addr", + g_memdup2(&val, sizeof(val)), sizeof(val)); + val =3D 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(Machine= State *machine) TranslateFn *translate; MemoryRegion *cpu_region; uint64_t ram_max; + struct HppaMachineState *hpm; + hwaddr splitaddr; =20 /* Create CPUs. */ for (unsigned int i =3D 0; i < smp_cpus; i++) { @@ -347,21 +356,36 @@ static TranslateFn *machine_HP_common_init_cpus(Machi= neState *machine) info_report("Max RAM size limited to %" PRIu64 " MB", ram_max / Mi= B); machine->ram_size =3D ram_max; } - if (machine->ram_size <=3D FIRMWARE_START) { - /* contiguous memory up to 3.75 GB RAM */ - memory_region_add_subregion_overlap(addr_space, 0, machine->ram, -= 1); - } else { + + hpm =3D 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 =3D 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 =3D FIRMWARE_START; + } + splitaddr =3D hpm->memsplit_addr; + + MemoryRegion *mem_region; + mem_region =3D g_new(MemoryRegion, 1); + memory_region_init_alias(&mem_region[0], &addr_space->parent_obj, + "memory0", 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 =3D g_new(MemoryRegion, 1); + memory_region_init_alias(&mem_region[0], &addr_space->parent_o= bj, + "memory1", 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 =3D g_new(MemoryRegion, 1); + memory_region_init_alias(&mem_region[0], &addr_space->parent_o= bj, + "memory2", machine->ram, splitaddr, + 4 * GiB - splitaddr); + memory_region_add_subregion_overlap(addr_space, RAM_MAP_HIGH2, + &mem_region[0], -1); + } } =20 return translate; @@ -756,6 +780,10 @@ static void machine_HP_C3700_init(MachineState *machin= e) */ static void machine_HP_A400_init(MachineState *machine) { + struct HppaMachineState *hpm; + + hpm =3D HPPA_COMMON_MACHINE(machine); + hpm->memsplit_addr =3D 1 * GiB; machine_HP_C3700_init(machine); } =20 @@ -814,7 +842,7 @@ static void hppa_machine_common_class_init(ObjectClass = *oc, const void *data) mc->default_cpus =3D 1; mc->max_cpus =3D HPPA_MAX_CPUS; mc->default_boot_order =3D "cd"; - mc->default_ram_id =3D "ram"; + mc->default_ram_id =3D "hppa.ram"; mc->default_nic =3D "tulip"; =20 nc->nmi_monitor_handler =3D hppa_nmi; --=20 2.53.0