LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <andi@firstfloor.org>,
	torvalds@osdl.org, tglx@linutronix.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix left over EFI cache mapping problems
Date: Fri, 15 Feb 2008 12:48:06 +0800	[thread overview]
Message-ID: <1203050886.30010.19.camel@caritas-dev.intel.com> (raw)
In-Reply-To: <20080214161218.GA28152@elte.hu>

On Thu, 2008-02-14 at 17:12 +0100, Ingo Molnar wrote: 
> this is indeed a bug (we change the attributes for a larger area than 
> needed), but your fix is unclean. Find below a cleaner solution.
> 
> Ying, if you agree with this fix could you please test and ACK it before 
> we push it to Linus? (this fix is also in the latest x86.git#mm)

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) {


  parent reply	other threads:[~2008-02-15  4:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-14 13:13 [PATCH] Fix left over EFI cache mapping problems Andi Kleen
2008-02-14 16:12 ` Ingo Molnar
2008-02-14 17:16   ` Andi Kleen
2008-02-14 18:38     ` Ingo Molnar
2008-02-14 21:42       ` Andi Kleen
2008-02-14 22:08         ` Arjan van de Ven
2008-02-14 23:01           ` Andi Kleen
2008-02-15  2:52       ` Huang, Ying
2008-02-15  8:55         ` Andi Kleen
2008-02-15  9:16           ` Huang, Ying
2008-02-15  4:48   ` Huang, Ying [this message]
2008-02-15  5:44     ` Linus Torvalds
2008-02-15  6:24       ` Huang, Ying
2008-02-15  7:30       ` Ingo Molnar
2008-02-15  7:08     ` Ingo Molnar
2008-02-15  7:32       ` Huang, Ying
2008-02-18  1:53       ` Huang, Ying
2008-02-18 11:26         ` Andi Kleen
2008-02-18 14:05           ` Ingo Molnar
2008-02-15  8:48     ` Andi Kleen
2008-02-15  9:21       ` Huang, Ying
2008-02-15  9:43         ` 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=1203050886.30010.19.camel@caritas-dev.intel.com \
    --to=ying.huang@intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@osdl.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;
as well as URLs for NNTP newsgroup(s).