powerpc: Apply early paca fixups to boot_paca and the boot cpu's paca
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / powerpc / kernel / setup_64.c
index efb6a41..75fbace 100644 (file)
@@ -156,6 +156,15 @@ early_param("smt-enabled", early_smt_enabled);
 #define check_smt_enabled()
 #endif /* CONFIG_SMP */
 
+/** Fix up paca fields required for the boot cpu */
+static void fixup_boot_paca(void)
+{
+       /* The boot cpu is started */
+       get_paca()->cpu_start = 1;
+       /* Allow percpu accesses to work until we setup percpu data */
+       get_paca()->data_offset = 0;
+}
+
 /*
  * Early initialization entry point. This is called by head.S
  * with MMU translation disabled. We rely on the "feature" of
@@ -177,6 +186,8 @@ early_param("smt-enabled", early_smt_enabled);
 
 void __init early_setup(unsigned long dt_ptr)
 {
+       static __initdata struct paca_struct boot_paca;
+
        /* -------- printk is _NOT_ safe to use here ! ------- */
 
        /* Identify CPU type */
@@ -185,6 +196,7 @@ void __init early_setup(unsigned long dt_ptr)
        /* Assume we're on cpu 0 for now. Don't write to the paca yet! */
        initialise_paca(&boot_paca, 0);
        setup_paca(&boot_paca);
+       fixup_boot_paca();
 
        /* Initialize lockdep early or else spinlocks will blow */
        lockdep_init();
@@ -205,11 +217,7 @@ void __init early_setup(unsigned long dt_ptr)
 
        /* Now we know the logical id of our boot cpu, setup the paca. */
        setup_paca(&paca[boot_cpuid]);
-
-       /* Fix up paca fields required for the boot cpu */
-       get_paca()->cpu_start = 1;
-       /* Allow percpu accesses to "work" until we setup percpu data */
-       get_paca()->data_offset = 0;
+       fixup_boot_paca();
 
        /* Probe the machine type */
        probe_machine();
@@ -601,6 +609,11 @@ void __init setup_arch(char **cmdline_p)
 
        kvm_linear_init();
 
+       /* Interrupt code needs to be 64K-aligned */
+       if ((unsigned long)_stext & 0xffff)
+               panic("Kernelbase not 64K-aligned (0x%lx)!\n",
+                     (unsigned long)_stext);
+
        ppc64_boot_msg(0x15, "Setup Done");
 }