public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Joseph Thelen <jthelen@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: Joseph Thelen <jthelen@sgi.com>,
	Alex Thorlton <athorlton@sgi.com>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-efi@vger.kernel.org
Subject: [PATCH] x86/efi: Auto enable EFI memmap on SGI UV systems
Date: Thu,  2 Jun 2016 15:50:35 -0500	[thread overview]
Message-ID: <1464900635-11957-2-git-send-email-jthelen@sgi.com> (raw)
In-Reply-To: <1464900635-11957-1-git-send-email-jthelen@sgi.com>

Currently, the EFI memory map entries are disabled by default and must
be enabled by passing the kernel boot option:

add_efi_memmap

The EFI memory map entries should be enabled on systems with more
than 128 E820 entries, which includes many UV systems. Check if
we're on a UV system by chekcing the uv system table.
Enable the EFI memory map entries if we're on a UV system.

This change is backward compatible because the EFI memory map entries are
still disabled by default on non-UV systems, and it maintains the previous
behavior of the kernel boot option. In addition, it allows the EFI memory
map entries to be explicitly disabled (will not be automatically enabled)
by setting the add_efi_memmap boot option to anything that kstringtobool
will determine to be false.

Signed-off-by: Joseph Thelen <jthelen@sgi.com>
Cc: Alex Thorlton <athorlton@sgi.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-efi@vger.kernel.org
---
 arch/x86/platform/efi/efi.c | 43 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index f93545e..26e3ff5 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -66,10 +66,32 @@ static efi_config_table_type_t arch_tables[] __initdata = {
 
 u64 efi_setup;		/* efi setup_data physical address */
 
-static int add_efi_memmap __initdata;
+static __initdata enum {
+	EFI_MEMMAP_DEFAULT,
+	EFI_MEMMAP_ENABLED,
+	EFI_MEMMAP_DISABLED
+} add_efi_memmap;
+
 static int __init setup_add_efi_memmap(char *arg)
 {
-	add_efi_memmap = 1;
+	static bool arg_as_bool;
+	int ret = strtobool(arg, &arg_as_bool);
+
+	/* check for a non-existent arg, to maintain backward compatibility */
+	if (!arg) {
+		add_efi_memmap = EFI_MEMMAP_ENABLED;
+	} else {
+		if (ret) {
+			/* a bad argument was passed... */
+			return ret;
+		} else {
+			if (arg_as_bool)
+				add_efi_memmap = EFI_MEMMAP_ENABLED;
+			else
+				add_efi_memmap = EFI_MEMMAP_DISABLED;
+		}
+	}
+
 	return 0;
 }
 early_param("add_efi_memmap", setup_add_efi_memmap);
@@ -433,6 +455,7 @@ static int __init efi_runtime_init(void)
 static int __init efi_memmap_init(void)
 {
 	unsigned long addr, size;
+	bool is_uv_sys;
 
 	if (efi_enabled(EFI_PARAVIRT))
 		return 0;
@@ -449,8 +472,20 @@ static int __init efi_memmap_init(void)
 
 	efi.memmap.map_end = efi.memmap.map + size;
 
-	if (add_efi_memmap)
-		do_add_efi_memmap();
+	is_uv_sys = !((efi.uv_systab == EFI_INVALID_TABLE_ADDR)
+			|| !efi.uv_systab);
+
+	if (add_efi_memmap != EFI_MEMMAP_DISABLED) {
+		if (add_efi_memmap == EFI_MEMMAP_ENABLED) {
+			do_add_efi_memmap();
+			pr_info("EFI memmap enabled: Explicitly\n");
+		} else if (is_uv_sys) {
+			do_add_efi_memmap();
+			pr_info("EFI memmap enabled: this is a UV system\n");
+		}
+	} else {
+		pr_info("EFI memmap disabled: Explicitly\n");
+	}
 
 	set_bit(EFI_MEMMAP, &efi.flags);
 
-- 
1.8.5.6

  reply	other threads:[~2016-06-02 20:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 20:50 [RFC PATCH] x86/efi: Auto enable EFI memmap on SGI UV systems Joseph Thelen
2016-06-02 20:50 ` Joseph Thelen [this message]
     [not found]   ` <1464900635-11957-2-git-send-email-jthelen-sJ/iWh9BUns@public.gmane.org>
2016-06-08 11:12     ` [PATCH] " Ingo Molnar
     [not found]       ` <20160608111223.GA5772-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-14 22:19         ` Joseph Thelen
2016-06-08 12:36     ` Matt Fleming
     [not found]       ` <20160608123623.GW2658-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-06-14 22:34         ` Joseph Thelen
     [not found]           ` <20160614223448.GC172952-7ppMa7wkY9tKToyKb8PD+Zs2JHu2awxn0E9HWUfgJXw@public.gmane.org>
2016-06-17 20:57             ` Joseph Thelen

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=1464900635-11957-2-git-send-email-jthelen@sgi.com \
    --to=jthelen@sgi.com \
    --cc=athorlton@sgi.com \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox