]> Pileus Git - ~andy/linux/commitdiff
powerpc/85xx: Move ePAPR paravirt initialization earlier
authorLaurentiu TUDOR <Laurentiu.Tudor@freescale.com>
Wed, 3 Jul 2013 14:13:15 +0000 (17:13 +0300)
committerScott Wood <scottwood@freescale.com>
Wed, 7 Aug 2013 23:38:06 +0000 (18:38 -0500)
At console init, when the kernel tries to flush the log buffer
the ePAPR byte-channel based console write fails silently,
losing the buffered messages.
This happens because The ePAPR para-virtualization init isn't
done early enough so that the hcall instruction to be set,
causing the byte-channel write hcall to be a nop.
To fix, change the ePAPR para-virt init to use early device
tree functions and move it in early init.

Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
arch/powerpc/include/asm/epapr_hcalls.h
arch/powerpc/kernel/epapr_paravirt.c
arch/powerpc/kernel/setup_32.c
arch/powerpc/kernel/setup_64.c

index d3d634274d2c4de6fe63610f872d3eca1eb7738e..86b0ac79990ca4ebda1ade6d67524d588bb148e9 100644 (file)
 extern bool epapr_paravirt_enabled;
 extern u32 epapr_hypercall_start[];
 
+#ifdef CONFIG_EPAPR_PARAVIRT
+int __init epapr_paravirt_early_init(void);
+#else
+static inline int epapr_paravirt_early_init(void) { return 0; }
+#endif
+
 /*
  * We use "uintptr_t" to define a register because it's guaranteed to be a
  * 32-bit integer on a 32-bit platform, and a 64-bit integer on a 64-bit
index d44a571e45a79dae9b7976c7e281c93021b2847e..6300c13bbde46da37cf9637f95711e1a544c94ba 100644 (file)
@@ -30,22 +30,20 @@ extern u32 epapr_ev_idle_start[];
 
 bool epapr_paravirt_enabled;
 
-static int __init epapr_paravirt_init(void)
+static int __init early_init_dt_scan_epapr(unsigned long node,
+                                          const char *uname,
+                                          int depth, void *data)
 {
-       struct device_node *hyper_node;
        const u32 *insts;
-       int len, i;
+       unsigned long len;
+       int i;
 
-       hyper_node = of_find_node_by_path("/hypervisor");
-       if (!hyper_node)
-               return -ENODEV;
-
-       insts = of_get_property(hyper_node, "hcall-instructions", &len);
+       insts = of_get_flat_dt_prop(node, "hcall-instructions", &len);
        if (!insts)
-               return -ENODEV;
+               return 0;
 
        if (len % 4 || len > (4 * 4))
-               return -ENODEV;
+               return -1;
 
        for (i = 0; i < (len / 4); i++) {
                patch_instruction(epapr_hypercall_start + i, insts[i]);
@@ -55,13 +53,19 @@ static int __init epapr_paravirt_init(void)
        }
 
 #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64)
-       if (of_get_property(hyper_node, "has-idle", NULL))
+       if (of_get_flat_dt_prop(node, "has-idle", NULL))
                ppc_md.power_save = epapr_ev_idle;
 #endif
 
        epapr_paravirt_enabled = true;
 
+       return 1;
+}
+
+int __init epapr_paravirt_early_init(void)
+{
+       of_scan_flat_dt(early_init_dt_scan_epapr, NULL);
+
        return 0;
 }
 
-early_initcall(epapr_paravirt_init);
index a8f54ecb091f866a7c93cb76d36d1a3702bf2184..a4bbcae72578617688f510d05aaed2883aef7c10 100644 (file)
@@ -38,6 +38,7 @@
 #include <asm/serial.h>
 #include <asm/udbg.h>
 #include <asm/mmu_context.h>
+#include <asm/epapr_hcalls.h>
 
 #include "setup.h"
 
@@ -128,6 +129,8 @@ notrace void __init machine_init(u64 dt_ptr)
        /* Do some early initialization based on the flat device tree */
        early_init_devtree(__va(dt_ptr));
 
+       epapr_paravirt_early_init();
+
        early_init_mmu();
 
        probe_machine();
@@ -326,5 +329,4 @@ void __init setup_arch(char **cmdline_p)
 
        /* Initialize the MMU context management stuff */
        mmu_context_init();
-
 }
index 389fb8077cc9cea25746b12497673dd573d35c56..f03770e0fc8de560e666d8f691ee5cbb86c07bd6 100644 (file)
@@ -66,6 +66,7 @@
 #include <asm/code-patching.h>
 #include <asm/kvm_ppc.h>
 #include <asm/hugetlb.h>
+#include <asm/epapr_hcalls.h>
 
 #include "setup.h"
 
@@ -215,6 +216,8 @@ void __init early_setup(unsigned long dt_ptr)
         */
        early_init_devtree(__va(dt_ptr));
 
+       epapr_paravirt_early_init();
+
        /* Now we know the logical id of our boot cpu, setup the paca. */
        setup_paca(&paca[boot_cpuid]);
        fixup_boot_paca();