From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: move e820_mark_nosave_regions to e820.c
Date: Tue, 20 May 2008 20:10:58 -0700 [thread overview]
Message-ID: <200805202010.58646.yhlu.kernel@gmail.com> (raw)
In-Reply-To: <200805180118.57863.yhlu.kernel@gmail.com>
and make e820_mark_nosave_regions to take limit_pfn to use max_low_pfn
for 32bit and end_pfn for 64bit
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/pfn.h>
+#include <linux/suspend.h>
#include <asm/pgtable.h>
#include <asm/page.h>
@@ -495,6 +496,36 @@ __init void e820_setup_gap(void)
pci_mem_start, gapstart, gapsize);
}
+#if defined(CONFIG_X86_64) || (defined(CONFIG_X86_32) && defined(CONFIG_PM) && defined(CONFIG_HIBERNATION))
+/**
+ * Find the ranges of physical addresses that do not correspond to
+ * e820 RAM areas and mark the corresponding pages as nosave for
+ * hibernation (32 bit) or software suspend and suspend to RAM (64 bit).
+ *
+ * This function requires the e820 map to be sorted and without any
+ * overlapping entries and assumes the first e820 area to be RAM.
+ */
+void __init e820_mark_nosave_regions(unsigned long limit_pfn)
+{
+ int i;
+ unsigned long pfn;
+
+ pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
+ for (i = 1; i < e820.nr_map; i++) {
+ struct e820entry *ei = &e820.map[i];
+
+ if (pfn < PFN_UP(ei->addr))
+ register_nosave_region(pfn, PFN_UP(ei->addr));
+
+ pfn = PFN_DOWN(ei->addr + ei->size);
+ if (ei->type != E820_RAM)
+ register_nosave_region(PFN_UP(ei->addr), pfn);
+
+ if (pfn >= limit_pfn)
+ break;
+ }
+}
+#endif
/*
* Early reserved memory areas.
Index: linux-2.6/arch/x86/kernel/e820_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820_32.c
+++ linux-2.6/arch/x86/kernel/e820_32.c
@@ -9,7 +9,6 @@
#include <linux/mm.h>
#include <linux/pfn.h>
#include <linux/uaccess.h>
-#include <linux/suspend.h>
#include <asm/pgtable.h>
#include <asm/page.h>
@@ -208,37 +207,6 @@ void __init init_iomem_resources(struct
}
}
-#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
-/**
- * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
- * correspond to e820 RAM areas and mark the corresponding pages as nosave for
- * hibernation.
- *
- * This function requires the e820 map to be sorted and without any
- * overlapping entries and assumes the first e820 area to be RAM.
- */
-void __init e820_mark_nosave_regions(void)
-{
- int i;
- unsigned long pfn;
-
- pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
- for (i = 1; i < e820.nr_map; i++) {
- struct e820entry *ei = &e820.map[i];
-
- if (pfn < PFN_UP(ei->addr))
- register_nosave_region(pfn, PFN_UP(ei->addr));
-
- pfn = PFN_DOWN(ei->addr + ei->size);
- if (ei->type != E820_RAM)
- register_nosave_region(PFN_UP(ei->addr), pfn);
-
- if (pfn >= max_low_pfn)
- break;
- }
-}
-#endif
-
/*
* Find the highest page frame number we have available
*/
Index: linux-2.6/arch/x86/kernel/e820_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820_64.c
+++ linux-2.6/arch/x86/kernel/e820_64.c
@@ -17,7 +17,6 @@
#include <linux/kexec.h>
#include <linux/module.h>
#include <linux/mm.h>
-#include <linux/suspend.h>
#include <linux/pfn.h>
#include <linux/pci.h>
@@ -94,37 +93,6 @@ void __init e820_reserve_resources(void)
}
/*
- * Find the ranges of physical addresses that do not correspond to
- * e820 RAM areas and mark the corresponding pages as nosave for software
- * suspend and suspend to RAM.
- *
- * This function requires the e820 map to be sorted and without any
- * overlapping entries and assumes the first e820 area to be RAM.
- */
-void __init e820_mark_nosave_regions(void)
-{
- int i;
- unsigned long paddr;
-
- paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
- for (i = 1; i < e820.nr_map; i++) {
- struct e820entry *ei = &e820.map[i];
-
- if (paddr < ei->addr)
- register_nosave_region(PFN_DOWN(paddr),
- PFN_UP(ei->addr));
-
- paddr = round_down(ei->addr + ei->size, PAGE_SIZE);
- if (ei->type != E820_RAM)
- register_nosave_region(PFN_UP(ei->addr),
- PFN_DOWN(paddr));
-
- if (paddr >= (end_pfn << PAGE_SHIFT))
- break;
- }
-}
-
-/*
* Finds an active region in the address range from start_pfn to last_pfn and
* returns its range in ei_startpfn and ei_endpfn for the e820 entry.
*/
Index: linux-2.6/arch/x86/kernel/setup_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_32.c
+++ linux-2.6/arch/x86/kernel/setup_32.c
@@ -789,7 +789,7 @@ void __init setup_arch(char **cmdline_p)
#endif
e820_setup_gap();
- e820_mark_nosave_regions();
+ e820_mark_nosave_regions(max_low_pfn);
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
Index: linux-2.6/arch/x86/kernel/setup_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_64.c
+++ linux-2.6/arch/x86/kernel/setup_64.c
@@ -499,7 +499,7 @@ void __init setup_arch(char **cmdline_p)
* We trust e820 completely. No explicit ROM probing in memory.
*/
e820_reserve_resources();
- e820_mark_nosave_regions();
+ e820_mark_nosave_regions(end_pfn);
/* request I/O space for devices used on all i[345]86 PCs */
for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
Index: linux-2.6/include/asm-x86/e820.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820.h
+++ linux-2.6/include/asm-x86/e820.h
@@ -70,6 +70,14 @@ extern u64 update_memory_range(u64 start
extern void update_e820(void);
extern void e820_setup_gap(void);
+#if defined(CONFIG_X86_64) || (defined(CONFIG_X86_32) && defined(CONFIG_PM) && defined(CONFIG_HIBERNATION))
+extern void e820_mark_nosave_regions(unsigned long limit_pfn);
+#else
+static inline void e820_mark_nosave_regions(unsigned long limit_pfn)
+{
+}
+#endif
+
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);
Index: linux-2.6/include/asm-x86/e820_32.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820_32.h
+++ linux-2.6/include/asm-x86/e820_32.h
@@ -28,13 +28,5 @@ extern void init_iomem_resources(struct
struct resource *data_resource,
struct resource *bss_resource);
-#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
-extern void e820_mark_nosave_regions(void);
-#else
-static inline void e820_mark_nosave_regions(void)
-{
-}
-#endif
-
#endif/*!__ASSEMBLY__*/
#endif/*__E820_HEADER*/
Index: linux-2.6/include/asm-x86/e820_64.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820_64.h
+++ linux-2.6/include/asm-x86/e820_64.h
@@ -18,7 +18,6 @@ extern void setup_memory_region(void);
extern void contig_e820_setup(void);
extern unsigned long e820_end_of_ram(void);
extern void e820_reserve_resources(void);
-extern void e820_mark_nosave_regions(void);
extern int e820_any_non_reserved(unsigned long start, unsigned long end);
extern int is_memory_any_valid(unsigned long start, unsigned long end);
extern int e820_all_non_reserved(unsigned long start, unsigned long end);
next prev parent reply other threads:[~2008-05-21 3:10 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-11 7:30 [PATCH] x86: make e820.c to have common functions Yinghai Lu
2008-05-13 13:05 ` Ingo Molnar
2008-05-13 17:35 ` Yinghai Lu
2008-05-18 8:18 ` [PATCH] x86: extend e820 ealy_res support 32bit Yinghai Lu
2008-05-21 3:10 ` Yinghai Lu [this message]
2008-05-22 1:40 ` [PATCH] x86: extend e820 ealy_res support 32bit - fix Yinghai Lu
2008-05-22 10:12 ` Jeremy Fitzhardinge
2008-05-22 17:58 ` Yinghai Lu
2008-05-22 22:20 ` [PATCH] x86: extend e820 ealy_res support 32bit - fix v2 Yinghai Lu
2008-05-23 23:08 ` Yinghai Lu
2008-05-23 23:32 ` Jeremy Fitzhardinge
2008-05-23 23:38 ` Jeremy Fitzhardinge
2008-05-24 0:01 ` Yinghai Lu
2008-05-24 0:09 ` Yinghai Lu
2008-05-24 8:54 ` Jeremy Fitzhardinge
2008-05-24 9:49 ` [PATCH] xen: boot via i386_start_kernel to get early reservations Jeremy Fitzhardinge
2008-05-24 22:04 ` Yinghai Lu
2008-05-24 19:57 ` [PATCH] x86: extend e820 ealy_res support 32bit - fix v2 Yinghai Lu
2008-05-25 17:00 ` [PATCH] x86: extend e820 ealy_res support 32bit - fix #2 Yinghai Lu
2008-05-27 15:44 ` Thomas Gleixner
2008-05-27 20:37 ` Jeremy Fitzhardinge
2008-05-27 20:58 ` Thomas Gleixner
2008-05-27 21:06 ` Jeremy Fitzhardinge
2008-05-27 21:06 ` Yinghai Lu
2008-05-27 21:22 ` Jeremy Fitzhardinge
2008-05-27 21:35 ` Yinghai Lu
2008-05-27 21:47 ` Jeremy Fitzhardinge
2008-05-27 22:52 ` Yinghai Lu
2008-05-28 10:01 ` Jeremy Fitzhardinge
2008-05-28 20:48 ` Yinghai Lu
2008-05-28 21:24 ` Jeremy Fitzhardinge
2008-05-29 13:37 ` Jeremy Fitzhardinge
2008-05-29 18:41 ` Yinghai Lu
2008-05-29 18:58 ` H. Peter Anvin
2008-05-29 18:52 ` Yinghai Lu
2008-05-29 19:14 ` Yinghai Lu
2008-05-30 15:50 ` Jeremy Fitzhardinge
2008-05-29 19:56 ` [PATCH] x86: extend e820 early_res support 32bit -fix #3 Yinghai Lu
2008-05-29 19:57 ` [PATCH] x86: extend e820 early_res support 32bit -fix #4 Yinghai Lu
2008-05-29 19:58 ` [PATCH] x86: extend e820 early_res support 32bit -fix #5 Yinghai Lu
2008-05-29 23:25 ` [PATCH] x86: 32bit numa srat fix early_ioremap leak Yinghai Lu
2008-05-31 8:01 ` Ingo Molnar
2008-06-01 5:51 ` [PATCH] x86: 32bit numa increase max_elements to 1024 Yinghai Lu
2008-06-01 5:52 ` [PATCH] x86: change propagate_e820_map back to find_max_pfn -32bit Yinghai Lu
2008-06-01 5:53 ` [PATCH] x86: set node_remap_size[0] in fallback path Yinghai Lu
2008-06-01 5:56 ` [PATCH] x86: numa_32 print out debug info all kva Yinghai Lu
2008-06-01 20:15 ` [PATCH] x86: numa_32 print out debug info all kva v2 Yinghai Lu
2008-06-03 2:16 ` [PATCH] x86: change propagate_e820_map back to find_max_pfn -32bit -v2 Yinghai Lu
2008-06-02 4:06 ` [PATCH] x86: numa_32 avoid clash between ramdisk and kva Yinghai Lu
2008-06-02 6:53 ` [PATCH] x86: cleanup max_pfn_mapped usage - 32bit Yinghai Lu
2008-06-02 6:55 ` [PATCH] x86: cleanup max_pfn_mapped usage - 64bit Yinghai Lu
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=200805202010.58646.yhlu.kernel@gmail.com \
--to=yhlu.kernel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox