aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-04-04 12:09:09 -0400
committerIngo Molnar <mingo@kernel.org>2017-04-05 06:27:28 -0400
commiteeff7d634f4750306785be709ca444140c29b043 (patch)
treee2fd8a07f5437c10ec5d2f5e565a452dcaf8665e
parent60f38de7a8d4e816100ceafd1b382df52527bd50 (diff)
efi/libstub/arm/arm64: Disable debug prints on 'quiet' cmdline arg
The EFI stub currently prints a number of diagnostic messages that do not carry a lot of information. Since these prints are not controlled by 'loglevel' or other command line parameters, and since they appear on the EFI framebuffer as well (if enabled), it would be nice if we could turn them off. So let's add support for the 'quiet' command line parameter in the stub, and disable the non-error prints if it is passed. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: bhe@redhat.com Cc: bhsharma@redhat.com Cc: bp@alien8.de Cc: eugene@hp.com Cc: evgeny.kalugin@intel.com Cc: jhugo@codeaurora.org Cc: leif.lindholm@linaro.org Cc: linux-efi@vger.kernel.org Cc: roy.franz@cavium.com Cc: rruigrok@codeaurora.org Link: http://lkml.kernel.org/r/20170404160910.28115-2-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--drivers/firmware/efi/libstub/arm-stub.c20
-rw-r--r--drivers/firmware/efi/libstub/arm32-stub.c2
-rw-r--r--drivers/firmware/efi/libstub/efi-stub-helper.c9
-rw-r--r--drivers/firmware/efi/libstub/efistub.h7
-rw-r--r--drivers/firmware/efi/libstub/secureboot.c2
-rw-r--r--include/linux/efi.h3
6 files changed, 30 insertions, 13 deletions
diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
index ac3222f6f805..657bb72c9e0b 100644
--- a/drivers/firmware/efi/libstub/arm-stub.c
+++ b/drivers/firmware/efi/libstub/arm-stub.c
@@ -116,8 +116,6 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
116 if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) 116 if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
117 goto fail; 117 goto fail;
118 118
119 pr_efi(sys_table, "Booting Linux Kernel...\n");
120
121 status = check_platform_features(sys_table); 119 status = check_platform_features(sys_table);
122 if (status != EFI_SUCCESS) 120 if (status != EFI_SUCCESS)
123 goto fail; 121 goto fail;
@@ -151,6 +149,16 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
151 goto fail; 149 goto fail;
152 } 150 }
153 151
152 if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
153 IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
154 cmdline_size == 0)
155 efi_parse_options(CONFIG_CMDLINE);
156
157 if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0)
158 efi_parse_options(cmdline_ptr);
159
160 pr_efi(sys_table, "Booting Linux Kernel...\n");
161
154 si = setup_graphics(sys_table); 162 si = setup_graphics(sys_table);
155 163
156 status = handle_kernel_image(sys_table, image_addr, &image_size, 164 status = handle_kernel_image(sys_table, image_addr, &image_size,
@@ -162,14 +170,6 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
162 goto fail_free_cmdline; 170 goto fail_free_cmdline;
163 } 171 }
164 172
165 if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
166 IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
167 cmdline_size == 0)
168 efi_parse_options(CONFIG_CMDLINE);
169
170 if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0)
171 efi_parse_options(cmdline_ptr);
172
173 secure_boot = efi_get_secureboot(sys_table); 173 secure_boot = efi_get_secureboot(sys_table);
174 174
175 /* 175 /*
diff --git a/drivers/firmware/efi/libstub/arm32-stub.c b/drivers/firmware/efi/libstub/arm32-stub.c
index 18a8b5eb55e7..becbda445913 100644
--- a/drivers/firmware/efi/libstub/arm32-stub.c
+++ b/drivers/firmware/efi/libstub/arm32-stub.c
@@ -9,6 +9,8 @@
9#include <linux/efi.h> 9#include <linux/efi.h>
10#include <asm/efi.h> 10#include <asm/efi.h>
11 11
12#include "efistub.h"
13
12efi_status_t check_platform_features(efi_system_table_t *sys_table_arg) 14efi_status_t check_platform_features(efi_system_table_t *sys_table_arg)
13{ 15{
14 int block; 16 int block;
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index 2e17d2b8787c..b0184360efc6 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -33,11 +33,16 @@
33static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; 33static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE;
34 34
35static int __section(.data) __nokaslr; 35static int __section(.data) __nokaslr;
36static int __section(.data) __quiet;
36 37
37int __pure nokaslr(void) 38int __pure nokaslr(void)
38{ 39{
39 return __nokaslr; 40 return __nokaslr;
40} 41}
42int __pure is_quiet(void)
43{
44 return __quiet;
45}
41 46
42#define EFI_MMAP_NR_SLACK_SLOTS 8 47#define EFI_MMAP_NR_SLACK_SLOTS 8
43 48
@@ -424,6 +429,10 @@ efi_status_t efi_parse_options(char const *cmdline)
424 if (str == cmdline || (str && str > cmdline && *(str - 1) == ' ')) 429 if (str == cmdline || (str && str > cmdline && *(str - 1) == ' '))
425 __nokaslr = 1; 430 __nokaslr = 1;
426 431
432 str = strstr(cmdline, "quiet");
433 if (str == cmdline || (str && str > cmdline && *(str - 1) == ' '))
434 __quiet = 1;
435
427 /* 436 /*
428 * If no EFI parameters were specified on the cmdline we've got 437 * If no EFI parameters were specified on the cmdline we've got
429 * nothing to do. 438 * nothing to do.
diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
index a7a2a2c3f199..83f268c05007 100644
--- a/drivers/firmware/efi/libstub/efistub.h
+++ b/drivers/firmware/efi/libstub/efistub.h
@@ -25,6 +25,13 @@
25#endif 25#endif
26 26
27extern int __pure nokaslr(void); 27extern int __pure nokaslr(void);
28extern int __pure is_quiet(void);
29
30#define pr_efi(sys_table, msg) do { \
31 if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg); \
32} while (0)
33
34#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
28 35
29void efi_char16_printk(efi_system_table_t *, efi_char16_t *); 36void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
30 37
diff --git a/drivers/firmware/efi/libstub/secureboot.c b/drivers/firmware/efi/libstub/secureboot.c
index 5da36e56b36a..8c34d50a4d80 100644
--- a/drivers/firmware/efi/libstub/secureboot.c
+++ b/drivers/firmware/efi/libstub/secureboot.c
@@ -12,6 +12,8 @@
12#include <linux/efi.h> 12#include <linux/efi.h>
13#include <asm/efi.h> 13#include <asm/efi.h>
14 14
15#include "efistub.h"
16
15/* BIOS variables */ 17/* BIOS variables */
16static const efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID; 18static const efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
17static const efi_char16_t const efi_SecureBoot_name[] = { 19static const efi_char16_t const efi_SecureBoot_name[] = {
diff --git a/include/linux/efi.h b/include/linux/efi.h
index e485e87615d1..ec36f42a2add 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1435,9 +1435,6 @@ static inline int efi_runtime_map_copy(void *buf, size_t bufsz)
1435 1435
1436/* prototypes shared between arch specific and generic stub code */ 1436/* prototypes shared between arch specific and generic stub code */
1437 1437
1438#define pr_efi(sys_table, msg) efi_printk(sys_table, "EFI stub: "msg)
1439#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
1440
1441void efi_printk(efi_system_table_t *sys_table_arg, char *str); 1438void efi_printk(efi_system_table_t *sys_table_arg, char *str);
1442 1439
1443void efi_free(efi_system_table_t *sys_table_arg, unsigned long size, 1440void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,