public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] x86_64 boot: reserve highmem pages via reserve_early
@ 2008-06-02  6:26 Huang, Ying
  0 siblings, 0 replies; only message in thread
From: Huang, Ying @ 2008-06-02  6:26 UTC (permalink / raw)
  To: H. Peter Anvin, andi, mingo, tglx; +Cc: linux-kernel

This patch makes early reserved highmem pages become reserved
pages. This can be used for highmem pages allocated by bootloader such
as EFI memory map, linked list of setup_data, etc.

Signed-off-by: Huang Ying <ying.huang@intel.com>

---
 arch/x86/kernel/e820.c |   11 +++++++++++
 arch/x86/mm/init_32.c  |    3 ++-
 include/asm-x86/e820.h |    1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -612,6 +612,17 @@ void __init free_early(u64 start, u64 en
 	early_res[j - 1].end = 0;
 }
 
+int __init page_is_reserved_early(unsigned long pagenr)
+{
+	u64 start = (u64)pagenr << PAGE_SHIFT;
+	int i;
+	struct early_res *r;
+
+	i = find_overlapped_early(start, start + PAGE_SIZE);
+	r = &early_res[i];
+	return (i < MAX_EARLY_RES && r->end);
+}
+
 void __init early_res_to_bootmem(u64 start, u64 end)
 {
 	int i;
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -294,7 +294,8 @@ static void __init permanent_kmaps_init(
 
 void __init add_one_highpage_init(struct page *page, int pfn, int bad_ppro)
 {
-	if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) {
+	if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn)) &&
+	    !page_is_reserved_early(pfn)) {
 		ClearPageReserved(page);
 		init_page_count(page);
 		__free_page(page);
--- a/include/asm-x86/e820.h
+++ b/include/asm-x86/e820.h
@@ -83,6 +83,7 @@ extern u64 find_e820_area(u64 start, u64
 extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
 extern void reserve_early(u64 start, u64 end, char *name);
 extern void free_early(u64 start, u64 end);
+extern int page_is_reserved_early(unsigned long pagenr);
 extern void early_res_to_bootmem(u64 start, u64 end);
 
 #endif /* __ASSEMBLY__ */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-02  6:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-02  6:26 [PATCH 2/5] x86_64 boot: reserve highmem pages via reserve_early Huang, Ying

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox