teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

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

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