lkml.org 
[lkml]   [2010]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/4] x86: ioremap: fix physical address check
If the physical address is too high to be handled by ioremap() in
x86_32 PAE (e.g. more than 36-bit physical address), ioremap() must
return error (NULL). However, current x86 ioremap try to map this too
high physical address, and it causes unexpected behavior.

The ioremap() seems to check the specified physical address using
phys_addr_valid(). But current phys_addr_valid() returns true even if
more than 36-bit address range is specified because
boot_cpu_data.x86_phys_bits can have more than 36 even in X86_32 PAE
mode (boot_cpu_data.x86_phys_bits seems to hold maximum capability of
the processor).

To fix the problem, this patch changes phys_addr_valid() function to
return false when more than 36-bit address range is specified in PAE.
The phys_addr_valid() function is used only by ioremap() in X86_32 PAE
mode. So this change only affects ioremap() in X86_32 PAE mode.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

---
arch/x86/mm/physaddr.h | 4 ++++
1 file changed, 4 insertions(+)

Index: linux-2.6.34/arch/x86/mm/physaddr.h
===================================================================
--- linux-2.6.34.orig/arch/x86/mm/physaddr.h 2010-06-10 07:28:28.177229689 +0900
+++ linux-2.6.34/arch/x86/mm/physaddr.h 2010-06-10 07:28:32.587190857 +0900
@@ -3,8 +3,12 @@
static inline int phys_addr_valid(resource_size_t addr)
{
#ifdef CONFIG_PHYS_ADDR_T_64BIT
+#ifdef CONFIG_X86_64
return !(addr >> boot_cpu_data.x86_phys_bits);
#else
+ return !(addr >> 36);
+#endif
+#else
return 1;
#endif
}



\
 
 \ /
  Last update: 2010-06-11 11:23    [W:0.132 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site