Commit eeff7d63 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Ingo Molnar

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: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: default avatarMark 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.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 60f38de7
...@@ -116,8 +116,6 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, ...@@ -116,8 +116,6 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
goto fail; goto fail;
pr_efi(sys_table, "Booting Linux Kernel...\n");
status = check_platform_features(sys_table); status = check_platform_features(sys_table);
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS)
goto fail; goto fail;
...@@ -151,6 +149,16 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, ...@@ -151,6 +149,16 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
goto fail; goto fail;
} }
if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
cmdline_size == 0)
efi_parse_options(CONFIG_CMDLINE);
if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0)
efi_parse_options(cmdline_ptr);
pr_efi(sys_table, "Booting Linux Kernel...\n");
si = setup_graphics(sys_table); si = setup_graphics(sys_table);
status = handle_kernel_image(sys_table, image_addr, &image_size, 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,14 +170,6 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
goto fail_free_cmdline; goto fail_free_cmdline;
} }
if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
cmdline_size == 0)
efi_parse_options(CONFIG_CMDLINE);
if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0)
efi_parse_options(cmdline_ptr);
secure_boot = efi_get_secureboot(sys_table); secure_boot = efi_get_secureboot(sys_table);
/* /*
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <linux/efi.h> #include <linux/efi.h>
#include <asm/efi.h> #include <asm/efi.h>
#include "efistub.h"
efi_status_t check_platform_features(efi_system_table_t *sys_table_arg) efi_status_t check_platform_features(efi_system_table_t *sys_table_arg)
{ {
int block; int block;
......
...@@ -33,11 +33,16 @@ ...@@ -33,11 +33,16 @@
static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE;
static int __section(.data) __nokaslr; static int __section(.data) __nokaslr;
static int __section(.data) __quiet;
int __pure nokaslr(void) int __pure nokaslr(void)
{ {
return __nokaslr; return __nokaslr;
} }
int __pure is_quiet(void)
{
return __quiet;
}
#define EFI_MMAP_NR_SLACK_SLOTS 8 #define EFI_MMAP_NR_SLACK_SLOTS 8
...@@ -424,6 +429,10 @@ efi_status_t efi_parse_options(char const *cmdline) ...@@ -424,6 +429,10 @@ efi_status_t efi_parse_options(char const *cmdline)
if (str == cmdline || (str && str > cmdline && *(str - 1) == ' ')) if (str == cmdline || (str && str > cmdline && *(str - 1) == ' '))
__nokaslr = 1; __nokaslr = 1;
str = strstr(cmdline, "quiet");
if (str == cmdline || (str && str > cmdline && *(str - 1) == ' '))
__quiet = 1;
/* /*
* If no EFI parameters were specified on the cmdline we've got * If no EFI parameters were specified on the cmdline we've got
* nothing to do. * nothing to do.
......
...@@ -25,6 +25,13 @@ ...@@ -25,6 +25,13 @@
#endif #endif
extern int __pure nokaslr(void); extern int __pure nokaslr(void);
extern int __pure is_quiet(void);
#define pr_efi(sys_table, msg) do { \
if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg); \
} while (0)
#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
void efi_char16_printk(efi_system_table_t *, efi_char16_t *); void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <linux/efi.h> #include <linux/efi.h>
#include <asm/efi.h> #include <asm/efi.h>
#include "efistub.h"
/* BIOS variables */ /* BIOS variables */
static const efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID; static const efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
static const efi_char16_t const efi_SecureBoot_name[] = { static const efi_char16_t const efi_SecureBoot_name[] = {
......
...@@ -1435,9 +1435,6 @@ static inline int efi_runtime_map_copy(void *buf, size_t bufsz) ...@@ -1435,9 +1435,6 @@ static inline int efi_runtime_map_copy(void *buf, size_t bufsz)
/* prototypes shared between arch specific and generic stub code */ /* prototypes shared between arch specific and generic stub code */
#define pr_efi(sys_table, msg) efi_printk(sys_table, "EFI stub: "msg)
#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
void efi_printk(efi_system_table_t *sys_table_arg, char *str); void efi_printk(efi_system_table_t *sys_table_arg, char *str);
void efi_free(efi_system_table_t *sys_table_arg, unsigned long size, void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment