x86: pre-initialize boot_cpu_data.x86_phys_bits to avoid system_state tests
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Thu, 5 Mar 2009 00:16:51 +0000 (16:16 -0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 5 Mar 2009 13:53:43 +0000 (14:53 +0100)
Impact: cleanup, micro-optimization

Pre-initialize boot_cpu_data.x86_phys_bits to a reasonable default
to remove the use of system_state tests in __virt_addr_valid()
and __phys_addr().

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/setup.c
arch/x86/mm/ioremap.c

index b746deb9ebc649685c4c167f50e525541b8da292..f28c56e6bf94a4cc30617f6b39d0349f13f9ebff 100644 (file)
@@ -202,7 +202,9 @@ struct ist_info ist_info;
 #endif
 
 #else
-struct cpuinfo_x86 boot_cpu_data __read_mostly;
+struct cpuinfo_x86 boot_cpu_data __read_mostly = {
+       .x86_phys_bits = MAX_PHYSMEM_BITS,
+};
 EXPORT_SYMBOL(boot_cpu_data);
 #endif
 
index a23ca5b5bf240cd51d7f12882b063e419c7ec054..62773abdf088f589503a539ed8423b81bc16dfa8 100644 (file)
@@ -38,8 +38,7 @@ unsigned long __phys_addr(unsigned long x)
        } else {
                VIRTUAL_BUG_ON(x < PAGE_OFFSET);
                x -= PAGE_OFFSET;
-               VIRTUAL_BUG_ON(system_state == SYSTEM_BOOTING ? x > MAXMEM :
-                                       !phys_addr_valid(x));
+               VIRTUAL_BUG_ON(!phys_addr_valid(x));
        }
        return x;
 }
@@ -56,10 +55,8 @@ bool __virt_addr_valid(unsigned long x)
                if (x < PAGE_OFFSET)
                        return false;
                x -= PAGE_OFFSET;
-               if (system_state == SYSTEM_BOOTING ?
-                               x > MAXMEM : !phys_addr_valid(x)) {
+               if (!phys_addr_valid(x))
                        return false;
-               }
        }
 
        return pfn_valid(x >> PAGE_SHIFT);