From: Yinghai Lu <yinghai@kernel.org>
To: Brian Maly <bmaly@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Huang Ying <ying.huang@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix e820 end address with EFI
Date: Sat, 28 Feb 2009 21:42:56 -0800 [thread overview]
Message-ID: <86802c440902282142p14f623b8td8a88600ff2a6bbe@mail.gmail.com> (raw)
In-Reply-To: <86802c440902282014he17bb6an1f59872ef30db0c5@mail.gmail.com>
On Sat, Feb 28, 2009 at 8:14 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Sat, Feb 28, 2009 at 8:26 AM, Brian Maly <bmaly@redhat.com> wrote:
>>
>> 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).
>>
>
> it seems you should check and enable directly mapping when EFI runtime
> service is enabled.
it seems in efi_enter_virtual_mode already called efi_ioremap() for
the range above max_low_pfn_mapped...
so it seems you meet other problems.
YH
void __init efi_enter_virtual_mode(void)
{
efi_memory_desc_t *md;
efi_status_t status;
unsigned long size;
u64 end, systab, addr, npages;
void *p, *va;
efi.systab = NULL;
for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
md = p;
if (!(md->attribute & EFI_MEMORY_RUNTIME))
continue;
size = md->num_pages << EFI_PAGE_SHIFT;
end = md->phys_addr + size;
if (PFN_UP(end) <= max_low_pfn_mapped)
va = __va(md->phys_addr);
else
va = efi_ioremap(md->phys_addr, size);
md->virt_addr = (u64) (unsigned long) va;
if (!va) {
printk(KERN_ERR PFX "ioremap of 0x%llX failed!\n",
(unsigned long long)md->phys_addr);
continue;
}
if (!(md->attribute & EFI_MEMORY_WB)) {
addr = md->virt_addr;
npages = md->num_pages;
memrange_efi_to_native(&addr, &npages);
set_memory_uc(addr, npages);
}
systab = (u64) (unsigned long) efi_phys.systab;
if (md->phys_addr <= systab && systab < end) {
systab += md->virt_addr - md->phys_addr;
efi.systab = (efi_system_table_t *) (unsigned
long) systab;
}
}
next prev parent reply other threads:[~2009-03-01 5:43 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-28 16:26 Brian Maly
2009-03-01 4:14 ` Yinghai Lu
2009-03-01 5:42 ` Yinghai Lu [this message]
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=86802c440902282142p14f623b8td8a88600ff2a6bbe@mail.gmail.com \
--to=yinghai@kernel.org \
--cc=bmaly@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=ying.huang@intel.com \
/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
Powered by JetHome