mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Yinghai <yinghai.lu@oracle.com>,
	x86@kernel.org, Suresh Siddha <suresh.b.siddha@intel.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Jens Axboe <jens.axboe@oracle.com>,
	Jack Steiner <steiner@sgi.com>,
	LKML <linux-kernel@vger.kernel.org>,
	jkosina@novell.com
Subject: [Patch 1/1] x86 efi: insert add_efi_memmap entries into both e820 maps
Date: Mon, 24 May 2010 16:04:50 -0700	[thread overview]
Message-ID: <4BFB0612.5020409@sgi.com> (raw)
In-Reply-To: <4BEC8161.6050206@zytor.com>

Currently, the e820_reserve_resources() function does not add entries
obtained via the "add_efi_memmap" kernel cmdline option.  This causes
/sys/firmware/memmap/... to be incomplete (stops after 128 entries).
Utilities that examine these entries then do not get the complete
picture of system memory.

This patch causes the add_efi_memmap function to add the memmap entries
to both the e820 map and the e820_saved map.

Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Jack Steiner <steiner@sgi.com>
---
 arch/x86/include/asm/e820.h |    1 +
 arch/x86/kernel/e820-xen.c  |    5 +++++
 arch/x86/kernel/e820.c      |   11 ++++++++---
 arch/x86/kernel/efi.c       |    3 +++
 4 files changed, 17 insertions(+), 3 deletions(-)

--- linux-2.6.32.orig/arch/x86/include/asm/e820.h
+++ linux-2.6.32/arch/x86/include/asm/e820.h
@@ -70,6 +70,7 @@ extern unsigned long pci_mem_start;
 extern int e820_any_mapped(u64 start, u64 end, unsigned type);
 extern int e820_all_mapped(u64 start, u64 end, unsigned type);
 extern void e820_add_region(u64 start, u64 size, int type);
+extern void e820_saved_add_region(u64 start, u64 size, int type);
 extern void e820_print_map(char *who);
 extern int
 sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, u32 *pnr_map);
--- linux-2.6.32.orig/arch/x86/kernel/e820-xen.c
+++ linux-2.6.32/arch/x86/kernel/e820-xen.c
@@ -150,6 +150,11 @@ void __init e820_add_region(u64 start, u
 	__e820_add_region(&e820, start, size, type);
 }
 
+void __init e820_saved_add_region(u64 start, u64 size, int type)
+{
+	__e820_add_region(&e820_saved, start, size, type);
+}
+
 static void __init e820_print_type(u32 type)
 {
 	switch (type) {
--- linux-2.6.32.orig/arch/x86/kernel/e820.c
+++ linux-2.6.32/arch/x86/kernel/e820.c
@@ -33,9 +33,9 @@
  * and that is also registered with modifications in the kernel resource tree
  * with the iomem_resource as parent.
  *
- * The e820_saved is directly saved after the BIOS-provided memory map is
- * copied. It doesn't get modified afterwards. It's registered for the
- * /sys/firmware/memmap interface.
+ * The e820_saved is saved after the BIOS-provided memory map is copied as
+ * well as the optional add_efi_memmap entries are processed.  It doesn't get
+ * modified afterwards. It's registered for the /sys/firmware/memmap interface.
  *
  * That memory map is not modified and is used as base for kexec. The kexec'd
  * kernel should get the same memory map as the firmware provides. Then the
@@ -132,6 +132,11 @@ void __init e820_add_region(u64 start, u
 	__e820_add_region(&e820, start, size, type);
 }
 
+void __init e820_saved_add_region(u64 start, u64 size, int type)
+{
+	__e820_add_region(&e820_saved, start, size, type);
+}
+
 static void __init e820_print_type(u32 type)
 {
 	switch (type) {
--- linux-2.6.32.orig/arch/x86/kernel/efi.c
+++ linux-2.6.32/arch/x86/kernel/efi.c
@@ -271,8 +271,11 @@ static void __init do_add_efi_memmap(voi
 			break;
 		}
 		e820_add_region(start, size, e820_type);
+		e820_saved_add_region(start, size, e820_type);
 	}
 	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+	sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map),
+							&e820_saved.nr_map);
 }
 
 void __init efi_reserve_early(void)


  reply	other threads:[~2010-05-24 23:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 18:10 [Patch 1/1] x86 efi: Fill all reserved memmap entries if add_efi_memmap specified Mike Travis
2010-05-12 18:55 ` H. Peter Anvin
2010-05-12 20:19   ` Yinghai
2010-05-12 21:02     ` Mike Travis
2010-05-13 21:18       ` Mike Travis
2010-05-13 21:48         ` Yinghai
2010-05-13 21:55           ` Mike Travis
2010-05-13 22:46             ` H. Peter Anvin
2010-05-24 23:04               ` Mike Travis [this message]
2010-05-25 22:34               ` Mike Travis
2010-05-25 22:41                 ` H. Peter Anvin
2010-05-25 22:46                   ` Mike Travis
2010-05-25 22:49                     ` H. Peter Anvin
2010-05-26 17:39                     ` Yinghai Lu
2010-05-26 17:42                       ` Mike Travis
2010-05-26 18:22                         ` H. Peter Anvin
2010-05-26 18:47                           ` Mike Travis
2010-05-26 19:04                             ` H. Peter Anvin
2010-05-26 19:09                               ` Mike Travis
2010-05-26 20:10                                 ` H. Peter Anvin
2010-05-25 22:59                   ` [Patch 1/1] x86 efi: Fill all reserved memmap entries if add_efi_memmap specified v2 Mike Travis

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=4BFB0612.5020409@sgi.com \
    --to=travis@sgi.com \
    --cc=hpa@zytor.com \
    --cc=jens.axboe@oracle.com \
    --cc=jkosina@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --cc=steiner@sgi.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yinghai.lu@oracle.com \
    /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

Powered by JetHome