[SeaBIOS] Re: [PATCH] boot: add config option for fast device init

Gerd Hoffmann posted 1 patch 2 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20210408100223.6u3oe7vr43n6d63p@sirius.home.kraxel.org
[SeaBIOS] Re: [PATCH] boot: add config option for fast device init
Posted by Gerd Hoffmann 2 years, 11 months ago
  Hi,

> > > > Add a config option for fast device init (i.e. skip non-bootable
> > > > devices).  This optimization breaks boot in some rare configurations,
> > > > specifically in case the boot loader needs access to secondary disks.
> 
> Unfortunately, I missed the initial email due to seabios mailing list
> problems a few weeks ago.

Quote above is the commit message, actual patch below.

> What's the reason to add a config option for this setting?  We
> typically make these choices at runtime using settings from fwcfg.

Well, there is a fwcfg setting already.  Skipping non-bootable devices
happens only in case there is a HALT line in the fw_cfg bootorder file,
which translates to "-boot strict={on,off}" on the qemu command line.

Problem is that libvirt runs qemu with strict=on and provides no way to
request strict=off instead.  Fixing that is on the way, but it'll take
some time as it affects not only libvirt itself but also the management
apps using libvirt.

So this patch allows to handles the reported regressions with a compile
time switch for the time being.  If you don't like it, fine, we can
also carry the patch downstream for a while until libvirt & co are
fixed, it should only be needed temporarily after all.

I suspect we are not the only ones running into this though, so it might
be useful to have that upstream too ...

take care,
  Gerd

------------------------------ cut here -------------------------
diff --git a/src/boot.c b/src/boot.c
index 1effd802ce06..771d2382e38f 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -299,6 +299,8 @@ u8 is_bootprio_strict(void)
 {
     static int prio_halt = -2;
 
+    if (!CONFIG_BOOT_FAST_INIT)
+        return 0;
     if (prio_halt == -2)
         prio_halt = find_prio("HALT");
     return prio_halt >= 0;
diff --git a/src/Kconfig b/src/Kconfig
index 3a8ffa15fded..6b750a41b42c 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -72,6 +72,16 @@ endchoice
         help
             Support controlling of the boot order via the fw_cfg/CBFS
             "bootorder" file.
+    config BOOT_FAST_INIT
+        depends on BOOTORDER
+        bool "Fast boot device init"
+        default y
+        help
+            Skip initialization for devices without bootindex.  Speeds
+            up boot and reduced memory footprint, but may cause boot
+            problems in case the bootloader needs access to secondary
+            disks.
+
     config HOST_BIOS_GEOMETRY
         depends on BOOT
         bool "Boot device bios geometry override"

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org