LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: ying.huang@intel.com, tglx@linutronix.de, mingo@elte.hu,
linux-kernel@vger.kernel.org
Subject: [PATCH] [8/8] RFC: Fix some EFI problems
Date: Mon, 11 Feb 2008 10:34:36 +0100 (CET) [thread overview]
Message-ID: <20080211093436.EAFB11B41CE@basil.firstfloor.org> (raw)
In-Reply-To: <200802111034.764275766@suse.de>
>From code review the EFI memory map handling has a couple of problems:
- The test for _WB memory was reversed so it would set cache able memory
to uncached
- It would always set a wrong uninitialized zero address to uncached
(so I suspect it always set the first few pages in phys memory to uncached,
that is why it may have gone unnoticed)
- It would call set_memory_x() on a fixmap address that it doesn't
handle correct.
- Some other problems I commented in the code (but was unable to solve
for now)
I changed the ioremaps to set the correct caching attributes
and also corrected the ordering so it looks roughly correct now.
This is an RFC, because I don't have a EFI system to test.
Cc: ying.huang@intel.com
Signed-off-by: Andi Kleen <ak@suse.de>
---
arch/x86/kernel/efi.c | 14 ++++++++------
arch/x86/kernel/efi_64.c | 6 ++++--
include/asm-x86/efi.h | 5 +++--
3 files changed, 15 insertions(+), 10 deletions(-)
Index: linux/arch/x86/kernel/efi.c
===================================================================
--- linux.orig/arch/x86/kernel/efi.c
+++ linux/arch/x86/kernel/efi.c
@@ -423,13 +423,15 @@ void __init efi_enter_virtual_mode(void)
size = md->num_pages << EFI_PAGE_SHIFT;
end = md->phys_addr + size;
- if ((end >> PAGE_SHIFT) <= max_pfn_mapped)
+ /* RED-PEN does not handle overlapped areas */
+ if ((end >> PAGE_SHIFT) <= max_pfn_mapped) {
va = __va(md->phys_addr);
- else
- va = efi_ioremap(md->phys_addr, size);
-
- if (md->attribute & EFI_MEMORY_WB)
- set_memory_uc(md->virt_addr, size);
+ /* RED-PEN spec and ia64 have a lot more flags */
+ if (!(md->attribute & EFI_MEMORY_WB))
+ set_memory_uc(md->virt_addr, size);
+ } else
+ va = efi_ioremap(md->phys_addr, size,
+ !!(md->attribute & EFI_MEMORY_WB));
md->virt_addr = (u64) (unsigned long) va;
Index: linux/arch/x86/kernel/efi_64.c
===================================================================
--- linux.orig/arch/x86/kernel/efi_64.c
+++ linux/arch/x86/kernel/efi_64.c
@@ -109,7 +109,8 @@ void __init efi_reserve_bootmem(void)
memmap.nr_map * memmap.desc_size);
}
-void __iomem * __init efi_ioremap(unsigned long phys_addr, unsigned long size)
+void __iomem * __init efi_ioremap(unsigned long phys_addr, unsigned long size,
+ int cache)
{
static unsigned pages_mapped;
unsigned i, pages;
@@ -124,7 +125,8 @@ void __iomem * __init efi_ioremap(unsign
for (i = 0; i < pages; i++) {
__set_fixmap(FIX_EFI_IO_MAP_FIRST_PAGE - pages_mapped,
- phys_addr, PAGE_KERNEL);
+ phys_addr,
+ cache ? PAGE_KERNEL : PAGE_KERNEL_NOCACHE);
phys_addr += PAGE_SIZE;
pages_mapped++;
}
Index: linux/include/asm-x86/efi.h
===================================================================
--- linux.orig/include/asm-x86/efi.h
+++ linux/include/asm-x86/efi.h
@@ -33,7 +33,8 @@ extern unsigned long asmlinkage efi_call
#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
efi_call_virt(f, a1, a2, a3, a4, a5, a6)
-#define efi_ioremap(addr, size) ioremap_cache(addr, size)
+#define efi_ioremap(addr, size, cache) \
+ (cache ? ioremap_cache(addr, size) : ioremap_nocache(addr, size))
#else /* !CONFIG_X86_32 */
@@ -86,7 +87,7 @@ extern u64 efi_call6(void *fp, u64 arg1,
efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
(u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
-extern void *efi_ioremap(unsigned long addr, unsigned long size);
+extern void *efi_ioremap(unsigned long addr, unsigned long size, int cache);
#endif /* CONFIG_X86_32 */
next prev parent reply other threads:[~2008-02-11 9:37 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-11 9:34 [PATCH] [0/8] Various kernel mapping bug fixes Andi Kleen
2008-02-11 9:34 ` [PATCH] [1/8] CPA: Fix gbpages support in try_preserve_lage_page Andi Kleen
2008-02-11 9:45 ` Thomas Gleixner
2008-02-11 10:12 ` Ingo Molnar
2008-02-11 11:01 ` Andi Kleen
2008-02-11 9:34 ` [PATCH] [2/8] CPA: Flush the caches when setting pages not present Andi Kleen
2008-02-11 11:00 ` Ingo Molnar
2008-02-11 12:26 ` Andi Kleen
2008-02-11 9:34 ` [PATCH] [3/8] CPA: Test the correct mapping alias on x86-64 Andi Kleen
2008-02-11 11:49 ` Ingo Molnar
2008-02-11 9:34 ` [PATCH] [4/8] CPA: Fix set_memory_x for ioremap Andi Kleen
2008-02-11 12:27 ` Ingo Molnar
2008-02-11 12:45 ` Andi Kleen
2008-02-11 9:34 ` [PATCH] [5/8] Fix logic error in 64bit memory hotadd Andi Kleen
2008-02-11 12:46 ` Ingo Molnar
2008-02-11 13:05 ` Andi Kleen
2008-02-11 13:33 ` Ingo Molnar
2008-02-11 13:44 ` Andi Kleen
2008-02-12 10:35 ` Yasunori Goto
2008-02-12 11:20 ` Andi Kleen
2008-02-11 9:34 ` [PATCH] [6/8] Account overlapped mappings in end_pfn_map Andi Kleen
2008-02-11 13:08 ` Ingo Molnar
2008-02-11 13:27 ` Andi Kleen
2008-02-11 13:55 ` Ingo Molnar
2008-02-11 14:16 ` Peter Zijlstra
2008-02-11 14:24 ` Andi Kleen
2008-02-11 14:41 ` Sam Ravnborg
2008-02-11 15:12 ` Arjan van de Ven
2008-02-11 9:34 ` [PATCH] [7/8] Implement true end_pfn_mapped for 32bit Andi Kleen
2008-02-12 19:39 ` Thomas Gleixner
2008-02-12 19:49 ` Andi Kleen
2008-02-12 20:25 ` Thomas Gleixner
2008-02-11 9:34 ` Andi Kleen [this message]
2008-02-12 20:04 ` [PATCH] [8/8] RFC: Fix some EFI problems Thomas Gleixner
2008-02-12 20:23 ` Andi Kleen
2008-02-12 20:48 ` Thomas Gleixner
2008-02-13 11:05 ` 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=20080211093436.EAFB11B41CE@basil.firstfloor.org \
--to=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=ying.huang@intel.com \
--subject='Re: [PATCH] [8/8] RFC: Fix some EFI problems' \
/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
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).