Re: [PATCH] Fix left over EFI cache mapping problems

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ingo Molnar <mingo@...>
Cc: Andi Kleen <andi@...>, <torvalds@...>, <tglx@...>, <linux-kernel@...>
Date: Friday, February 15, 2008 - 12:48 am

On Thu, 2008-02-14 at 17:12 +0100, Ingo Molnar wrote: 

I think the patch following may be better, because it is possible that
the EFI_PAGE_SHIFT and PAGE_SHIFT are different.

Best Regards,
Huang Ying

-------------------------> 
The EFI-runtime mapping code changed a larger memory area than it
should have, due to a pages/bytes parameter mixup.

noticed by Andi Kleen.

This patch has been tested on Intel x86 platform with EFI 32/64.

Signed-off-by: Huang Ying <ying.huang@intel.com>

---
 arch/x86/kernel/efi.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -386,12 +386,13 @@ static void __init runtime_code_page_mke
 
 	/* Make EFI runtime service code area executable */
 	for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
-		md = p;
+		unsigned long num_pages;
 
+		md = p;
 		if (md->type != EFI_RUNTIME_SERVICES_CODE)
 			continue;
-
-		set_memory_x(md->virt_addr, md->num_pages << EFI_PAGE_SHIFT);
+		num_pages = (md->num_pages << EFI_PAGE_SHIFT) >> PAGE_SHIFT;
+		set_memory_x(md->virt_addr, num_pages);
 	}
 }
 
@@ -434,7 +435,7 @@ void __init efi_enter_virtual_mode(void)
 		}
 
 		if (!(md->attribute & EFI_MEMORY_WB))
-			set_memory_uc(md->virt_addr, size);
+			set_memory_uc(md->virt_addr, size >> PAGE_SHIFT);
 
 		systab = (u64) (unsigned long) efi_phys.systab;
 		if (md->phys_addr <= systab && systab < end) {

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix left over EFI cache mapping problems, Andi Kleen, (Thu Feb 14, 9:13 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Ingo Molnar, (Thu Feb 14, 12:12 pm)
Re: [PATCH] Fix left over EFI cache mapping problems, Huang, Ying, (Fri Feb 15, 12:48 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Andi Kleen, (Fri Feb 15, 4:48 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Huang, Ying, (Fri Feb 15, 5:21 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Andi Kleen, (Fri Feb 15, 5:43 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Ingo Molnar, (Fri Feb 15, 3:08 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Huang, Ying, (Sun Feb 17, 9:53 pm)
Re: [PATCH] Fix left over EFI cache mapping problems, Andi Kleen, (Mon Feb 18, 7:26 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Ingo Molnar, (Mon Feb 18, 10:05 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Huang, Ying, (Fri Feb 15, 3:32 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Linus Torvalds, (Fri Feb 15, 1:44 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Ingo Molnar, (Fri Feb 15, 3:30 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Huang, Ying, (Fri Feb 15, 2:24 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Andi Kleen, (Thu Feb 14, 1:16 pm)
Re: [PATCH] Fix left over EFI cache mapping problems, Ingo Molnar, (Thu Feb 14, 2:38 pm)
Re: [PATCH] Fix left over EFI cache mapping problems, Huang, Ying, (Thu Feb 14, 10:52 pm)
Re: [PATCH] Fix left over EFI cache mapping problems, Andi Kleen, (Fri Feb 15, 4:55 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Huang, Ying, (Fri Feb 15, 5:16 am)
Re: [PATCH] Fix left over EFI cache mapping problems, Andi Kleen, (Thu Feb 14, 5:42 pm)
Re: [PATCH] Fix left over EFI cache mapping problems, Arjan van de Ven, (Thu Feb 14, 6:08 pm)
Re: [PATCH] Fix left over EFI cache mapping problems, Andi Kleen, (Thu Feb 14, 7:01 pm)