From nobody Fri Apr 26 15:42:10 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1543232406119326.65332450245035; Mon, 26 Nov 2018 03:40:06 -0800 (PST) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.88) (envelope-from ) id 1gRFE4-0004iP-Tl; Mon, 26 Nov 2018 12:38:52 +0100 Received: from mx1.redhat.com ([209.132.183.28]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88) (envelope-from ) id 1gRFDs-0004hk-UH for seabios@seabios.org; Mon, 26 Nov 2018 12:38:51 +0100 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E097E3082A2F; Mon, 26 Nov 2018 11:39:17 +0000 (UTC) Received: from stelenovo.redhat.com (ovpn-117-114.ams2.redhat.com [10.36.117.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id C85651001F57; Mon, 26 Nov 2018 11:39:13 +0000 (UTC) From: Stefano Garzarella To: seabios@seabios.org Date: Mon, 26 Nov 2018 12:39:12 +0100 Message-Id: <20181126113912.45478-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 26 Nov 2018 11:39:18 +0000 (UTC) X-Spam-Score: -5.7 (-----) Subject: [SeaBIOS] [PATCH v2] qemu: fast boot when linuxboot optionrom is used X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kraxel@redhat.com Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff Content-Type: text/plain; charset="utf-8" Speed up the boot phase when qemu uses "linuxboot" optionrom (qemu -kernel) and the boot-menu is not required. Under these conditions we can skip the setup of devices and VGA, because they will be initialized (if they are required) during the Linux boot phase. Following the time measured between SeaBIOS entry point and "linuxboot" entry point: * Before this patch qemu -kernel | qemu -vga none -kernel --------------+----------------------- 53.5 msec | 23.34 msec * After this patch qemu -kernel | qemu -vga none -kernel --------------+----------------------- 12.82 msec | 10.89 msec Note: For the measuring, we used the default configuration disabling debug messages (CONFIG_DEBUG_LEVEL=3D0) and applying Stephen's patch: "tpm: Check for TPM related ACPI tables before attempting hw" Signed-off-by: Stefano Garzarella --- src/bootsplash.c | 3 +++ src/fw/paravirt.c | 10 ++++++++++ src/fw/paravirt.h | 4 ++++ src/optionroms.c | 3 ++- src/post.c | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/bootsplash.c b/src/bootsplash.c index 165c98d..0eda7f2 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -8,6 +8,7 @@ #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #include "farptr.h" // FLATPTR_TO_SEG +#include "fw/paravirt.h" // runningOnQEMUFastBoot #include "malloc.h" // free #include "output.h" // dprintf #include "romfile.h" // romfile_loadfile @@ -39,6 +40,8 @@ call16_int10(struct bregs *br) void enable_vga_console(void) { + if(runningOnQEMUFastBoot()) + return; dprintf(1, "Turning on vga text mode console\n"); struct bregs br; =20 diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index 0770c47..9e6e618 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -621,4 +621,14 @@ void qemu_cfg_init(void) if (nogfx && !romfile_find("etc/sercon-port") && !romfile_find("vgaroms/sgabios.bin")) const_romfile_add_int("etc/sercon-port", PORT_SERIAL1); + + /* + * Enable QEMU fast boot if there is "linuxboot" optionrom and + * the boot menu is not required. + */ + if ((romfile_find("genroms/linuxboot_dma.bin") + || romfile_find("genroms/linuxboot.bin")) + && !romfile_loadint("etc/show-boot-menu", 1)) { + PlatformRunningOn |=3D PF_QEMU_FB; + } } diff --git a/src/fw/paravirt.h b/src/fw/paravirt.h index a14d83e..3713bc2 100644 --- a/src/fw/paravirt.h +++ b/src/fw/paravirt.h @@ -9,6 +9,7 @@ #define PF_QEMU (1<<0) #define PF_XEN (1<<1) #define PF_KVM (1<<2) +#define PF_QEMU_FB (1<<3) =20 typedef struct QemuCfgDmaAccess { u32 control; @@ -24,6 +25,9 @@ static inline int runningOnQEMU(void) { return CONFIG_QEMU || ( CONFIG_QEMU_HARDWARE && GET_GLOBAL(PlatformRunningOn) & PF_QEMU); } +static inline int runningOnQEMUFastBoot(void) { + return runningOnQEMU() && GET_GLOBAL(PlatformRunningOn) & PF_QEMU_FB; +} static inline int runningOnXen(void) { return CONFIG_XEN && GET_GLOBAL(PlatformRunningOn) & PF_XEN; } diff --git a/src/optionroms.c b/src/optionroms.c index fc992f6..c312e91 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -8,6 +8,7 @@ #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #include "farptr.h" // FLATPTR_TO_SEG +#include "fw/paravirt.h" // runningOnQEMUFastBoot #include "hw/pci.h" // pci_config_readl #include "hw/pcidevice.h" // foreachpci #include "hw/pci_ids.h" // PCI_CLASS_DISPLAY_VGA @@ -428,7 +429,7 @@ vgarom_setup(void) { int have_vga =3D 0; =20 - if (! CONFIG_OPTIONROMS) + if (!CONFIG_OPTIONROMS || runningOnQEMUFastBoot()) return; =20 dprintf(1, "Scan for VGA option rom\n"); diff --git a/src/post.c b/src/post.c index f93106a..d1c2a54 100644 --- a/src/post.c +++ b/src/post.c @@ -126,6 +126,9 @@ interface_init(void) void device_hardware_setup(void) { + if(runningOnQEMUFastBoot()) + return; + usb_setup(); ps2port_setup(); block_setup(); --=20 2.19.1 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios