public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Maly <bmaly@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix e820 end address with EFI
Date: Sat, 28 Feb 2009 11:26:21 -0500	[thread overview]
Message-ID: <49A965AD.10701@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 911 bytes --]


    On some EFI systems (i.e. Apple) EFI runtime is mapped into higher mem
regions. These EFI mem regions are not always taken into consideration when
max_pfn is calculated in setup.c being that e820_end_of_ram_pfn() only 
counts
mappings types marked as usable (E820_RAM). Currently we only count to 
the last
usable e820 address range and nothing beyond. EFI can be mapped anywhere 
within
e820 and is not always marked as usable e820, and so EFI runtime may be 
missed
if mapped somewhere beyond last usable e820. This patch attempts to resolve
this problem by including all E820 mappings when EFI is enabled, so that
the entire e820 (and EFI runtime area) is included in computing max_pfn. 
Tested
on a MacBook Pro 3.1 and resolves the issue (system now boots 
w/elilo+grub & EFI).

Signed-off-by: Brian Maly <bmaly@redhat>


e820.c |   13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)




[-- Attachment #2: apple-include-efi-runtime-in-e820_end-2.6.29.patch --]
[-- Type: text/x-patch, Size: 978 bytes --]


--- a/arch/x86/kernel/e820.c	2009-02-08 15:37:27.000000000 -0500
+++ b/arch/x86/kernel/e820.c	2009-02-28 07:20:09.000000000 -0500
@@ -51,6 +51,10 @@ unsigned long pci_mem_start = 0xaeedbabe
 EXPORT_SYMBOL(pci_mem_start);
 #endif
 
+#ifdef CONFIG_EFI
+extern int efi_enabled;
+#endif
+
 /*
  * This function checks if any part of the range <start,end> is mapped
  * with type.
@@ -1071,7 +1075,7 @@ static unsigned long __init e820_end_pfn
 		unsigned long start_pfn;
 		unsigned long end_pfn;
 
-		if (ei->type != type)
+		if (type && (ei->type != type))
 			continue;
 
 		start_pfn = ei->addr >> PAGE_SHIFT;
@@ -1096,7 +1100,12 @@ static unsigned long __init e820_end_pfn
 }
 unsigned long __init e820_end_of_ram_pfn(void)
 {
-	return e820_end_pfn(MAX_ARCH_PFN, E820_RAM);
+#ifdef CONFIG_EFI
+	if (efi_enabled)
+		return e820_end_pfn(MAX_ARCH_PFN, NULL);
+	else
+#endif
+		return e820_end_pfn(MAX_ARCH_PFN, E820_RAM);
 }
 
 unsigned long __init e820_end_of_low_ram_pfn(void)

             reply	other threads:[~2009-02-28 16:26 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-28 16:26 Brian Maly [this message]
2009-03-01  4:14 ` [PATCH] Fix e820 end address with EFI Yinghai Lu
2009-03-01  5:42   ` Yinghai Lu
2009-03-01 18:44     ` Brian Maly
2009-03-01 20:13     ` Brian Maly
2009-03-01 20:16       ` Yinghai Lu
2009-03-02  1:07       ` Huang Ying
2009-03-02  1:41         ` Brian Maly
2009-03-02  1:45         ` Brian Maly
     [not found]         ` <49AB38E7.60305@redhat.com>
2009-03-02  2:13           ` Huang Ying
2009-03-02  2:16             ` Yinghai Lu
2009-03-02  2:25               ` Huang Ying
2009-03-02  2:32                 ` Yinghai Lu
2009-03-02  2:37                   ` Huang Ying
2009-03-02  2:51                     ` Yinghai Lu
2009-03-02  7:45                       ` Huang Ying
2009-03-02 21:38                         ` Yinghai Lu
2009-03-03  1:07                           ` Huang Ying
2009-03-03  1:28                             ` Yinghai Lu
2009-03-03  2:22                               ` Huang Ying
2009-03-03  2:53                                 ` Yinghai Lu
2009-03-03  3:06                                   ` Huang Ying
2009-03-03  3:57                                     ` Yinghai Lu
2009-03-03  5:32                                       ` Huang Ying
2009-03-03  5:37                                         ` Yinghai Lu
2009-03-03  5:40                                           ` Huang Ying
2009-03-03  5:51                                             ` Yinghai Lu
2009-03-03  6:37                                               ` Huang Ying
2009-03-03  7:36                                                 ` [PATCH] x86: make init_memory_mapping could handle small range Yinghai Lu
2009-03-03  7:51                                                   ` [tip:x86/urgent] x86: fix init_memory_mapping() to handle small ranges Yinghai Lu
2009-03-02  2:57                     ` [PATCH] Fix e820 end address with EFI Brian Maly
2009-03-02  3:06                       ` Huang Ying

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=49A965AD.10701@redhat.com \
    --to=bmaly@redhat.com \
    --cc=linux-kernel@vger.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