Skip to contentSkip to conversation

efistub: add efi=quiet parameter to selectively silence efistub alone

PATCH In review Hendrik 'T4cC0re' Meyer 2 participants 7 messages Jan 17, 2025 – Jan 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efistub: add efi=quiet parameter to selectively silence efistub alone

While the general quiet kernel parameter is available to silence output from the efistub, setting this comes with side-effects. This patch adds a parameter efi=quiet to selectively set the loglevel for the stub alone to quiet, as the polar oppoosite to efi=debug.

---
 Documentation/admin-guide/kernel-parameters.txt | 3 ++-
 drivers/firmware/efi/libstub/efi-stub-helper.c  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +2 -1
index 3872bc6ec..94a2f6ae7 100644
@@ -1454,7 +1454,7 @@
 	efi=		[EFI,EARLY]
 			Format: { "debug", "disable_early_pci_dma",
 				  "nochunk", "noruntime", "nosoftreserve",
-				  "novamap", "no_disable_early_pci_dma" }
+				  "novamap", "no_disable_early_pci_dma", "quiet" }
 			debug: enable misc debug output.
 			disable_early_pci_dma: disable the busmaster bit on all
 			PCI bridges while in the EFI boot stub.
@@ -1471,6 +1471,7 @@
 			novamap: do not call SetVirtualAddressMap().
 			no_disable_early_pci_dma: Leave the busmaster bit set
 			on all PCI bridges while in the EFI boot stub
+			quiet: disable most log messages.
 
 	efi_no_storage_paranoia [EFI,X86,EARLY]
 			Using this parameter you can use more than 50% of
drivers/firmware/efi/libstub/efi-stub-helper.c +2 -0
index c0c81ca42..b8ad629cc 100644
@@ -97,6 +97,8 @@ efi_status_t efi_parse_options(char const *cmdline)
 				efi_disable_pci_dma = false;
 			if (parse_option_str(val, "debug"))
 				efi_loglevel = CONSOLE_LOGLEVEL_DEBUG;
+			if (parse_option_str(val, "quiet"))
+				efi_loglevel = CONSOLE_LOGLEVEL_QUIET;
 		} else if (!strcmp(param, "video") &&
 			   val && strstarts(val, "efifb:")) {
 			efi_parse_option_graphics(val + strlen("efifb:"));
Signature · 1 line
2.47.1
maintainer
#1 lore raw
Quoted 38 lines · On Fri, 17 Jan 2025 at 03:46, Hendrik 'T4cC0re' Meyer <[email protected]> wrote:

While the general quiet kernel parameter is available to silence output from the efistub, setting this comes with side-effects. This patch adds a parameter efi=quiet to selectively set the loglevel for the stub alone to quiet, as the polar oppoosite to efi=debug.

---
 Documentation/admin-guide/kernel-parameters.txt | 3 ++-
 drivers/firmware/efi/libstub/efi-stub-helper.c  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +2 -1
index 3872bc6ec..94a2f6ae7 100644
@@ -1454,7 +1454,7 @@
        efi=            [EFI,EARLY]
                        Format: { "debug", "disable_early_pci_dma",
                                  "nochunk", "noruntime", "nosoftreserve",
-                                 "novamap", "no_disable_early_pci_dma" }
+                                 "novamap", "no_disable_early_pci_dma", "quiet" }
                        debug: enable misc debug output.
                        disable_early_pci_dma: disable the busmaster bit on all
                        PCI bridges while in the EFI boot stub.
@@ -1471,6 +1471,7 @@
                        novamap: do not call SetVirtualAddressMap().
                        no_disable_early_pci_dma: Leave the busmaster bit set
                        on all PCI bridges while in the EFI boot stub
+                       quiet: disable most log messages.
 
        efi_no_storage_paranoia [EFI,X86,EARLY]
                        Using this parameter you can use more than 50% of
drivers/firmware/efi/libstub/efi-stub-helper.c +0 -0
index c0c81ca42..b8ad629cc 100644

drivers/firmware/efi/libstub/efi-stub-helper.c efi_status_t efi_parse_options(char const *cmdline) · line 104

Quoted 8 lines
drivers/firmware/efi/libstub/efi-stub-helper.c +2 -0
@@ -97,6 +97,8 @@ efi_status_t efi_parse_options(char const *cmdline)
                                efi_disable_pci_dma = false;
                        if (parse_option_str(val, "debug"))
                                efi_loglevel = CONSOLE_LOGLEVEL_DEBUG;
+                       if (parse_option_str(val, "quiet"))
+                               efi_loglevel = CONSOLE_LOGLEVEL_QUIET;
                } else if (!strcmp(param, "video") &&
                           val && strstarts(val, "efifb:")) {
                        efi_parse_option_graphics(val + strlen("efifb:"));

Hello Hendrik,

Could you explain the use case please? Your concern is that removing 'quiet' from the command line is producing a few additional lines of output from the EFI stub at boot? How is that a problem compared to the fact that you get the entire kernel log printed to the console? Is every single line printed there relevant to you, and only the ones emitted by the EFI stub are not?

#2 lore raw

PATCH 1/1 efistub: add efi=quiet parameter to selectively silence efistub alone

Hello!

Quoted 1 line

Could you explain the use case please? Your concern is that removing

'quiet' from the command line is producing a few additional lines of output from the EFI stub at boot?

Sure :) I boot a UKI (with Secure Boot and TPM measurements) with an embedded splash image, and the cmdline
'memtest=2 earlyprintk=serial,ttyS0,115200 console=ttyS0,115200n8'

The stub by default (without 'quiet') will print messages regarding the UKI and it being measured into the TPM on the efifb (I assume) rendering on top of the displayed splash image.

"EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path"
and "EFI stub: Measured initrd data into PCR 9" to be specific.

Quoted 1 line

How is that a problem compared to

the fact that you get the entire kernel log printed to the console?

Very relevant question. Because of the 'memtest=2' flag, there is a delay during boot, which should be logged (with memtest progress) to the serial console. 'quiet' will silence these logs.

Quoted 1 line

Is every single line printed there relevant to you, and only the ones

emitted by the EFI stub are not?

Basically, yes. I want the kernel's printk's, but not have the output of the efistub dipsplayed on top of the splash screen of the UKI.

I did not find a way to redirect this output, and adding a 'efi=quiet' option seemed like a low hanging fruit.

Hendrik

maintainer
#3 lore raw
Quoted 25 lines · On Sun, 19 Jan 2025 at 18:32, Hendrik 'T4cC0re' Meyer <[email protected]> wrote:

Hello!

Quoted 1 line

Could you explain the use case please? Your concern is that removing

'quiet' from the command line is producing a few additional lines of output from the EFI stub at boot?

Sure :) I boot a UKI (with Secure Boot and TPM measurements) with an embedded splash image, and the cmdline
'memtest=2 earlyprintk=serial,ttyS0,115200 console=ttyS0,115200n8'

The stub by default (without 'quiet') will print messages regarding the UKI and it being measured into the TPM on the efifb (I assume) rendering on top of the displayed splash image.

"EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path"
and "EFI stub: Measured initrd data into PCR 9" to be specific.

Quoted 1 line

How is that a problem compared to

the fact that you get the entire kernel log printed to the console?

Very relevant question. Because of the 'memtest=2' flag, there is a delay during boot, which should be logged (with memtest progress) to the serial console. 'quiet' will silence these logs.

Quoted 9 lines
Quoted 1 line

Is every single line printed there relevant to you, and only the ones

emitted by the EFI stub are not?

Basically, yes. I want the kernel's printk's, but not have the output of the efistub dipsplayed on top of the splash screen of the UKI.

I did not find a way to redirect this output, and adding a 'efi=quiet' option seemed like a low hanging fruit.

I'd prefer to just raise the verbosity level of those messages instead.

#4 lore raw

PATCH 1/1 efistub: add efi=quiet parameter to selectively silence efistub alone

Quoted 1 line

I'd prefer to just raise the verbosity level of those messages instead.

Agreed. I'll send in a new patch setting the verbosity of those messages one above the default.

Hendrik

maintainer
#5 lore raw
Quoted 6 lines · On Mon, 20 Jan 2025 at 09:53, Hendrik 'T4cC0re' Meyer <[email protected]> wrote:
Quoted 2 lines

I'd prefer to just raise the verbosity level of those messages instead.

Agreed. I'll send in a new patch setting the verbosity of those messages one above the default.

Actually, let's do it the other way around. Does the below work for you?

drivers/firmware/efi/libstub/printk.c +2 -2
@@ -5,13 +5,13 @@
 #include <linux/ctype.h>
 #include <linux/efi.h>
 #include <linux/kernel.h>
-#include <linux/printk.h> /* For CONSOLE_LOGLEVEL_* */
+#include <linux/kern_levels.h>
 #include <asm/efi.h>
 #include <asm/setup.h>
 
 #include "efistub.h"
 
-int efi_loglevel = CONSOLE_LOGLEVEL_DEFAULT;
+int efi_loglevel = LOGLEVEL_NOTICE;
 
 /**
  * efi_char16_puts() - Write a UCS-2 encoded string to the console
#6 lore raw

PATCH 1/1 efistub: add efi=quiet parameter to selectively silence efistub alone

Quoted 1 line

Does the below work for you?

Assuming 'efi_puts' logs as INFO level, yes. That should do the trick as well.

Thanks!

Hendrik