From nobody Sun May 5 19:32:11 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634739139821411.363645003462; Wed, 20 Oct 2021 07:12:19 -0700 (PDT) Received: from localhost ([::1]:45400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdCKI-0007lx-R9 for importer@patchew.org; Wed, 20 Oct 2021 10:12:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdCDT-0005T0-IB for qemu-devel@nongnu.org; Wed, 20 Oct 2021 10:05:16 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:33687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdCDR-0007hF-Kx for qemu-devel@nongnu.org; Wed, 20 Oct 2021 10:05:15 -0400 Received: by mail-ed1-x52a.google.com with SMTP id y30so24366117edi.0 for ; Wed, 20 Oct 2021 07:05:13 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id a4sm1287095edk.71.2021.10.20.07.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 07:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h9p/+sNJF4UoADiuc/UNzSuF6N6VVZml17lGfFKsmQU=; b=lHiXzDUFpHNkuGUXdMfsEkaBnpBulIuQDzxKfFlK9IvcE3QAG88e3kKCDOnBbC7zY0 FEtV9+AqL6q7XaGX0OQfGcipCx7CDQzFd7o5nIuGZsv9uGIopOXOOpV2G9DWhyPgGAT/ zKylxssNR/nEjMZSZJ2F1LdjDNmF7Vrd/IV64KZ1zN6dN/Gc1Y/9JbFe4zWQph0CjWlB Wh4l2QmJvBnWIuu+8UM6MxvXLTa8nl2cQKur5fHgqMqK+AQwX6JBP5VN3lzwoPYmLPaJ f27SOlyDmg5q/6rOPe+dBzaxCkbmn6ys8yGwjoTANlPtia0SPCUXgfgWeM1m44Vd06ZY Sd0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=h9p/+sNJF4UoADiuc/UNzSuF6N6VVZml17lGfFKsmQU=; b=mTg4PiUtdCIt2hSt6oqVIcQd32M/aksVzyfrtb6UdMa1lNEQiVXH0lgT5zEO6LubGO 5B74OtVClQb45Pud0anVfXQGEhOBmMLjPOaiLXclkA+mSixC4lCklXKCL03dyGF1O4oa Ttczjl9H/5sX+TqWOM5Dmpbmrd+6mlviXbTVoF6eNh3mUICK+Vdp/NRg0xZu6OUqp/pu dShFmJXokUPxtTnp9Ok/JOnc4kP8AM6a+C//nyMil6N0UsOz9FONLSA0MHH0wpj5lmw8 pBSRRhxIno5a5KHxedo058jzpIwQYpLk3/dwle2o94h9eY1UeysM4eCeROP1duPU1UDF bhKw== X-Gm-Message-State: AOAM533XG/D4N/X+AFHDQVfB3M3Xl9ADu0nogaW17AM6f9/YBKj1DbZr 8BCSV5QFTeliHFtA/6G7Zx5XjqW9J3k= X-Google-Smtp-Source: ABdhPJzcpcZCBgzbPUv1SbQwa7TaEolnCg121tznNN3EEVW4fKLtvINPBOuNhBqAsTQLYZPyNjtc0A== X-Received: by 2002:a05:6402:402:: with SMTP id q2mr258953edv.248.1634738571158; Wed, 20 Oct 2021 07:02:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 1/3] target/i386: move linuxboot_dma_enabled to X86MachineState Date: Wed, 20 Oct 2021 16:02:42 +0200 Message-Id: <20211020140244.485249-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211020140244.485249-1-pbonzini@redhat.com> References: <20211020140244.485249-1-pbonzini@redhat.com> 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=2a00:1450:4864:20::52a; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: adam@l4re.org, marcus.haehnel@kernkonzept.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634739140946100001 Content-Type: text/plain; charset="utf-8" This removes a parameter from x86_load_linux, and will avoid code duplication between the linux and multiboot cases once multiboot starts to support DMA. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- hw/i386/microvm.c | 5 ++++- hw/i386/pc.c | 5 ++--- hw/i386/pc_piix.c | 3 ++- hw/i386/pc_q35.c | 3 ++- hw/i386/x86.c | 5 +++-- include/hw/i386/pc.h | 3 --- include/hw/i386/x86.h | 5 +++-- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index f257ec5a0b..837bafb64a 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -331,7 +331,7 @@ static void microvm_memory_init(MicrovmMachineState *mm= s) rom_set_fw(fw_cfg); =20 if (machine->kernel_filename !=3D NULL) { - x86_load_linux(x86ms, fw_cfg, 0, true, true); + x86_load_linux(x86ms, fw_cfg, 0, true); } =20 if (mms->option_roms) { @@ -667,6 +667,7 @@ static void microvm_machine_initfn(Object *obj) =20 static void microvm_class_init(ObjectClass *oc, void *data) { + X86MachineClass *x86mc =3D X86_MACHINE_CLASS(oc); MachineClass *mc =3D MACHINE_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 @@ -697,6 +698,8 @@ static void microvm_class_init(ObjectClass *oc, void *d= ata) hc->unplug_request =3D microvm_device_unplug_request_cb; hc->unplug =3D microvm_device_unplug_cb; =20 + x86mc->fwcfg_dma_enabled =3D true; + object_class_property_add(oc, MICROVM_MACHINE_PIC, "OnOffAuto", microvm_machine_get_pic, microvm_machine_set_pic, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 86223acfd3..d203db7845 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -775,7 +775,7 @@ void xen_load_linux(PCMachineState *pcms) rom_set_fw(fw_cfg); =20 x86_load_linux(x86ms, fw_cfg, pcmc->acpi_data_size, - pcmc->pvh_enabled, pcmc->linuxboot_dma_enabled); + pcmc->pvh_enabled); for (i =3D 0; i < nb_option_roms; i++) { assert(!strcmp(option_rom[i].name, "linuxboot.bin") || !strcmp(option_rom[i].name, "linuxboot_dma.bin") || @@ -927,7 +927,7 @@ void pc_memory_init(PCMachineState *pcms, =20 if (linux_boot) { x86_load_linux(x86ms, fw_cfg, pcmc->acpi_data_size, - pcmc->pvh_enabled, pcmc->linuxboot_dma_enabled); + pcmc->pvh_enabled); } =20 for (i =3D 0; i < nb_option_roms; i++) { @@ -1664,7 +1664,6 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) /* BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K rep= orted * to be used at the moment, 32K should be enough for a while. */ pcmc->acpi_data_size =3D 0x20000 + 0x8000; - pcmc->linuxboot_dma_enabled =3D true; pcmc->pvh_enabled =3D true; pcmc->kvmclock_create_always =3D true; assert(!mc->get_hotplug_handler); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 6ad0d763c5..223dd3e05d 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -620,11 +620,12 @@ DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL, =20 static void pc_i440fx_2_6_machine_options(MachineClass *m) { + X86MachineClass *x86mc =3D X86_MACHINE_CLASS(m); PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); =20 pc_i440fx_2_7_machine_options(m); pcmc->legacy_cpu_hotplug =3D true; - pcmc->linuxboot_dma_enabled =3D false; + x86mc->fwcfg_dma_enabled =3D false; compat_props_add(m->compat_props, hw_compat_2_6, hw_compat_2_6_len); compat_props_add(m->compat_props, pc_compat_2_6, pc_compat_2_6_len); } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index fcc6e4eb2b..797e09500b 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -573,11 +573,12 @@ DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL, =20 static void pc_q35_2_6_machine_options(MachineClass *m) { + X86MachineClass *x86mc =3D X86_MACHINE_CLASS(m); PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); =20 pc_q35_2_7_machine_options(m); pcmc->legacy_cpu_hotplug =3D true; - pcmc->linuxboot_dma_enabled =3D false; + x86mc->fwcfg_dma_enabled =3D false; compat_props_add(m->compat_props, hw_compat_2_6, hw_compat_2_6_len); compat_props_add(m->compat_props, pc_compat_2_6, pc_compat_2_6_len); } diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 76de7e2265..a34498fe16 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -764,9 +764,9 @@ static bool load_elfboot(const char *kernel_filename, void x86_load_linux(X86MachineState *x86ms, FWCfgState *fw_cfg, int acpi_data_size, - bool pvh_enabled, - bool linuxboot_dma_enabled) + bool pvh_enabled) { + bool linuxboot_dma_enabled =3D X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma= _enabled; uint16_t protocol; int setup_size, kernel_size, cmdline_size; int dtb_size, setup_data_offset; @@ -1332,6 +1332,7 @@ static void x86_machine_class_init(ObjectClass *oc, v= oid *data) mc->possible_cpu_arch_ids =3D x86_possible_cpu_arch_ids; x86mc->compat_apic_id_mode =3D false; x86mc->save_tsc_khz =3D true; + x86mc->fwcfg_dma_enabled =3D true; nc->nmi_monitor_handler =3D x86_nmi; =20 object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto", diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 11426e26dc..9162aded21 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -116,9 +116,6 @@ struct PCMachineClass { /* generate legacy CPU hotplug AML */ bool legacy_cpu_hotplug; =20 - /* use DMA capable linuxboot option rom */ - bool linuxboot_dma_enabled; - /* use PVH to load kernels that support this feature */ bool pvh_enabled; =20 diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 23267a3674..bb1cfb8896 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -38,6 +38,8 @@ struct X86MachineClass { bool save_tsc_khz; /* Enables contiguous-apic-ID mode */ bool compat_apic_id_mode; + /* use DMA capable linuxboot option rom */ + bool fwcfg_dma_enabled; }; =20 struct X86MachineState { @@ -120,8 +122,7 @@ void x86_bios_rom_init(MachineState *ms, const char *de= fault_firmware, void x86_load_linux(X86MachineState *x86ms, FWCfgState *fw_cfg, int acpi_data_size, - bool pvh_enabled, - bool linuxboot_dma_enabled); + bool pvh_enabled); =20 bool x86_machine_is_smm_enabled(const X86MachineState *x86ms); bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms); --=20 2.31.1 From nobody Sun May 5 19:32:11 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634739128760719.2284053478284; Wed, 20 Oct 2021 07:12:08 -0700 (PDT) Received: from localhost ([::1]:44860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdCK6-0007PI-S6 for importer@patchew.org; Wed, 20 Oct 2021 10:12:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdCCh-0004cC-Lw for qemu-devel@nongnu.org; Wed, 20 Oct 2021 10:04:28 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:36366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdCCe-0006Vp-DO for qemu-devel@nongnu.org; Wed, 20 Oct 2021 10:04:27 -0400 Received: by mail-ed1-x529.google.com with SMTP id d3so27354186edp.3 for ; Wed, 20 Oct 2021 07:04:24 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id a4sm1287095edk.71.2021.10.20.07.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 07:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0vUABkOdW3n1O+J/YlCSi4LCn6CSZ6NW/xi0cwG+LLU=; b=YwGxcfCRh9i+sBmBK3Ex4WWl4Fr53LQ/tafg0KmhORyumQUWN8tSZAxJnDzO2jtutF eAm+qAzEVZdd9WZ3iBTbnjPplSMLP4SMU2KW7hl1SdzunosZs4/oS+EbLKSOXxWIJR7G IyA+XMEjxFFRp9eAgKDK7fOiVWByMpW9NavxqxXFUVluJHoURm7ru7DEKYJhbLrixoIQ Tng1JqcUUp+I5IxxLWaLHRX4MdOjeV9gdvwLDMfb/k92CwMk4FX5Log3tlaQRi+Kxk0o gXLd/u2QMuPbbLtLQ1dzHi6P9aVztboafHAfWeVQ2801lnREMyavybeSTLQBPKK2GmHE 5MUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=0vUABkOdW3n1O+J/YlCSi4LCn6CSZ6NW/xi0cwG+LLU=; b=s+sLTeXwf/ayhxy48YFAsOixO35zm606e1i5jmnhV+7VlJpXi2Pu9p8KqBufr6MvYi lAqtsA+Y1eVUCIa3DgR48v3KrDfOQk4MHN6GqSRLcjxmbSYU7E8zzTXpXUrQ8a+3y+E1 RYi/xquBqO5N+9FC38/y13VCSimPDrDZDdEe6Uv4Fm54doxWbiUkrtznw8/X+GWNUqk2 Err59NInKBCTZDhUpYdwQ4g+CN7BXQz/sEZw/jvLfckQayCtG5tJ78aeyFxGjseCtnia 1o7jQpmJjIZDTgsFuCsnMQgldQ7V9Hepxcsyszav8Bb+RASnlQLq7IUnuky8ouLdEk+C wGNA== X-Gm-Message-State: AOAM530Cdjypn8xAtRNKA00gCSguSDl4w/H45KLp/tVCKc/znKbWoYW6 SEDAExIlixtnLrk7uSCqZxHQ1uHklYY= X-Google-Smtp-Source: ABdhPJxg1JIKWZz2JOOShqCDGB0IemY7/Wbl9lZAYRAfm17nUXMu8G2cmIe/2DzNfD3SYm5IUiNxLw== X-Received: by 2002:a17:907:330e:: with SMTP id ym14mr48792751ejb.417.1634738571901; Wed, 20 Oct 2021 07:02:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 2/3] optionrom: add a DMA-enabled multiboot ROM Date: Wed, 20 Oct 2021 16:02:43 +0200 Message-Id: <20211020140244.485249-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211020140244.485249-1-pbonzini@redhat.com> References: <20211020140244.485249-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::529; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: adam@l4re.org, marcus.haehnel@kernkonzept.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634739130641100001 From: Marcus H=C3=A4hnel Add a new option rom for the multiboot loader, using DMA transfers to copy data instead of "rep insb". This significantly lowers QEMU's startup latency by a factor of about 40, for example, going from 30sec to 0.8sec when loading modules of 120MB in size. Signed-off-by: Marcus H=C3=A4hnel Signed-off-by: Adam Lackorzynski [Modified to keep the non-DMA code depending on #ifdef USE_FW_CFG_DMA; do not write below stack. - Paolo] Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- pc-bios/meson.build | 1 + pc-bios/multiboot_dma.bin | Bin 0 -> 1024 bytes pc-bios/optionrom/Makefile | 4 +- pc-bios/optionrom/multiboot.S | 4 +- pc-bios/optionrom/multiboot_dma.S | 2 + pc-bios/optionrom/optionrom.h | 66 ++++++++++++++++++++++++++++++ 6 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 pc-bios/multiboot_dma.bin create mode 100644 pc-bios/optionrom/multiboot_dma.S diff --git a/pc-bios/meson.build b/pc-bios/meson.build index a44c9bc127..b40ff3f2bd 100644 --- a/pc-bios/meson.build +++ b/pc-bios/meson.build @@ -63,6 +63,7 @@ blobs =3D files( 'petalogix-s3adsp1800.dtb', 'petalogix-ml605.dtb', 'multiboot.bin', + 'multiboot_dma.bin', 'linuxboot.bin', 'linuxboot_dma.bin', 'kvmvapic.bin', diff --git a/pc-bios/multiboot_dma.bin b/pc-bios/multiboot_dma.bin new file mode 100644 index 0000000000000000000000000000000000000000..c0e2c3102a3358207c61d3ae113= 524fb6007abc3 GIT binary patch literal 1024 zcmd^-v1=3D1i9LIlmUTlcNU1}{N5`u&{DAHSmq6iKdix;GHRxaNnR0AR{3q;@~8~^LMo;4s!p158nI!-tWur_ul*P<{!&% z=3D%3>xm5f`4Bq!!)`Rkwf;(oFd*qcAb=3DmhXX1)X>Bw-tylkUpR_ETXkH1AnO4L$nJ| zWJui_M1kmKmTID)P`mI^=3DHM`~{VB1t1l_Ye=3DLor4X5{8Gd)zzw_o4<6zLQJ!drMolrKNZG2Z|kTOyaJIhYFc^ zFhhuQ9`r5fQLCrm#T4^_QylQ>8kgs;ZX9bIEiXb`8AIxu;?h~d%9izBkKht%WM1G* z^E{W9(OT9dt5in2qF}|dPH>dL>{=3DsV#-U1yFoWnOtw14D$&k*SUtsT%wS`ki@#&rUrnmtuDv`PtJm(Kg?H$Pdc0CL@YCy4R Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634738902671715.4160729515669; Wed, 20 Oct 2021 07:08:22 -0700 (PDT) Received: from localhost ([::1]:35450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdCGT-00011T-Lg for importer@patchew.org; Wed, 20 Oct 2021 10:08:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdCCE-0003xk-Jl for qemu-devel@nongnu.org; Wed, 20 Oct 2021 10:03:58 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:38592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdCC9-0006Ba-6O for qemu-devel@nongnu.org; Wed, 20 Oct 2021 10:03:58 -0400 Received: by mail-lf1-x12b.google.com with SMTP id x27so15340002lfu.5 for ; Wed, 20 Oct 2021 07:03:52 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id a4sm1287095edk.71.2021.10.20.07.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 07:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X3SQejK3WrW99drRT37J6slxXvRt4OUdqxEbD8zahlg=; b=QXLYyutTDW7TWfbJk9uAJCD3sZYczR4bniSii2KcVB8/+iCIIr8zycvNSvbKOZyC2h aYR/SjuyPhm66rWE+z01tQL8L+r19b2UBPpgQE6yWAVNjrCpfdvxeNbtlU3f5HfhGNuH 6TKmtxkhb+HM2cQBTCzAfyHq+7zocERndsYx7RQodAkJkOX+RX3THT1T61tf59pmItSR 8+RR9zgC9KyI4l03Ge/zMqMExahUhPVKD4fhrSv0EWLeFOOhWt+9Ssfh+4m1ohnju7lg r4Co2s/aJbbEdv6zi0/6DpRNEwVE9kx2zO/j47HdASNILFqO40cYvLmOPk1s94jCZRu3 UacA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=X3SQejK3WrW99drRT37J6slxXvRt4OUdqxEbD8zahlg=; b=mPqTSDg3889Hl8REfrzEl8ZisrKNOy3V8N0P80fxpmxKjENlbna255tPWgVQ/JKWEO Cqin0APjCE1tbMxLv6y1r+CKvwYErJxTCUbnaVjJGj9/nto+9OHE2dPR21gColVB18BP D+vgpKZU5bugdiE3TT/eDBhNijNQ467srchut0LONRZCcz26uh1Gf4xCBCP4qe8WIqYQ De9DAXDHKGjo+Y+sZ3d0KDPdU+aNegMhWtruN6hhtyrwcROxZdwGhafgDvVF4XkTbo5t /xb375Uj/o6cu4HHTRWljr4PfJYz03BwSpQJ98pO/u/jZLfIfMkk51OobZGv2j+K4ATJ SYvA== X-Gm-Message-State: AOAM531ZRBYvB+5YLqt0NuJn+nvoPu7kmpcgMSDEjWBZLnOIsuCdBfct AGWRDzi4RclOsxsauHqdJrSrMM/w5f0= X-Google-Smtp-Source: ABdhPJwmoetITe4aHhc92ZCycOH4tM9YhasWyO1kF4Kvn/XNRxBS+f/gauuAOWlv6oU7lG9cw8EWfA== X-Received: by 2002:a17:907:75c1:: with SMTP id jl1mr47404527ejc.288.1634738574043; Wed, 20 Oct 2021 07:02:54 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 3/3] target/i386: use DMA-enabled multiboot ROM for new-enough QEMU machine types Date: Wed, 20 Oct 2021 16:02:44 +0200 Message-Id: <20211020140244.485249-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211020140244.485249-1-pbonzini@redhat.com> References: <20211020140244.485249-1-pbonzini@redhat.com> 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=2a00:1450:4864:20::12b; envelope-from=paolo.bonzini@gmail.com; helo=mail-lf1-x12b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: adam@l4re.org, marcus.haehnel@kernkonzept.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634738930916100001 Content-Type: text/plain; charset="utf-8" As long as fw_cfg supports DMA, the new ROM can be used also on older machine types because it has the same size as the existing one. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- hw/i386/multiboot.c | 10 ++++++++-- hw/i386/multiboot.h | 4 +++- hw/i386/pc.c | 3 ++- hw/i386/x86.c | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c index 9e7d69d470..0a10089f14 100644 --- a/hw/i386/multiboot.c +++ b/hw/i386/multiboot.c @@ -143,7 +143,8 @@ static void mb_add_mod(MultibootState *s, s->mb_mods_count++; } =20 -int load_multiboot(FWCfgState *fw_cfg, +int load_multiboot(X86MachineState *x86ms, + FWCfgState *fw_cfg, FILE *f, const char *kernel_filename, const char *initrd_filename, @@ -151,6 +152,7 @@ int load_multiboot(FWCfgState *fw_cfg, int kernel_file_size, uint8_t *header) { + bool multiboot_dma_enabled =3D X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma= _enabled; int i, is_multiboot =3D 0; uint32_t flags =3D 0; uint32_t mh_entry_addr; @@ -401,7 +403,11 @@ int load_multiboot(FWCfgState *fw_cfg, fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data, sizeof(bootinfo)); =20 - option_rom[nb_option_roms].name =3D "multiboot.bin"; + if (multiboot_dma_enabled) { + option_rom[nb_option_roms].name =3D "multiboot_dma.bin"; + } else { + option_rom[nb_option_roms].name =3D "multiboot.bin"; + } option_rom[nb_option_roms].bootindex =3D 0; nb_option_roms++; =20 diff --git a/hw/i386/multiboot.h b/hw/i386/multiboot.h index 60de309cd1..2b9182a8ea 100644 --- a/hw/i386/multiboot.h +++ b/hw/i386/multiboot.h @@ -2,8 +2,10 @@ #define QEMU_MULTIBOOT_H =20 #include "hw/nvram/fw_cfg.h" +#include "hw/i386/x86.h" =20 -int load_multiboot(FWCfgState *fw_cfg, +int load_multiboot(X86MachineState *x86ms, + FWCfgState *fw_cfg, FILE *f, const char *kernel_filename, const char *initrd_filename, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d203db7845..fcfb7f7139 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -780,7 +780,8 @@ void xen_load_linux(PCMachineState *pcms) assert(!strcmp(option_rom[i].name, "linuxboot.bin") || !strcmp(option_rom[i].name, "linuxboot_dma.bin") || !strcmp(option_rom[i].name, "pvh.bin") || - !strcmp(option_rom[i].name, "multiboot.bin")); + !strcmp(option_rom[i].name, "multiboot.bin") || + !strcmp(option_rom[i].name, "multiboot_dma.bin")); rom_add_option(option_rom[i].name, option_rom[i].bootindex); } x86ms->fw_cfg =3D fw_cfg; diff --git a/hw/i386/x86.c b/hw/i386/x86.c index a34498fe16..b84840a1bb 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -814,7 +814,7 @@ void x86_load_linux(X86MachineState *x86ms, * PVH), so we try multiboot first since we check the multiboot ma= gic * header before to load it. */ - if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename, + if (load_multiboot(x86ms, fw_cfg, f, kernel_filename, initrd_filen= ame, kernel_cmdline, kernel_size, header)) { return; } --=20 2.31.1