From nobody Mon Nov 23 04:36:07 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 Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794236967462788.4694102601178; Mon, 9 Nov 2026 07:09:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xQQzH-0000ry-V5; Mon, 09 Nov 2026 10:08:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xQQzC-0000rH-Bd for qemu-devel@nongnu.org; Mon, 09 Nov 2026 10:08:42 -0500 Received: from proxmox-new.maurer-it.com ([94.136.29.106]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xQQzA-0008D8-C2 for qemu-devel@nongnu.org; Mon, 09 Nov 2026 10:08:42 -0500 Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 855D844FFF; Mon, 09 Nov 2026 16:08:33 +0100 (CET) From: Thomas Lamprecht To: qemu-devel@nongnu.org Cc: Sergio Lopez , Paolo Bonzini , "Michael S. Tsirkin" , Richard Henderson Subject: [PATCH for-11.2 1/2] hw/i386: move PC_FW_DATA to x86.h as X86_FW_DATA Date: Mon, 9 Nov 2026 10:33:42 +0100 Message-ID: <20261109150753.1727674-2-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261109150753.1727674-1-t.lamprecht@proxmox.com> References: <20261109150753.1727674-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794236912759 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=lists1p.gnu.org; Received-SPF: pass client-ip=94.136.29.106; envelope-from=t.lamprecht@proxmox.com; helo=proxmox-new.maurer-it.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 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: 1794236972716158500 Content-Type: text/plain; charset="utf-8" The size of the memory that the firmware uses at the top of RAM is passed to x86_load_linux(), which the microvm machine uses as well. Move it next to that function, so that microvm, which can be built without the PC machines, can use it too. No functional change. Signed-off-by: Thomas Lamprecht --- hw/i386/pc.c | 14 ++------------ include/hw/i386/x86.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 4737eb471c..09ef6d0783 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -185,16 +185,6 @@ const size_t pc_compat_4_2_len =3D G_N_ELEMENTS(pc_com= pat_4_2); GlobalProperty pc_compat_4_1[] =3D {}; const size_t pc_compat_4_1_len =3D G_N_ELEMENTS(pc_compat_4_1); =20 -/* - * @PC_FW_DATA: - * Size of the chunk of memory at the top of RAM for the BIOS ACPI tables - * and other BIOS datastructures. - * - * BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K - * reported to be used at the moment, 32K should be enough for a while. - */ -#define PC_FW_DATA (0x20000 + 0x8000) - GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled) { GSIState *s; @@ -576,7 +566,7 @@ void xen_load_linux(PCMachineState *pcms) fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus); rom_set_fw(fw_cfg); =20 - x86_load_linux(x86ms, fw_cfg, PC_FW_DATA); + x86_load_linux(x86ms, fw_cfg, X86_FW_DATA); for (i =3D 0; i < nb_option_roms; i++) { assert(!strcmp(option_rom[i].name, "linuxboot_dma.bin") || !strcmp(option_rom[i].name, "pvh.bin") || @@ -910,7 +900,7 @@ void pc_memory_init(PCMachineState *pcms, } =20 if (linux_boot) { - x86_load_linux(x86ms, fw_cfg, PC_FW_DATA); + x86_load_linux(x86ms, fw_cfg, X86_FW_DATA); } =20 for (i =3D 0; i < nb_option_roms; i++) { diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index abb073ca47..14251d5bb9 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -127,6 +127,16 @@ void x86_bios_rom_init(X86MachineState *x86ms, const c= har *default_firmware, MemoryRegion *rom_memory, bool isapc_ram_fw); void x86_bios_rom_reload(X86MachineState *x86ms); =20 +/* + * @X86_FW_DATA: + * Size of the chunk of memory at the top of RAM for the BIOS ACPI tables + * and other BIOS datastructures. + * + * BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K + * reported to be used at the moment, 32K should be enough for a while. + */ +#define X86_FW_DATA (0x20000 + 0x8000) + void x86_load_linux(X86MachineState *x86ms, FWCfgState *fw_cfg, int acpi_data_size); --=20 2.47.3 From nobody Mon Nov 23 04:36:07 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 Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794236985712378.1956862629029; Mon, 9 Nov 2026 07:09:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xQQzL-0000sz-Td; Mon, 09 Nov 2026 10:08:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xQQzE-0000rf-Es; Mon, 09 Nov 2026 10:08:44 -0500 Received: from proxmox-new.maurer-it.com ([94.136.29.106]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xQQzA-0008DB-Mc; Mon, 09 Nov 2026 10:08:43 -0500 Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A41C945E42; Mon, 09 Nov 2026 16:08:33 +0100 (CET) From: Thomas Lamprecht To: qemu-devel@nongnu.org Cc: Sergio Lopez , Paolo Bonzini , "Michael S. Tsirkin" , Richard Henderson , qemu-stable@nongnu.org Subject: [PATCH for-11.2 2/2] hw/i386/microvm: reserve the firmware data area when loading Linux Date: Mon, 9 Nov 2026 10:33:43 +0100 Message-ID: <20261109150753.1727674-3-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261109150753.1727674-1-t.lamprecht@proxmox.com> References: <20261109150753.1727674-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794236912871 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=lists1p.gnu.org; Received-SPF: pass client-ip=94.136.29.106; envelope-from=t.lamprecht@proxmox.com; helo=proxmox-new.maurer-it.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 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: 1794236988213158500 Content-Type: text/plain; charset="utf-8" microvm passes no firmware data size to x86_load_linux(), so QEMU places the initrd at the very top of RAM below 4G, where SeaBIOS also places the ACPI tables. Usually linuxboot_dma.bin then moves the initrd below the memory that the BIOS reports via E801. But it keeps the initrd in place if it ends in the page of the kernel's initrd_addr_max, 0x7fffffff for x86_64 kernels, taking that as a sign that the kernel's limit and not the end of RAM decided the placement. With exactly 2 GiB of RAM, both are the same page, so the initrd overwrites the ACPI tables and other data that SeaBIOS keeps there. Depending on the initrd size and the configuration, Linux then finds a corrupted DSDT, with PCIe enabled reports "AE_NO_ACPI_TABLES" and finds no PCI devices, or hangs while probing EDD, as the SeaBIOS virtio-blk driver then sends corrupted requests ("virtio-blk missing headers"). To fix thix reserve the same amount of memory as the PC machines do. This places the initrd below the firmware data in the first place and lets linuxboot_dma.bin move it below the BIOS data for 2 GiB of RAM, too. Fixes: 8045df14bcca ("microvm/acpi: add minimal acpi support") Cc: qemu-stable@nongnu.org Signed-off-by: Thomas Lamprecht --- hw/i386/microvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 18983a363b..b35facce08 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -330,7 +330,7 @@ static void microvm_memory_init(MicrovmMachineState *mm= s) rom_set_fw(fw_cfg); =20 if (machine->kernel_filename !=3D NULL) { - mmc->x86_load_linux(x86ms, fw_cfg, 0); + mmc->x86_load_linux(x86ms, fw_cfg, X86_FW_DATA); } =20 if (mms->option_roms) { --=20 2.47.3