[PATCH] powerpc/85xx: Move ePAPR paravirt initialization earlier

Laurentiu Tudor Laurentiu.Tudor at freescale.com
Wed Mar 6 02:52:36 EST 2013


From: Tudor Laurentiu <laurentiu.tudor at freescale.com>

The ePAPR para-virtualization needs to happen very early
otherwise the bytechannel based console will silently
drop some of the early boot messages.

Before this patch, this is how the kernel log started:
-----------------------------------------------------
 > Brought up 2 CPUs
 > devtmpfs: initialized
 > NET: Registered protocol family 16
 [...]
-----------------------------------------------------

After the patch the early messages show up:
-----------------------------------------------------
 > Using P5020 DS machine description
 > MMU: Supported page sizes
 >          4 KB as direct
 >       4096 KB as direct
 [...]
-----------------------------------------------------

At console init, the kernel tried to flush the log buffer.
Since the paravirt was not yet initialized the console write
function failed silently, thus losing the buffered messages.

Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor at freescale.com>
---
 arch/powerpc/include/asm/epapr_hcalls.h |    6 ++++++
 arch/powerpc/kernel/epapr_paravirt.c    |    3 +--
 arch/powerpc/kernel/setup_32.c          |    2 ++
 arch/powerpc/kernel/setup_64.c          |    3 +++
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index d3d6342..544176e 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -105,6 +105,12 @@
 extern bool epapr_paravirt_enabled;
 extern u32 epapr_hypercall_start[];
 
+#ifdef CONFIG_EPAPR_PARAVIRT
+int __init epapr_paravirt_init(void);
+#else
+static inline int epapr_paravirt_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
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index f3eab85..9848713 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -28,7 +28,7 @@ extern u32 epapr_ev_idle_start[];
 
 bool epapr_paravirt_enabled;
 
-static int __init epapr_paravirt_init(void)
+int __init epapr_paravirt_init(void)
 {
 	struct device_node *hyper_node;
 	const u32 *insts;
@@ -58,4 +58,3 @@ static int __init epapr_paravirt_init(void)
 	return 0;
 }
 
-early_initcall(epapr_paravirt_init);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index a8f54ec..1464655 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -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"
 
@@ -327,4 +328,5 @@ void __init setup_arch(char **cmdline_p)
 	/* Initialize the MMU context management stuff */
 	mmu_context_init();
 
+	epapr_paravirt_init();
 }
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 6da881b..ce092ac 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -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"
 
@@ -599,6 +600,8 @@ void __init setup_arch(char **cmdline_p)
 	/* Initialize the MMU context management stuff */
 	mmu_context_init();
 
+	epapr_paravirt_init();
+
 	kvm_linear_init();
 
 	/* Interrupt code needs to be 64K-aligned */
-- 
1.7.6.5




More information about the Linuxppc-dev mailing list