All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-efi@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H . Peter Anvin" <hpa@zytor.com>
Cc: matt@codeblueprint.co.uk, mark.rutland@arm.com,
	roy.franz@cavium.com, rruigrok@codeaurora.org,
	leif.lindholm@linaro.org, jhugo@codeaurora.org,
	evgeny.kalugin@intel.com, eugene@hp.com, bp@alien8.de,
	bhsharma@redhat.com, bhe@redhat.com,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 11/12] efi/libstub: arm/arm64: Disable debug prints on 'quiet' cmdline arg
Date: Tue,  4 Apr 2017 17:09:09 +0100	[thread overview]
Message-ID: <20170404160910.28115-2-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20170404160910.28115-1-ard.biesheuvel@linaro.org>

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.

Cc: Matt Fleming <matt@codeblueprint.co.uk>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 drivers/firmware/efi/libstub/arm-stub.c        | 20 ++++++++++----------
 drivers/firmware/efi/libstub/arm32-stub.c      |  2 ++
 drivers/firmware/efi/libstub/efi-stub-helper.c |  9 +++++++++
 drivers/firmware/efi/libstub/efistub.h         |  7 +++++++
 drivers/firmware/efi/libstub/secureboot.c      |  2 ++
 include/linux/efi.h                            |  3 ---
 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,
 	if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
 		goto fail;
 
-	pr_efi(sys_table, "Booting Linux Kernel...\n");
-
 	status = check_platform_features(sys_table);
 	if (status != EFI_SUCCESS)
 		goto fail;
@@ -151,6 +149,16 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
 		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);
 
 	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,
 		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);
 
 	/*
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 @@
 #include <linux/efi.h>
 #include <asm/efi.h>
 
+#include "efistub.h"
+
 efi_status_t check_platform_features(efi_system_table_t *sys_table_arg)
 {
 	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 @@
 static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE;
 
 static int __section(.data) __nokaslr;
+static int __section(.data) __quiet;
 
 int __pure nokaslr(void)
 {
 	return __nokaslr;
 }
+int __pure is_quiet(void)
+{
+	return __quiet;
+}
 
 #define EFI_MMAP_NR_SLACK_SLOTS	8
 
@@ -424,6 +429,10 @@ efi_status_t efi_parse_options(char const *cmdline)
 	if (str == cmdline || (str && str > cmdline && *(str - 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
 	 * 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 @@
 #endif
 
 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 *);
 
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 @@
 #include <linux/efi.h>
 #include <asm/efi.h>
 
+#include "efistub.h"
+
 /* BIOS variables */
 static const efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
 static 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)
 
 /* 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_free(efi_system_table_t *sys_table_arg, unsigned long size,
-- 
2.9.3

  reply	other threads:[~2017-04-04 16:09 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 16:02 [GIT PULL 00/12] EFI updates for v4.12 Ard Biesheuvel
2017-04-04 16:02 ` [PATCH 1/2] efi/libstub: Skip GOP with PIXEL_BLT_ONLY format Ard Biesheuvel
2017-04-04 16:02   ` Ard Biesheuvel
2017-04-04 16:02 ` [PATCH 01/12] x86/efi: Clean up efi CR3 save/restore Ard Biesheuvel
2017-04-05  8:51   ` [tip:efi/core] x86/efi: Clean up the EFI CR3 save/restore logic tip-bot for Andy Lutomirski
2017-04-04 16:02 ` [PATCH 02/12] efi: arm-stub: Correct FDT and initrd allocation rules for arm64 Ard Biesheuvel
2017-04-04 16:02   ` Ard Biesheuvel
2017-04-05  8:52   ` [tip:efi/core] efi/arm-stub: " tip-bot for Ard Biesheuvel
2017-04-05 10:33   ` tip-bot for Ard Biesheuvel
2017-04-04 16:02 ` [PATCH 2/2] efifb: Avoid reconfiguration of BAR that covers the framebuffer Ard Biesheuvel
2017-04-04 16:02   ` Ard Biesheuvel
2017-04-04 16:02 ` [PATCH 03/12] efi: arm-stub: Round up FDT allocation to mapping size Ard Biesheuvel
2017-04-05  8:53   ` [tip:efi/core] efi/arm-stub: " tip-bot for Ard Biesheuvel
2017-04-05 10:34   ` tip-bot for Ard Biesheuvel
2017-04-04 16:02 ` [PATCH 04/12] x86/efi-bgrt: Move efi-bgrt handling out of arch/x86 Ard Biesheuvel
2017-04-04 16:02   ` Ard Biesheuvel
2017-04-05  8:53   ` [tip:efi/core] x86/efi/bgrt: " tip-bot for Bhupesh Sharma
2017-04-05 10:34   ` tip-bot for Bhupesh Sharma
2017-04-04 16:02 ` [PATCH 05/12] efi: bgrt: Enable ACPI BGRT handling on arm64 Ard Biesheuvel
2017-04-05  8:54   ` [tip:efi/core] efi/bgrt: " tip-bot for Bhupesh Sharma
2017-04-05 10:35   ` tip-bot for Bhupesh Sharma
2017-04-04 16:02 ` [PATCH 06/12] pstore: return error code (if any) from efi_pstore_write Ard Biesheuvel
2017-04-05  8:54   ` [tip:efi/core] efi/pstore: Return error code (if any) from efi_pstore_write() tip-bot for Evgeny Kalugin
2017-04-05 10:35   ` tip-bot for Evgeny Kalugin
2017-04-04 16:02 ` [PATCH 07/12] x86/efi: Clean up a minor mistake in code comment Ard Biesheuvel
2017-04-04 16:02   ` Ard Biesheuvel
2017-04-05  8:55   ` [tip:efi/core] x86/efi: Clean up a minor mistake in comment tip-bot for Baoquan He
2017-04-05 10:36   ` tip-bot for Baoquan He
2017-04-04 16:02 ` [PATCH 08/12] efi/arm32-stub: Allow boottime allocations in the vmlinux region Ard Biesheuvel
2017-04-04 16:02   ` Ard Biesheuvel
2017-04-05  8:55   ` [tip:efi/core] efi/arm32-stub: Allow boot-time " tip-bot for Ard Biesheuvel
2017-04-05 10:36   ` tip-bot for Ard Biesheuvel
2017-04-04 16:02 ` [PATCH 09/12] efi/libstub: Fix harmless command line parsing bug Ard Biesheuvel
2017-04-04 16:02   ` Ard Biesheuvel
2017-04-05  8:56   ` [tip:efi/core] " tip-bot for Ard Biesheuvel
2017-04-05 10:37   ` tip-bot for Ard Biesheuvel
2017-04-04 16:06 ` [GIT PULL 00/12] EFI updates for v4.12 Ard Biesheuvel
2017-04-04 16:09 ` [PATCH 10/12] efi/libstub: Unify command line param parsing Ard Biesheuvel
2017-04-04 16:09   ` Ard Biesheuvel
2017-04-04 16:09   ` Ard Biesheuvel [this message]
2017-04-05  8:57     ` [tip:efi/core] efi/libstub/arm/arm64: Disable debug prints on 'quiet' cmdline arg tip-bot for Ard Biesheuvel
2017-04-05 10:38     ` tip-bot for Ard Biesheuvel
2017-04-11  4:08     ` [PATCH 11/12] efi/libstub: arm/arm64: " Jon Masters
2017-04-04 16:09   ` [PATCH 12/12] ef/libstub: arm/arm64: Randomize the base of the UEFI rt services region Ard Biesheuvel
2017-04-04 16:09     ` Ard Biesheuvel
2017-04-05  8:57     ` [tip:efi/core] ef/libstub/arm/arm64: " tip-bot for Ard Biesheuvel
2017-04-05 10:39     ` tip-bot for Ard Biesheuvel
2017-04-07 15:58     ` [PATCH 12/12] ef/libstub: arm/arm64: " Catalin Marinas
2017-04-07 15:58       ` Catalin Marinas
2017-04-07 16:02       ` Ard Biesheuvel
2017-04-07 16:02         ` Ard Biesheuvel
2017-04-05  8:56   ` [tip:efi/core] efi/libstub: Unify command line param parsing tip-bot for Ard Biesheuvel
2017-04-05 10:38   ` tip-bot for Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170404160910.28115-2-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=bhe@redhat.com \
    --cc=bhsharma@redhat.com \
    --cc=bp@alien8.de \
    --cc=eugene@hp.com \
    --cc=evgeny.kalugin@intel.com \
    --cc=hpa@zytor.com \
    --cc=jhugo@codeaurora.org \
    --cc=leif.lindholm@linaro.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@kernel.org \
    --cc=roy.franz@cavium.com \
    --cc=rruigrok@codeaurora.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.