aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/setup_32.c3
-rw-r--r--arch/powerpc/lib/copy_32.S6
2 files changed, 9 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index b316ab787a3b..ad8c9db61237 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -110,6 +110,8 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
110 * This is called very early on the boot process, after a minimal 110 * This is called very early on the boot process, after a minimal
111 * MMU environment has been set up but before MMU_init is called. 111 * MMU environment has been set up but before MMU_init is called.
112 */ 112 */
113extern unsigned int memset_nocache_branch; /* Insn to be replaced by NOP */
114
113notrace void __init machine_init(u64 dt_ptr) 115notrace void __init machine_init(u64 dt_ptr)
114{ 116{
115 lockdep_init(); 117 lockdep_init();
@@ -118,6 +120,7 @@ notrace void __init machine_init(u64 dt_ptr)
118 udbg_early_init(); 120 udbg_early_init();
119 121
120 patch_instruction((unsigned int *)&memcpy, PPC_INST_NOP); 122 patch_instruction((unsigned int *)&memcpy, PPC_INST_NOP);
123 patch_instruction(&memset_nocache_branch, PPC_INST_NOP);
121 124
122 /* Do some early initialization based on the flat device tree */ 125 /* Do some early initialization based on the flat device tree */
123 early_init_devtree(__va(dt_ptr)); 126 early_init_devtree(__va(dt_ptr));
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index da5847d09718..c44df2dbedd5 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -73,6 +73,10 @@ CACHELINE_MASK = (L1_CACHE_BYTES-1)
73 * Use dcbz on the complete cache lines in the destination 73 * Use dcbz on the complete cache lines in the destination
74 * to set them to zero. This requires that the destination 74 * to set them to zero. This requires that the destination
75 * area is cacheable. -- paulus 75 * area is cacheable. -- paulus
76 *
77 * During early init, cache might not be active yet, so dcbz cannot be used.
78 * We therefore skip the optimised bloc that uses dcbz. This jump is
79 * replaced by a nop once cache is active. This is done in machine_init()
76 */ 80 */
77_GLOBAL(memset) 81_GLOBAL(memset)
78 rlwimi r4,r4,8,16,23 82 rlwimi r4,r4,8,16,23
@@ -88,6 +92,8 @@ _GLOBAL(memset)
88 subf r6,r0,r6 92 subf r6,r0,r6
89 cmplwi 0,r4,0 93 cmplwi 0,r4,0
90 bne 2f /* Use normal procedure if r4 is not zero */ 94 bne 2f /* Use normal procedure if r4 is not zero */
95_GLOBAL(memset_nocache_branch)
96 b 2f /* Skip optimised bloc until cache is enabled */
91 97
92 clrlwi r7,r6,32-LG_CACHELINE_BYTES 98 clrlwi r7,r6,32-LG_CACHELINE_BYTES
93 add r8,r7,r5 99 add r8,r7,r5