aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-03-04 19:10:44 -0500
committerIngo Molnar <mingo@elte.hu>2009-03-05 08:53:10 -0500
commitdc16ecf7fd1fad7436832121435d4926a81d469e (patch)
treef33060fc5aec6105c624ad660711f87bc8c074c9 /arch
parenta964e33c5d7c0ea46376d20c2f02edf01c9db251 (diff)
x86-32: use specific __vmalloc_start_set flag in __virt_addr_valid
Rather than relying on the ever-unreliable system_state, add a specific __vmalloc_start_set flag to indicate whether the vmalloc area has meaningful boundaries yet, and use that in x86-32's __phys_addr and __virt_addr_valid. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/pgtable_32_types.h5
-rw-r--r--arch/x86/mm/init_32.c4
-rw-r--r--arch/x86/mm/ioremap.c7
3 files changed, 12 insertions, 4 deletions
diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h
index bd8df3b2fe04..2733fad45f98 100644
--- a/arch/x86/include/asm/pgtable_32_types.h
+++ b/arch/x86/include/asm/pgtable_32_types.h
@@ -25,6 +25,11 @@
25 * area for the same reason. ;) 25 * area for the same reason. ;)
26 */ 26 */
27#define VMALLOC_OFFSET (8 * 1024 * 1024) 27#define VMALLOC_OFFSET (8 * 1024 * 1024)
28
29#ifndef __ASSEMBLER__
30extern bool __vmalloc_start_set; /* set once high_memory is set */
31#endif
32
28#define VMALLOC_START ((unsigned long)high_memory + VMALLOC_OFFSET) 33#define VMALLOC_START ((unsigned long)high_memory + VMALLOC_OFFSET)
29#ifdef CONFIG_X86_PAE 34#ifdef CONFIG_X86_PAE
30#define LAST_PKMAP 512 35#define LAST_PKMAP 512
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 5e5126e0d544..d57dfffb0213 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -59,6 +59,8 @@ unsigned long highstart_pfn, highend_pfn;
59 59
60static noinline int do_test_wp_bit(void); 60static noinline int do_test_wp_bit(void);
61 61
62bool __read_mostly __vmalloc_start_set = false;
63
62static __init void *alloc_low_page(void) 64static __init void *alloc_low_page(void)
63{ 65{
64 unsigned long pfn = e820_table_end++; 66 unsigned long pfn = e820_table_end++;
@@ -757,6 +759,8 @@ void __init initmem_init(unsigned long start_pfn,
757#ifdef CONFIG_FLATMEM 759#ifdef CONFIG_FLATMEM
758 max_mapnr = num_physpages; 760 max_mapnr = num_physpages;
759#endif 761#endif
762 __vmalloc_start_set = true;
763
760 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", 764 printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
761 pages_to_mb(max_low_pfn)); 765 pages_to_mb(max_low_pfn));
762 766
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 433f7bd4648a..a23ca5b5bf24 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -76,10 +76,9 @@ static inline int phys_addr_valid(unsigned long addr)
76#ifdef CONFIG_DEBUG_VIRTUAL 76#ifdef CONFIG_DEBUG_VIRTUAL
77unsigned long __phys_addr(unsigned long x) 77unsigned long __phys_addr(unsigned long x)
78{ 78{
79 /* VMALLOC_* aren't constants; not available at the boot time */ 79 /* VMALLOC_* aren't constants */
80 VIRTUAL_BUG_ON(x < PAGE_OFFSET); 80 VIRTUAL_BUG_ON(x < PAGE_OFFSET);
81 VIRTUAL_BUG_ON(system_state != SYSTEM_BOOTING && 81 VIRTUAL_BUG_ON(__vmalloc_start_set && is_vmalloc_addr((void *) x));
82 is_vmalloc_addr((void *) x));
83 return x - PAGE_OFFSET; 82 return x - PAGE_OFFSET;
84} 83}
85EXPORT_SYMBOL(__phys_addr); 84EXPORT_SYMBOL(__phys_addr);
@@ -89,7 +88,7 @@ bool __virt_addr_valid(unsigned long x)
89{ 88{
90 if (x < PAGE_OFFSET) 89 if (x < PAGE_OFFSET)
91 return false; 90 return false;
92 if (system_state != SYSTEM_BOOTING && is_vmalloc_addr((void *) x)) 91 if (__vmalloc_start_set && is_vmalloc_addr((void *) x))
93 return false; 92 return false;
94 return pfn_valid((x - PAGE_OFFSET) >> PAGE_SHIFT); 93 return pfn_valid((x - PAGE_OFFSET) >> PAGE_SHIFT);
95} 94}