public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Kevin O'Connor" <kevin@koconnor.net>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Stefan Reinauer <stepan@coresystems.de>,
	linux-kernel@vger.kernel.org, coreboot@coreboot.org
Subject: [PATCH] x86: ioremap mptable -v2
Date: Sun, 01 Mar 2009 19:23:10 -0800	[thread overview]
Message-ID: <49AB511E.9010507@kernel.org> (raw)
In-Reply-To: <20090301180420.GA27040@morn.localdomain>


Impact: fix boot with mptable above max_low_mapped

try to use early_ioremap it.

v2: also get the exact size for reserve_bootmem in case we got big size than 4k

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Reported-and-tested-by: Kevin O'Connor <kevin@koconnor.net>

---
 arch/x86/kernel/mpparse.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -611,12 +611,20 @@ static void __init __get_smp_config(unsi
 		construct_default_ISA_mptable(mpf->feature1);
 
 	} else if (mpf->physptr) {
+		struct mpc_table *mpc;
+		unsigned long size;
 
+		mpc = early_ioremap(mpf->physptr, PAGE_SIZE);
+		size = mpc->length;
+		apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", (unsigned long)mpf->physptr,
+			 mpf->physptr + size);
+		early_iounmap(mpc, PAGE_SIZE);
+		mpc = early_ioremap(mpf->physptr, size);
 		/*
 		 * Read the physical hardware table.  Anything here will
 		 * override the defaults.
 		 */
-		if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) {
+		if (!smp_read_mpc(mpc, early)) {
 #ifdef CONFIG_X86_LOCAL_APIC
 			smp_found_config = 0;
 #endif
@@ -624,9 +632,12 @@ static void __init __get_smp_config(unsi
 			       "BIOS bug, MP table errors detected!...\n");
 			printk(KERN_ERR "... disabling SMP support. "
 			       "(tell your hw vendor)\n");
+			early_iounmap(mpc, size);
 			return;
 		}
 
+		early_iounmap(mpc, size);
+
 		if (early)
 			return;
 #ifdef CONFIG_X86_IO_APIC
@@ -700,7 +711,12 @@ static int __init smp_scan_config(unsign
 			reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
 					BOOTMEM_DEFAULT);
 			if (mpf->physptr) {
-				unsigned long size = PAGE_SIZE;
+				struct mpc_table *mpc;
+				unsigned long size;
+
+				mpc = early_ioremap(mpf->physptr, PAGE_SIZE);
+				size = mpc->length;
+				early_iounmap(mpc, PAGE_SIZE);
 #ifdef CONFIG_X86_32
 				/*
 				 * We cannot access to MPC table to compute[PATCH] x86: ioremap mptable -v2

Impact: fix boot with mptable above max_low_mapped

try to use early_ioremap it.

v2: also get the exact size for reserve_bootmem in case we got big size than 4k

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Reported-and-tested-by: Kevin O'Connor <kevin@koconnor.net>

---
 arch/x86/kernel/mpparse.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -611,12 +611,20 @@ static void __init __get_smp_config(unsi
 		construct_default_ISA_mptable(mpf->feature1);
 
 	} else if (mpf->physptr) {
+		struct mpc_table *mpc;
+		unsigned long size;
 
+		mpc = early_ioremap(mpf->physptr, PAGE_SIZE);
+		size = mpc->length;
+		apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", (unsigned long)mpf->physptr,
+			 mpf->physptr + size);
+		early_iounmap(mpc, PAGE_SIZE);
+		mpc = early_ioremap(mpf->physptr, size);
 		/*
 		 * Read the physical hardware table.  Anything here will
 		 * override the defaults.
 		 */
-		if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) {
+		if (!smp_read_mpc(mpc, early)) {
 #ifdef CONFIG_X86_LOCAL_APIC
 			smp_found_config = 0;
 #endif
@@ -624,9 +632,12 @@ static void __init __get_smp_config(unsi
 			       "BIOS bug, MP table errors detected!...\n");
 			printk(KERN_ERR "... disabling SMP support. "
 			       "(tell your hw vendor)\n");
+			early_iounmap(mpc, size);
 			return;
 		}
 
+		early_iounmap(mpc, size);
+
 		if (early)
 			return;
 #ifdef CONFIG_X86_IO_APIC
@@ -700,7 +711,12 @@ static int __init smp_scan_config(unsign
 			reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
 					BOOTMEM_DEFAULT);
 			if (mpf->physptr) {
-				unsigned long size = PAGE_SIZE;
+				struct mpc_table *mpc;
+				unsigned long size;
+
+				mpc = early_ioremap(mpf->physptr, PAGE_SIZE);
+				size = mpc->length;
+				early_iounmap(mpc, PAGE_SIZE);
 #ifdef CONFIG_X86_32
 				/*
 				 * We cannot access to MPC table to compute

  reply	other threads:[~2009-03-02  3:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <499DB40C.1060205@coresystems.de>
     [not found] ` <499DB480.1000909@coresystems.de>
     [not found]   ` <499DB6D8.5040706@coresystems.de>
     [not found]     ` <499DBDA0.2010606@coresystems.de>
     [not found]       ` <499DCE79.8020809@coresystems.de>
2009-02-22 15:25         ` MPTable can not be high-memory on Linux Kevin O'Connor
2009-02-22 17:06           ` Rafael J. Wysocki
2009-02-22 21:33             ` Yinghai Lu
2009-02-22 22:32               ` Kevin O'Connor
2009-02-22 22:58                 ` Ingo Molnar
2009-02-23  6:14                   ` Yinghai Lu
2009-02-23  6:42                     ` Ingo Molnar
2009-02-28 23:41                     ` Kevin O'Connor
2009-03-01  3:10                       ` Yinghai Lu
2009-03-01 18:04                         ` Kevin O'Connor
2009-03-02  3:23                           ` Yinghai Lu [this message]
2009-03-02 10:18                             ` [PATCH] x86: ioremap mptable -v2 Ingo Molnar
2009-03-02 10:19                               ` Ingo Molnar
2009-03-02 20:07                               ` Yinghai Lu
2009-03-02 20:29                                 ` Ingo Molnar
2009-03-02 20:46                                   ` Yinghai Lu
2009-03-02 20:57                                     ` Ingo Molnar
2009-02-22 17:53           ` MPTable can not be high-memory on Linux Andi Kleen

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=49AB511E.9010507@kernel.org \
    --to=yinghai@kernel.org \
    --cc=coreboot@coreboot.org \
    --cc=kevin@koconnor.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rjw@sisk.pl \
    --cc=stepan@coresystems.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