From nobody Sun Jan 25 12:12:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769320085491407.83388634330106; Sat, 24 Jan 2026 21:48:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjsy8-00058S-Kq; Sun, 25 Jan 2026 00:47:28 -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 1vjsy7-00056R-FY; Sun, 25 Jan 2026 00:47:27 -0500 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjsy3-0008LC-D1; Sun, 25 Jan 2026 00:47:26 -0500 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 60P5kwTh058986 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 25 Jan 2026 14:47:10 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=gSy2fthNAgLFtO7DqQtljHu8OBiOWiA9vcKLW39U2fY=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1769320030; v=1; b=er+KdPfdOp1KCl4xnXYF4VOLUDJooC0k3lb2mTh4Q1Vrb9234Bmq1ev1EU+4vT7+ ygdjPhC3QOveT9yMH/94rrb40Cd/KA8229ncoVcrwPw2uz8BRVK43cSxbnMa+hTd zlE8HXou5vpPt7S011/A4X8NlOrUE/jYc1LECXdbtYrzi93S5RVYAIZqEAZBGsOA IdTfwWFPcIEDTKvadTsJX8UTf8SDxlxOllq3Jn4vmojtOBXwMweE+gwFmZAmBOCm dobKzW9WbHu+4Kc06p1nVm9KuXSeRUoRLjr2lxvlwAAy1smw51DzXcwiJGzN3qNZ FdFLZc3mWv9FufJ1c0dM5w== From: Akihiko Odaki Date: Sun, 25 Jan 2026 14:46:57 +0900 Subject: [PATCH v4 2/3] hw/arm/virt: Remove the lower bound of HighMem IO Regions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260125-virt-v4-2-00d726b27224@rsg.ci.i.u-tokyo.ac.jp> References: <20260125-virt-v4-0-00d726b27224@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260125-virt-v4-0-00d726b27224@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Eric Auger , Andrew Jones , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Akihiko Odaki X-Mailer: b4 0.15-dev-179e8 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_SUBJ_WIPE_DEBT=1.004 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-ZM-MESSAGEID: 1769320090253154100 Remove the lower bound of the Highmem IO Regions' addresses for the latest machine version to increase the chance to fit the regions in the PA space. The lower bound was especially problematic when using virt-install on Apple M2. virt-install 5.0.0 adds multiple pcie-root-port devices that require sufficient space in the ECAM region. However, the Highmem ECAM region did not fit in the limited PA space on the hardware, and the ECAM region size was limited to 16 MiB. If virt-install had added more than 16 devices to the root bridge, the region overflowed, which prevented edk2-stable202505 from scanning PCI devices, including the boot disk, causing boot failures. Ideally, a virtual machine with more than 16 devices added to the root bridge should just work so that users and management layers do not have to care whether they use constrained hardware. The base address of the Highmem IO Regions was fixed when commit f90747c4e8fb ("hw/arm/virt: GICv3 DT node with one or two redistributor regions") added the first Highmem IO Region. Later, commit 957e32cffa57 ("hw/arm/virt: Dynamic memory map depending on RAM requirements") allowed moving the Highmem IO Regions to higher addresses to accommodate RAM more than 255 GiB, but the lower bound remained to keep the legacy memory map. Remove the lower bound for the latest machine version to accommodate more devices with the root bridge. Keeping the lower bound for the old machine versions ensures the compatibility is still maintained. The hardcoded memory map in tests/qtest/libqos/generic-pcihost.c is also updated. Signed-off-by: Akihiko Odaki Reviewed-by: Eric Auger --- include/hw/arm/virt.h | 1 + hw/arm/virt.c | 16 ++++++++++++---- tests/qtest/libqos/generic-pcihost.c | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 8694aaa4e2a6..213792a01b65 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -121,6 +121,7 @@ typedef enum VirtGICType { =20 struct VirtMachineClass { MachineClass parent; + hwaddr min_highmem_base; bool no_tcg_its; bool no_highmem_compact; bool no_kvm_steal_time; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9d0568a7d56e..6b124172b1bf 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1935,6 +1935,7 @@ static void virt_set_high_memmap(VirtMachineState *vm= s, static void virt_set_memmap(VirtMachineState *vms, int pa_bits) { MachineState *ms =3D MACHINE(vms); + VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); hwaddr base, device_memory_base, device_memory_size, memtop; int i; =20 @@ -1961,8 +1962,7 @@ static void virt_set_memmap(VirtMachineState *vms, in= t pa_bits) /* * We compute the base of the high IO region depending on the * amount of initial and device memory. The device memory start/size - * is aligned on 1GiB. We never put the high IO region below 256GiB - * so that if maxram_size is < 255GiB we keep the legacy memory map. + * is aligned on 1GiB. * The device region size assumes 1GiB page max alignment per slot. */ device_memory_base =3D @@ -1980,8 +1980,8 @@ static void virt_set_memmap(VirtMachineState *vms, in= t pa_bits) error_report("maxmem/slots too huge"); exit(EXIT_FAILURE); } - if (base < vms->memmap[VIRT_MEM].base + LEGACY_RAMLIMIT_BYTES) { - base =3D vms->memmap[VIRT_MEM].base + LEGACY_RAMLIMIT_BYTES; + if (base < vmc->min_highmem_base) { + base =3D vmc->min_highmem_base; } =20 /* We know for sure that at least the memory fits in the PA space */ @@ -3547,9 +3547,17 @@ DEFINE_VIRT_MACHINE(10, 2) =20 static void virt_machine_10_1_options(MachineClass *mc) { + VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_machine_10_2_options(mc); mc->smbios_memory_device_size =3D 2047 * TiB; compat_props_add(mc->compat_props, hw_compat_10_1, hw_compat_10_1_len); + + /* + * Do not put the high IO region below 256GiB so that if maxram_size is + * < 255GiB we keep the legacy memory map. + */ + vmc->min_highmem_base =3D base_memmap[VIRT_MEM].base + LEGACY_RAMLIMIT= _BYTES; } DEFINE_VIRT_MACHINE(10, 1) =20 diff --git a/tests/qtest/libqos/generic-pcihost.c b/tests/qtest/libqos/gene= ric-pcihost.c index 4bbeb5ff508e..01d698a2490d 100644 --- a/tests/qtest/libqos/generic-pcihost.c +++ b/tests/qtest/libqos/generic-pcihost.c @@ -210,7 +210,7 @@ void qpci_init_generic(QGenericPCIBus *qpci, QTestState= *qts, qpci->bus.pio_limit =3D 0x10000; qpci->bus.mmio_alloc_ptr =3D 0x10000000; qpci->bus.mmio_limit =3D 0x2eff0000; - qpci->ecam_alloc_ptr =3D 0x4010000000; + qpci->ecam_alloc_ptr =3D 0x90000000; =20 qpci->obj.get_driver =3D qpci_generic_get_driver; } --=20 2.52.0