mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: "Thomas Gleixner" <tglx@linutronix.de>,
	"Yinghai Lu" <yhlu.kernel@gmail.com>,
	"Jack Steiner" <steiner@sgi.com>, "Mike Travis" <travis@sgi.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org, "Huang,
	Ying" <ying.huang@intel.com>, "Andi Kleen" <andi@firstfloor.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	Paul Jackson <pj@sgi.com>
Subject: [PATCH 4/8] x86 boot: allow overlapping ebda and efi memmap memory ranges
Date: Sun, 15 Jun 2008 23:30:01 -0700	[thread overview]
Message-ID: <20080616063001.14597.96170.sendpatchset@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: <20080616062945.14597.78009.sendpatchset@polaris-admin.engr.sgi.com>

From: Paul Jackson <pj@sgi.com>

In order to support EFI firmware which places the EFI memmap within
the EBDA (Extended BIOS Data Area), allow for the possibility that we
might try to reserve_early() the "EFI memmap" area twice, once as part
of the larger EBDA area and once by itself.  Since the reserve_early()
mechanism does not allow such double reservations, detect and avoid the
"EFI memmap" reserve_early() call if it would overlap the EBDA area.

Signed-off-by: Paul Jackson <pj@sgi.com>

---
 arch/x86/kernel/efi.c       |    3 ++-
 arch/x86/kernel/head.c      |   12 +++++++++++-
 include/asm-x86/bios_ebda.h |    1 +
 include/asm-x86/e820.h      |    1 +
 4 files changed, 15 insertions(+), 2 deletions(-)

--- linux.orig/arch/x86/kernel/efi.c	2008-06-13 00:51:17.350774123 -0700
+++ linux/arch/x86/kernel/efi.c	2008-06-13 00:53:10.053599898 -0700
@@ -253,7 +253,8 @@ void __init efi_reserve_early(void)
 		boot_params.efi_info.efi_memdesc_size;
 	memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
 	memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
-	reserve_early(pmap, pmap + memmap.nr_map * memmap.desc_size,
+	if (!range_in_ebda_area(pmap, pmap + memmap.nr_map * memmap.desc_size))
+		reserve_early(pmap, pmap + memmap.nr_map * memmap.desc_size,
 		      "EFI memmap");
 }
 
--- linux.orig/arch/x86/kernel/head.c	2008-06-13 00:51:17.350774123 -0700
+++ linux/arch/x86/kernel/head.c	2008-06-13 00:52:45.208095174 -0700
@@ -6,6 +6,9 @@
 
 #define BIOS_LOWMEM_KILOBYTES 0x413
 
+static unsigned int __initdata ebda_start;
+static unsigned int __initdata ebda_end;
+
 /*
  * The BIOS places the EBDA/XBDA at the top of conventional
  * memory, and usually decreases the reported amount of
@@ -51,7 +54,14 @@ void __init reserve_ebda_region(void)
 		lowmem = 0x9f000;
 
 	/* reserve all memory between lowmem and the 1MB mark */
-	reserve_early(lowmem, 0x100000, "BIOS reserved");
+	ebda_start = lowmem;
+	ebda_end = 0x100000;
+	reserve_early(ebda_start, ebda_end, "BIOS reserved");
+}
+
+int __init range_in_ebda_area(u64 start, u64 end)
+{
+	return start >= ebda_start && end <= ebda_end;
 }
 
 void __init reserve_setup_data(void)
--- linux.orig/include/asm-x86/bios_ebda.h	2008-06-13 00:51:17.350774123 -0700
+++ linux/include/asm-x86/bios_ebda.h	2008-06-13 00:51:31.819650439 -0700
@@ -15,5 +15,6 @@ static inline unsigned int get_bios_ebda
 }
 
 void reserve_ebda_region(void);
+int range_in_ebda_area(u64 start, u64 end);
 
 #endif /* _MACH_BIOS_EBDA_H */
--- linux.orig/include/asm-x86/e820.h	2008-06-13 00:51:17.354774365 -0700
+++ linux/include/asm-x86/e820.h	2008-06-13 00:51:31.831651166 -0700
@@ -84,6 +84,7 @@ extern unsigned long end_user_pfn;
 extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
 extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
 extern void reserve_early(u64 start, u64 end, char *name);
+extern int range_in_ebda_area(u64 start, u64 end);
 extern void free_early(u64 start, u64 end);
 extern void early_res_to_bootmem(u64 start, u64 end);
 extern int page_is_reserved_early(unsigned long pagenr);

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373

  parent reply	other threads:[~2008-06-16  6:31 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-16  6:29 [PATCH 1/8] x86 boot: x86_64 build reserve_bootmem_generic fix Paul Jackson
2008-06-16  6:29 ` [PATCH 2/8] x86 boot: e820 code indentation fix Paul Jackson
2008-06-16  6:29 ` [PATCH 3/8] x86 boot: x86_64 efi compiler warning fix Paul Jackson
2008-06-16  6:30 ` Paul Jackson [this message]
2008-06-16  6:54   ` [PATCH 4/8] x86 boot: allow overlapping ebda and efi memmap memory ranges Yinghai Lu
2008-06-16  7:32     ` Paul Jackson
2008-06-16  7:34       ` Yinghai Lu
2008-06-16  8:31         ` Paul Jackson
2008-06-16  7:07   ` Huang, Ying
2008-06-16  8:24     ` Paul Jackson
2008-06-16  8:53       ` Huang, Ying
2008-06-16  9:09         ` Paul Jackson
2008-06-16  9:14           ` Huang, Ying
2008-06-16 15:48         ` H. Peter Anvin
2008-06-16 16:38           ` Paul Jackson
2008-06-16 17:05             ` H. Peter Anvin
2008-06-16 17:37               ` Paul Jackson
2008-06-16 17:41                 ` Yinghai Lu
2008-06-16 18:09                   ` Paul Jackson
2008-06-16 18:18                     ` H. Peter Anvin
2008-06-16 18:53                       ` Alan Cox
2008-06-16 19:58                         ` H. Peter Anvin
2008-06-16 17:46                 ` H. Peter Anvin
2008-06-16 18:05                   ` Paul Jackson
2008-06-17  1:00                     ` Huang, Ying
2008-06-16  6:30 ` [PATCH 5/8] x86 boot: remap efi systab runtime from phys to virt Paul Jackson
2008-06-16  7:02   ` Huang, Ying
2008-06-16  8:06     ` Paul Jackson
2008-06-16  8:27       ` Huang, Ying
2008-06-16  8:26         ` Paul Jackson
2008-06-16  6:30 ` [PATCH 6/8] x86 boot: virtualize the efi runtime function callback addresses Paul Jackson
2008-06-16  6:30 ` [PATCH 7/8] x86 boot: show pfn addresses in hex not decimal in some kernel info printks Paul Jackson
2008-06-16  7:05   ` Yinghai Lu
2008-06-16  8:09     ` Paul Jackson
2008-06-16  6:30 ` [PATCH 8/8] x86 boot: more consistently use type int for node ids Paul Jackson
2008-06-16  6:50 ` [PATCH 1/8] x86 boot: x86_64 build reserve_bootmem_generic fix Yinghai Lu
2008-06-16  8:40   ` Paul Jackson

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=20080616063001.14597.96170.sendpatchset@polaris-admin.engr.sgi.com \
    --to=pj@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=steiner@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=travis@sgi.com \
    --cc=yhlu.kernel@gmail.com \
    --cc=ying.huang@intel.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

all inboxes | Powered by JetHome®