]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SPARC64]: Call real_setup_per_cpu_areas() earlier and use lmb_alloc().
authorDavid S. Miller <davem@davemloft.net>
Thu, 14 Feb 2008 03:20:45 +0000 (19:20 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Apr 2008 06:32:11 +0000 (23:32 -0700)
We have to do it like this before we can move the PROM and MDESC device
tree code over to using lmb_alloc().

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/smp.c
arch/sparc64/mm/init.c

index 59f020d69d4c246c82c2a434eeb15b0d310a8c08..524b88920947d268233825aefec54b549d0ba21f 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/cache.h>
 #include <linux/jiffies.h>
 #include <linux/profile.h>
-#include <linux/bootmem.h>
+#include <linux/lmb.h>
 
 #include <asm/head.h>
 #include <asm/ptrace.h>
@@ -1431,7 +1431,7 @@ EXPORT_SYMBOL(__per_cpu_shift);
 
 void __init real_setup_per_cpu_areas(void)
 {
-       unsigned long goal, size, i;
+       unsigned long paddr, goal, size, i;
        char *ptr;
 
        /* Copy section for each CPU (we discard the original) */
@@ -1441,8 +1441,13 @@ void __init real_setup_per_cpu_areas(void)
        for (size = PAGE_SIZE; size < goal; size <<= 1UL)
                __per_cpu_shift++;
 
-       ptr = alloc_bootmem_pages(size * NR_CPUS);
+       paddr = lmb_alloc(size * NR_CPUS, PAGE_SIZE);
+       if (!paddr) {
+               prom_printf("Cannot allocate per-cpu memory.\n");
+               prom_halt();
+       }
 
+       ptr = __va(paddr);
        __per_cpu_base = ptr - __per_cpu_start;
 
        for (i = 0; i < NR_CPUS; i++, ptr += size)
index 90e644a0e933e40e507fc469a81a21d4ff9b5094..658ec462ed45896fc36cdcc4ca85425497d749bc 100644 (file)
@@ -1208,6 +1208,12 @@ void __init paging_init(void)
        if (tlb_type == hypervisor)
                sun4v_ktsb_register();
 
+       /* We must setup the per-cpu areas before we pull in the
+        * PROM and the MDESC.  The code there fills in cpu and
+        * other information into per-cpu data structures.
+        */
+       real_setup_per_cpu_areas();
+
        /* Setup bootmem... */
        pages_avail = 0;
        last_valid_pfn = end_pfn = bootmem_init(&pages_avail, phys_base);
@@ -1216,8 +1222,6 @@ void __init paging_init(void)
 
        kernel_physical_mapping_init();
 
-       real_setup_per_cpu_areas();
-
        prom_build_devicetree();
 
        if (tlb_type == hypervisor)