public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: ioremap_nocache fix
@ 2008-01-25  5:22 Huang, Ying
  2008-01-25 10:27 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Huang, Ying @ 2008-01-25  5:22 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, Andi Kleen; +Cc: linux-kernel

This patch fixes a bug of ioremap_nocache. ioremap_nocache() will call
__ioremap() with flags != 0 to do the real work, which will call
change_page_attr_addr() if phys_addr + size - 1 < (end_pfn_map << PAGE_SHIFT).
But some pages between 0 ~ end_pfn_map << PAGE_SHIFT are not mapped by 
identity map, this will make change_page_attr_addr failed.

This patch is based on latest x86 git and has been tested on x86_64 platform.

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

---
 arch/x86/mm/ioremap_64.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/arch/x86/mm/ioremap_64.c
+++ b/arch/x86/mm/ioremap_64.c
@@ -41,8 +41,15 @@ ioremap_change_attr(unsigned long phys_a
 	if (phys_addr + size - 1 < (end_pfn_map << PAGE_SHIFT)) {
 		unsigned long npages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
 		unsigned long vaddr = (unsigned long) __va(phys_addr);
+		int level;
 
 		/*
+		 * If there is no identity map for this address,
+		 * change_page_attr_addr is unnecessary
+		 */
+		if (!lookup_address(vaddr, &level))
+			return err;
+		/*
  		 * Must use a address here and not struct page because the phys addr
 		 * can be a in hole between nodes and not have an memmap entry.
 		 */


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-25 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-25  5:22 [PATCH] x86: ioremap_nocache fix Huang, Ying
2008-01-25 10:27 ` Ingo Molnar
2008-01-25 13:50   ` huang ying

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox