teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0152-boot-Only-do-full-driver-initialization-in-VMs.patch

ac3a84
From 7dec74695751b70a8a86eb647062e7d5a5157446 Mon Sep 17 00:00:00 2001
ac3a84
From: Jan Janssen <medhefgo@web.de>
ac3a84
Date: Sun, 27 Nov 2022 13:56:18 +0100
ac3a84
Subject: [PATCH] boot: Only do full driver initialization in VMs
ac3a84
ac3a84
Doing the reconnect dance on some real firmware creates huge delays on
ac3a84
boot. This should not be needed anymore as we now ask the firmware to
ac3a84
make console devices and xbootldr partitions available explicitly in a
ac3a84
more targeted fashion.
ac3a84
ac3a84
Fixes: #25510
ac3a84
(cherry picked from commit f6d59e2ebfc1bf50683a2e640aad501c372a50e4)
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 src/boot/efi/boot.c | 6 ------
ac3a84
 src/boot/efi/vmm.c  | 4 ++++
ac3a84
 2 files changed, 4 insertions(+), 6 deletions(-)
ac3a84
ac3a84
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
ac3a84
index e182ee7840..5944451e6a 100644
ac3a84
--- a/src/boot/efi/boot.c
ac3a84
+++ b/src/boot/efi/boot.c
ac3a84
@@ -2662,12 +2662,6 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
ac3a84
         /* Uncomment the next line if you need to wait for debugger. */
ac3a84
         // debug_break();
ac3a84
 
ac3a84
-        /* The firmware may skip initializing some devices for the sake of a faster boot. This is especially
ac3a84
-         * true for fastboot enabled firmwares. But this means that things we use like input devices or the
ac3a84
-         * xbootldr partition may not be available yet. Reconnect all drivers should hopefully make the
ac3a84
-         * firmware initialize everything we need. */
ac3a84
-        (void) reconnect_all_drivers();
ac3a84
-
ac3a84
         err = BS->OpenProtocol(image,
ac3a84
                         &LoadedImageProtocol,
ac3a84
                         (void **)&loaded_image,
ac3a84
diff --git a/src/boot/efi/vmm.c b/src/boot/efi/vmm.c
ac3a84
index b1bfd778fc..2260b217b7 100644
ac3a84
--- a/src/boot/efi/vmm.c
ac3a84
+++ b/src/boot/efi/vmm.c
ac3a84
@@ -83,6 +83,10 @@ EFI_STATUS vmm_open(EFI_HANDLE *ret_vmm_dev, EFI_FILE **ret_vmm_dir) {
ac3a84
         assert(ret_vmm_dev);
ac3a84
         assert(ret_vmm_dir);
ac3a84
 
ac3a84
+        /* Make sure all file systems have been initialized. Only do this in VMs as this is slow
ac3a84
+         * on some real firmwares. */
ac3a84
+        (void) reconnect_all_drivers();
ac3a84
+
ac3a84
         /* find all file system handles */
ac3a84
         err = BS->LocateHandleBuffer(ByProtocol, &FileSystemProtocol, NULL, &n_handles, &handles);
ac3a84
         if (err != EFI_SUCCESS)