linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot for H. Peter Anvin" <hpa@linux.intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/bios] x86, bios: By default, reserve the low 64K for all BIOSes
Date: Wed, 25 Aug 2010 00:37:02 GMT	[thread overview]
Message-ID: <tip-d0cd7425fab774a480cce17c2f649984312d0b55@git.kernel.org> (raw)
In-Reply-To: <tip-*@git.kernel.org>

Commit-ID:  d0cd7425fab774a480cce17c2f649984312d0b55
Gitweb:     http://git.kernel.org/tip/d0cd7425fab774a480cce17c2f649984312d0b55
Author:     H. Peter Anvin <hpa@linux.intel.com>
AuthorDate: Tue, 24 Aug 2010 17:32:04 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Tue, 24 Aug 2010 17:32:04 -0700

x86, bios: By default, reserve the low 64K for all BIOSes

The laundry list of BIOSes that need the low 64K reserved is getting
very long, so make it the default across all BIOSes.  This also allows
the code to be simplified and unified with the reservation code for
the first 4K.

This resolves kernel bugzilla 16661 and who knows what else...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
LKML-Reference: <tip-*@git.kernel.org>
---
 arch/x86/Kconfig        |   47 +++++++++++++++----------
 arch/x86/kernel/setup.c |   84 ++++-------------------------------------------
 2 files changed, 35 insertions(+), 96 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index cea0cd9..683ae8f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1326,25 +1326,34 @@ config X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK
 	  Set whether the default state of memory_corruption_check is
 	  on or off.
 
-config X86_RESERVE_LOW_64K
-	bool "Reserve low 64K of RAM on AMI/Phoenix BIOSen"
-	default y
-	---help---
-	  Reserve the first 64K of physical RAM on BIOSes that are known
-	  to potentially corrupt that memory range. A numbers of BIOSes are
-	  known to utilize this area during suspend/resume, so it must not
-	  be used by the kernel.
-
-	  Set this to N if you are absolutely sure that you trust the BIOS
-	  to get all its memory reservations and usages right.
-
-	  If you have doubts about the BIOS (e.g. suspend/resume does not
-	  work or there's kernel crashes after certain hardware hotplug
-	  events) and it's not AMI or Phoenix, then you might want to enable
-	  X86_CHECK_BIOS_CORRUPTION=y to allow the kernel to check typical
-	  corruption patterns.
-
-	  Say Y if unsure.
+config X86_LOW_RESERVE
+	int "Amount of low memory, in kilobytes, to reserve for the BIOS"
+	default 64
+	range 4 640
+	---help---
+	  Specify the amount of low memory to reserve for the BIOS.
+
+	  The first page contains BIOS data structures that the kernel
+	  must not use, so that page must always be reserved.
+
+	  By default we reserve the first 64K of physical RAM, as a
+	  number of BIOSes are known to corrupt that memory range
+	  during events such as suspend/resume or monitor cable
+	  insertion, so it must not be used by the kernel.
+
+	  You can set this to 4 if you are absolutely sure that you
+	  trust the BIOS to get all its memory reservations and usages
+	  right.  If you know your BIOS have problems beyond the
+	  default 64K area, you can set this to 640 to avoid using the
+	  entire low memory range.
+
+	  If you have doubts about the BIOS (e.g. suspend/resume does
+	  not work or there's kernel crashes after certain hardware
+	  hotplug events) then you might want to enable
+	  X86_CHECK_BIOS_CORRUPTION=y to allow the kernel to check
+	  typical corruption patterns.
+
+	  Leave this to the default value of 64 if you are unsure.
 
 config MATH_EMULATION
 	bool
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c3a4fbb..eb87f1c 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -618,88 +618,20 @@ static __init void reserve_ibft_region(void)
 		reserve_early_overlap_ok(addr, addr + size, "ibft");
 }
 
-#ifdef CONFIG_X86_RESERVE_LOW_64K
-static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
-{
-	printk(KERN_NOTICE
-		"%s detected: BIOS may corrupt low RAM, working around it.\n",
-		d->ident);
-
-	e820_update_range(0, 0x10000, E820_RAM, E820_RESERVED);
-	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
-
-	return 0;
-}
-#endif
-
-/* List of systems that have known low memory corruption BIOS problems */
-static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
-#ifdef CONFIG_X86_RESERVE_LOW_64K
-	{
-		.callback = dmi_low_memory_corruption,
-		.ident = "AMI BIOS",
-		.matches = {
-			DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
-		},
-	},
-	{
-		.callback = dmi_low_memory_corruption,
-		.ident = "Phoenix BIOS",
-		.matches = {
-			DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies"),
-		},
-	},
-	{
-		.callback = dmi_low_memory_corruption,
-		.ident = "Phoenix/MSC BIOS",
-		.matches = {
-			DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix/MSC"),
-		},
-	},
-	/*
-	 * AMI BIOS with low memory corruption was found on Intel DG45ID and
-	 * DG45FC boards.
-	 * It has a different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
-	 * match only DMI_BOARD_NAME and see if there is more bad products
-	 * with this vendor.
-	 */
-	{
-		.callback = dmi_low_memory_corruption,
-		.ident = "AMI BIOS",
-		.matches = {
-			DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
-		},
-	},
-	{
-		.callback = dmi_low_memory_corruption,
-		.ident = "AMI BIOS",
-		.matches = {
-			DMI_MATCH(DMI_BOARD_NAME, "DG45FC"),
-		},
-	},
-	/*
-	 * The Dell Inspiron Mini 1012 has DMI_BIOS_VENDOR = "Dell Inc.", so
-	 * match on the product name.
-	 */
-	{
-		.callback = dmi_low_memory_corruption,
-		.ident = "Phoenix BIOS",
-		.matches = {
-			DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"),
-		},
-	},
-#endif
-	{}
-};
-
 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.
+	 *
+	 * This typically reserves additional memory (64KiB by default)
+	 * since some BIOSes are known to corrupt low memory.  See the
+	 * Kconfig help text for X86_LOW_RESERVE.
 	 */
-	e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED);
+	e820_update_range(0, ALIGN(CONFIG_X86_LOW_RESERVE << 10, PAGE_SIZE),
+			  E820_RAM, E820_RESERVED);
+
 	/*
 	 * special case: Some BIOSen report the PC BIOS
 	 * area (640->1Mb) as ram even though it is not.
@@ -863,8 +795,6 @@ void __init setup_arch(char **cmdline_p)
 
 	dmi_scan_machine();
 
-	dmi_check_system(bad_bios_dmi_table);
-
 	/*
 	 * VMware detection requires dmi to be available, so this
 	 * needs to be done after dmi_scan_machine, for the BP.

  parent reply	other threads:[~2010-08-25  0:37 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-*@git.kernel.org>
2009-12-12  0:16 ` [tip:x86/urgent] nvram: Fix write beyond end condition; prove to gcc copy is safe tip-bot for H. Peter Anvin
2009-12-15 23:18 ` [tip:x86/urgent] x86, msr/cpuid: Register enough minors for the MSR and CPUID drivers tip-bot for H. Peter Anvin
2010-02-19  6:21 ` [tip:x86/setup] x86-64, setup: Inhibit decompressor output if video info is invalid tip-bot for H. Peter Anvin
2010-02-19 21:41 ` [tip:x86/setup] x86, setup: Don't skip mode setting for the standard VGA modes tip-bot for H. Peter Anvin
2010-06-10  0:10 ` [tip:x86/alternatives] x86, alternatives: Use 16-bit numbers for cpufeature index tip-bot for H. Peter Anvin
2010-06-11 18:24   ` tip-bot for H. Peter Anvin
2010-06-25  9:20   ` Lai Jiangshan
2010-06-25 15:35     ` H. Peter Anvin
2010-06-28  7:58       ` Lai Jiangshan
2010-06-28 18:58         ` H. Peter Anvin
2010-06-28 19:06         ` H. Peter Anvin
2010-06-29  4:58           ` Lai Jiangshan
2010-06-29  7:07     ` [tip:x86/alternatives] x86, alternatives: correct obsolete use of "u8" in static_cpu_has() tip-bot for H. Peter Anvin
2010-06-29  7:06   ` [tip:x86/alternatives] x86, alternatives: Use 16-bit numbers for cpufeature index tip-bot for tip-bot for H. Peter Anvin
2010-06-29  9:15     ` Ingo Molnar
2010-06-29 15:33       ` H. Peter Anvin
2010-07-07 17:45   ` tip-bot for H. Peter Anvin
2010-07-20  2:06 ` [tip:x86/cpu] x86, cpu: Clean up formatting in cpufeature.h, remove override tip-bot for H. Peter Anvin
2010-07-20  2:06 ` [tip:x86/cpu] x86, cpu: Split addon_cpuid_features.c tip-bot for H. Peter Anvin
2010-08-12  6:12 ` [tip:x86/urgent] x86, asm: Refactor atomic64_386_32.S to support old binutils and be cleaner tip-bot for Luca Barbieri
2010-08-12 12:15   ` Luca Barbieri
2010-08-12 14:05     ` H. Peter Anvin
2010-08-12 15:18       ` Luca Barbieri
2010-08-12 15:33   ` [tip:x86/urgent] x86, asm: Use a lower case name for the end macro in atomic64_386_32.S tip-bot for Luca Barbieri
2010-08-19 19:06   ` [tip:x86/urgent] x86, asm: Refactor atomic64_386_32.S to support old binutils and be cleaner D. Stussy
2010-08-19 21:23     ` H. Peter Anvin
2010-08-20  8:21       ` Ingo Molnar
2010-08-25  0:37 ` tip-bot for H. Peter Anvin [this message]
2010-08-26  0:12   ` [tip:x86/bios] x86, bios: Make the x86 early memory reservation a kernel option tip-bot for H. Peter Anvin
2010-09-17 23:46 ` [tip:x86/idle] x86, mwait: Move mwait constants to a common header file tip-bot for H. Peter Anvin

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=tip-d0cd7425fab774a480cce17c2f649984312d0b55@git.kernel.org \
    --to=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).