Commit 1f675813 authored by Oliver O'Halloran's avatar Oliver O'Halloran Committed by Greg Kroah-Hartman

powerpc/64: Fix flush_(d|i)cache_range() called from modules

commit 8f5f525d upstream.

When the kernel is compiled to use 64bit ABIv2 the _GLOBAL() macro does
not include a global entry point. A function's global entry point is
used when the function is called from a different TOC context and in the
kernel this typically means a call from a module into the vmlinux (or
vice-versa).

There are a few exported asm functions declared with _GLOBAL() and
calling them from a module will likely crash the kernel since any TOC
relative load will yield garbage.

flush_icache_range() and flush_dcache_range() are both exported to
modules, and use the TOC, so must use _GLOBAL_TOC().

Fixes: 721aeaa9 ("powerpc: Build little endian ppc64 kernel with ABIv2")
Signed-off-by: default avatarOliver O'Halloran <oohall@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 98c977e6
...@@ -224,6 +224,16 @@ name: \ ...@@ -224,6 +224,16 @@ name: \
.globl name; \ .globl name; \
name: name:
#define _KPROBE_TOC(name) \
.section ".kprobes.text","a"; \
.align 2 ; \
.type name,@function; \
.globl name; \
name: \
0: addis r2,r12,(.TOC.-0b)@ha; \
addi r2,r2,(.TOC.-0b)@l; \
.localentry name,.-name
#define DOTSYM(a) a #define DOTSYM(a) a
#else #else
...@@ -261,6 +271,8 @@ name: \ ...@@ -261,6 +271,8 @@ name: \
.type GLUE(.,name),@function; \ .type GLUE(.,name),@function; \
GLUE(.,name): GLUE(.,name):
#define _KPROBE_TOC(n) _KPROBE(n)
#define DOTSYM(a) GLUE(.,a) #define DOTSYM(a) GLUE(.,a)
#endif #endif
......
...@@ -66,7 +66,7 @@ PPC64_CACHES: ...@@ -66,7 +66,7 @@ PPC64_CACHES:
* flush all bytes from start through stop-1 inclusive * flush all bytes from start through stop-1 inclusive
*/ */
_KPROBE(flush_icache_range) _KPROBE_TOC(flush_icache_range)
BEGIN_FTR_SECTION BEGIN_FTR_SECTION
PURGE_PREFETCHED_INS PURGE_PREFETCHED_INS
blr blr
...@@ -117,7 +117,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) ...@@ -117,7 +117,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
* *
* flush all bytes from start to stop-1 inclusive * flush all bytes from start to stop-1 inclusive
*/ */
_GLOBAL(flush_dcache_range) _GLOBAL_TOC(flush_dcache_range)
/* /*
* Flush the data cache to memory * Flush the data cache to memory
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment