From nobody Sat Apr 5 17:46:21 2025 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=1737748497; cv=none; d=zohomail.com; s=zohoarc; b=PpCBUbtVuk1u3uAnpOgP8L6HYzBHcFLUHYMKofrzSDvo36UnKfPTn9S2noBVNHf1cP2WcbEzB6Ehgm5IxibG8OtJ+jiloXsb9mMdukPbW8JHvHG8QdL2iV1/a2YntOAA9H3z5I6II8BEpej4p9z5urYSDTIWB1KrNx0l/mmn7Io= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737748497; 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=n6J7P69DaeQP0NJs3C3kBaB/LDi62q9YN8UIJAJ2rF0=; b=iuZ8iCBg32fhq+OmfMY/PbLr9ldNidrXm502Wl90IO21Me0cCoNbRsdcnjQEABbFqZoVtsFJHtPp+4fgL9dm4LPT9BL7GYDG8cqUuj3bQWT5z6acOcEbJXaZ4UEp7xjLgXA+s8ResuDPeNaMgOJqDohk9FRkcyFZq18NQwFGRpQ= 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 173774849722980.81143158029158; Fri, 24 Jan 2025 11:54:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tbPkZ-0003Xl-1D; Fri, 24 Jan 2025 14:53:55 -0500 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 1tbPkX-0003Up-54 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 14:53:53 -0500 Received: from nyc.source.kernel.org ([147.75.193.91]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tbPkV-0004b2-Gc for qemu-devel@nongnu.org; Fri, 24 Jan 2025 14:53:52 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id C3089A41D67; Fri, 24 Jan 2025 19:52:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D34B7C4CED2; Fri, 24 Jan 2025 19:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737748429; bh=Th9t3g0zpK9CG7Q/pwb+jyn5riaLFm0lmHOeXZWJFJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dix7xf2v6uLtlsFXMO4E8hIb5zZmqc9UzAXzyjygjI3vr9duXTPmfVFGE7YrBAzm0 jndZI3v/YkAC9Rcki1FRPVbMcCRo8GU47HjNL8o0Z/kkalyLLZ6Kf1n1lIZAvqpbaC hcf2oc6iPiLC9HjCKGKV4UpNRUNb5QglyJLl2/gUfBjzfbrAAaP6JxSNTvJJE/5vFZ z9jbi/S5+R8HGGHmVllql919cee9Jai/M39XvtaX74tSo9rLwAz1zbucWL00C/vxKR U5KckgxgA+aR3JdXMxhkR1LFI7gTxnG6Wl7je0YJHSwRuk6PmNzPHG0SR5wcY2OrMc fWh7cvahJvrVA== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PULL 1/2] hw/hppa: Support up to 256 GiB RAM on 64-bit machines Date: Fri, 24 Jan 2025 20:53:44 +0100 Message-ID: <20250124195345.15118-2-deller@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250124195345.15118-1-deller@kernel.org> References: <20250124195345.15118-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=147.75.193.91; envelope-from=deller@kernel.org; helo=nyc.source.kernel.org X-Spam_score_int: -73 X-Spam_score: -7.4 X-Spam_bar: ------- X-Spam_report: (-7.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.996, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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: 1737748500042019100 Content-Type: text/plain; charset="utf-8" From: Helge Deller 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 Reviewed-by: Richard Henderson --- hw/hppa/hppa_hardware.h | 2 ++ hw/hppa/machine.c | 26 +++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/hw/hppa/hppa_hardware.h b/hw/hppa/hppa_hardware.h index a9be7bb851..a276240967 100644 --- a/hw/hppa/hppa_hardware.h +++ b/hw/hppa/hppa_hardware.h @@ -49,4 +49,6 @@ #define CPU_HPA_CR_REG 7 /* store CPU HPA in cr7 (SeaBIOS internal)= */ #define PIM_STORAGE_SIZE 600 /* storage size of pdc_pim_toc_struct (64bit)= */ =20 +#define RAM_MAP_HIGH 0x0100000000 /* memory above 3.75 GB is mapped here= */ + #endif diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 8230f43e41..4bcc66cd6f 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -283,16 +283,13 @@ static TranslateFn *machine_HP_common_init_cpus(Machi= neState *machine) cpu[i] =3D HPPA_CPU(cpu_create(machine->cpu_type)); } =20 - /* - * For now, treat address layout as if PSW_W is clear. - * TODO: create a proper hppa64 board model and load elf64 firmware. - */ + /* Initialize memory */ if (hppa_is_pa20(&cpu[0]->env)) { translate =3D translate_pa20; - ram_max =3D 0xf0000000; /* 3.75 GB (limited by 32-bit firmwar= e) */ + ram_max =3D 256 * GiB; /* like HP rp8440 */ } else { translate =3D translate_pa10; - ram_max =3D 0xf0000000; /* 3.75 GB (32-bit CPU) */ + ram_max =3D FIRMWARE_START; /* 3.75 GB (32-bit CPU) */ } =20 soft_power_reg =3D translate(NULL, HPA_POWER_BUTTON); @@ -320,7 +317,22 @@ static TranslateFn *machine_HP_common_init_cpus(Machin= eState *machine) info_report("Max RAM size limited to %" PRIu64 " MB", ram_max / Mi= B); machine->ram_size =3D ram_max; } - memory_region_add_subregion_overlap(addr_space, 0, machine->ram, -1); + 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 { + /* 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); + } =20 return translate; } --=20 2.47.0