diff options
author | LEROY Christophe <christophe.leroy@c-s.fr> | 2015-09-16 10:04:51 (GMT) |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-09-17 00:36:44 (GMT) |
commit | 1cd03890ea64795e53f17a94928cca22495acb2a (patch) | |
tree | df88727d6a5c3acbefe2035ec5fb78882c5bd2bb /arch/powerpc/lib/copy_32.S | |
parent | 36b35d5d807b7e57aff7d08e63de8b17731ee211 (diff) | |
download | linux-1cd03890ea64795e53f17a94928cca22495acb2a.tar.xz |
powerpc32: memcpy: only use dcbz once cache is enabled
memcpy() uses instruction dcbz to speed up copy by not wasting time
loading cache line with data that will be overwritten.
Some platform like mpc52xx do no have cache active at startup and
can therefore not use memcpy(). Allthough no part of the code
explicitly uses memcpy(), GCC makes calls to it.
This patch modifies memcpy() such that at startup, memcpy()
unconditionally jumps to generic_memcpy() which doesn't use
the dcbz instruction.
Once the initial MMU is set up, in machine_init() we patch memcpy()
by replacing this inconditional jump by a NOP
Reported-by: Michal Sojka <sojkam1@fel.cvut.cz>
Tested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/lib/copy_32.S')
-rw-r--r-- | arch/powerpc/lib/copy_32.S | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S index 2ef50c6..da5847d 100644 --- a/arch/powerpc/lib/copy_32.S +++ b/arch/powerpc/lib/copy_32.S @@ -128,6 +128,10 @@ _GLOBAL(memset) * the destination area is cacheable. * We only use this version if the source and dest don't overlap. * -- paulus. + * + * During early init, cache might not be active yet, so dcbz cannot be used. + * We therefore jump to generic_memcpy which doesn't use dcbz. This jump is + * replaced by a nop once cache is active. This is done in machine_init() */ _GLOBAL(memmove) cmplw 0,r3,r4 @@ -135,6 +139,7 @@ _GLOBAL(memmove) /* fall through */ _GLOBAL(memcpy) + b generic_memcpy add r7,r3,r5 /* test if the src & dst overlap */ add r8,r4,r5 cmplw 0,r4,r7 |