From: Wu Fengguang <fengguang.wu@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
To: Ingo Molnar <mingo@redhat.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Yinghai Lu <yinghai@kernel.org>
Cc: x86@kernel.org
Cc: Wu Fengguang <fengguang.wu@intel.com>,
LKML <linux-kernel@vger.kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>,
shaohui.zheng@intel.com,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: [PATCH 2/3] x86: remove bios data range from e820
Date: Fri, 22 Jan 2010 11:21:04 +0800 [thread overview]
Message-ID: <20100122033004.335813103@intel.com> (raw)
In-Reply-To: 20100122032102.137106635@intel.com
[-- Attachment #1: remove_bios_begin_end.patch --]
[-- Type: text/plain, Size: 3024 bytes --]
From: Yinghai Lu <yinghai@kernel.org>
To prepare move page_is_ram() as generic one.
Tested-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/e820.c | 8 ++++++++
arch/x86/kernel/setup.c | 19 ++++++++++++++++++-
arch/x86/mm/ioremap.c | 16 ----------------
3 files changed, 26 insertions(+), 17 deletions(-)
--- linux-mm.orig/arch/x86/kernel/setup.c 2010-01-22 11:20:33.000000000 +0800
+++ linux-mm/arch/x86/kernel/setup.c 2010-01-22 11:20:37.000000000 +0800
@@ -659,6 +659,23 @@ static struct dmi_system_id __initdata b
{}
};
+static void __init trim_bios_range(void)
+{
+ /*
+ * A special case is the first 4Kb of memory;
+ * This is a BIOS owned area, not kernel ram, but generally
+ * not listed as such in the E820 table.
+ */
+ e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED);
+ /*
+ * special case: Some BIOSen report the PC BIOS
+ * area (640->1Mb) as ram even though it is not.
+ * take them out.
+ */
+ e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
+ sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+}
+
/*
* Determine if we were loaded by an EFI loader. If so, then we have also been
* passed the efi memmap, systab, etc., so we should use these data structures
@@ -822,7 +839,7 @@ void __init setup_arch(char **cmdline_p)
insert_resource(&iomem_resource, &data_resource);
insert_resource(&iomem_resource, &bss_resource);
-
+ trim_bios_range();
#ifdef CONFIG_X86_32
if (ppro_with_ram_bug()) {
e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
--- linux-mm.orig/arch/x86/kernel/e820.c 2010-01-22 11:20:33.000000000 +0800
+++ linux-mm/arch/x86/kernel/e820.c 2010-01-22 11:20:37.000000000 +0800
@@ -517,11 +517,19 @@ u64 __init e820_remove_range(u64 start,
int checktype)
{
int i;
+ u64 end;
u64 real_removed_size = 0;
if (size > (ULLONG_MAX - start))
size = ULLONG_MAX - start;
+ end = start + size;
+ printk(KERN_DEBUG "e820 remove range: %016Lx - %016Lx ",
+ (unsigned long long) start,
+ (unsigned long long) end);
+ e820_print_type(old_type);
+ printk(KERN_CONT "\n");
+
for (i = 0; i < e820.nr_map; i++) {
struct e820entry *ei = &e820.map[i];
u64 final_start, final_end;
--- linux-mm.orig/arch/x86/mm/ioremap.c 2010-01-22 11:20:33.000000000 +0800
+++ linux-mm/arch/x86/mm/ioremap.c 2010-01-22 11:20:37.000000000 +0800
@@ -29,22 +29,6 @@ int page_is_ram(unsigned long pagenr)
resource_size_t addr, end;
int i;
- /*
- * A special case is the first 4Kb of memory;
- * This is a BIOS owned area, not kernel ram, but generally
- * not listed as such in the E820 table.
- */
- if (pagenr == 0)
- return 0;
-
- /*
- * Second special case: Some BIOSen report the PC BIOS
- * area (640->1Mb) as ram even though it is not.
- */
- if (pagenr >= (BIOS_BEGIN >> PAGE_SHIFT) &&
- pagenr < (BIOS_END >> PAGE_SHIFT))
- return 0;
-
for (i = 0; i < e820.nr_map; i++) {
/*
* Not usable memory:
next prev parent reply other threads:[~2010-01-22 3:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-22 3:21 [PATCH 0/3] generic hotplug friendly page_is_ram() Wu Fengguang
2010-01-22 3:21 ` [PATCH 1/3] resources: introduce generic page_is_ram() Wu Fengguang
2010-01-22 4:10 ` KAMEZAWA Hiroyuki
2010-01-22 4:20 ` [PATCH 1/3 v3] " Wu Fengguang
2010-01-22 5:15 ` [PATCH 1/3] " Xiaotian Feng
2010-01-22 5:37 ` Wu Fengguang
2010-01-22 5:50 ` Xiaotian Feng
2010-01-22 5:52 ` Wu Fengguang
2010-01-22 7:51 ` H. Peter Anvin
2010-01-22 8:16 ` [PATCH 1/3 v4] " Wu Fengguang
2010-01-27 0:30 ` Andrew Morton
2010-01-27 3:06 ` Wu Fengguang
2010-02-02 1:01 ` [tip:x86/mm] Move page_is_ram() declaration to mm.h tip-bot for Wu Fengguang
2010-01-22 3:21 ` Wu Fengguang [this message]
2010-01-22 4:06 ` [PATCH 2/3] x86: remove bios data range from e820 Wu Fengguang
2010-01-27 0:32 ` Andrew Morton
2010-02-02 1:01 ` [tip:x86/mm] x86: Remove BIOS " tip-bot for Yinghai Lu
2010-01-22 3:21 ` [PATCH 3/3] x86: use the generic page_is_ram() Wu Fengguang
2010-02-02 1:01 ` [tip:x86/mm] x86: Use " tip-bot for Wu Fengguang
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=20100122033004.335813103@intel.com \
--to=fengguang.wu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=tglx@linutronix.de \
--cc=yinghai@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