Commit 7d40aff8 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc: Replace PPC64_ELF_ABI_v{1/2} by CONFIG_PPC64_ELF_ABI_V{1/2}

Replace all uses of PPC64_ELF_ABI_v1 and PPC64_ELF_ABI_v2 by
resp CONFIG_PPC64_ELF_ABI_V1 and CONFIG_PPC64_ELF_ABI_V2.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/ba13d59e8c50bc9aa6328f1c7f0c0d0278e0a3a7.1652074503.git.christophe.leroy@csgroup.eu
parent 661aa880
...@@ -132,7 +132,7 @@ bool is_conditional_branch(ppc_inst_t instr); ...@@ -132,7 +132,7 @@ bool is_conditional_branch(ppc_inst_t instr);
static inline unsigned long ppc_function_entry(void *func) static inline unsigned long ppc_function_entry(void *func)
{ {
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
u32 *insn = func; u32 *insn = func;
/* /*
...@@ -157,7 +157,7 @@ static inline unsigned long ppc_function_entry(void *func) ...@@ -157,7 +157,7 @@ static inline unsigned long ppc_function_entry(void *func)
return (unsigned long)(insn + 2); return (unsigned long)(insn + 2);
else else
return (unsigned long)func; return (unsigned long)func;
#elif defined(PPC64_ELF_ABI_v1) #elif defined(CONFIG_PPC64_ELF_ABI_V1)
/* /*
* On PPC64 ABIv1 the function pointer actually points to the * On PPC64 ABIv1 the function pointer actually points to the
* function's descriptor. The first entry in the descriptor is the * function's descriptor. The first entry in the descriptor is the
...@@ -171,7 +171,7 @@ static inline unsigned long ppc_function_entry(void *func) ...@@ -171,7 +171,7 @@ static inline unsigned long ppc_function_entry(void *func)
static inline unsigned long ppc_global_function_entry(void *func) static inline unsigned long ppc_global_function_entry(void *func)
{ {
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
/* PPC64 ABIv2 the global entry point is at the address */ /* PPC64 ABIv2 the global entry point is at the address */
return (unsigned long)func; return (unsigned long)func;
#else #else
...@@ -188,7 +188,7 @@ static inline unsigned long ppc_global_function_entry(void *func) ...@@ -188,7 +188,7 @@ static inline unsigned long ppc_global_function_entry(void *func)
static inline unsigned long ppc_kallsyms_lookup_name(const char *name) static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
{ {
unsigned long addr; unsigned long addr;
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
/* check for dot variant */ /* check for dot variant */
char dot_name[1 + KSYM_NAME_LEN]; char dot_name[1 + KSYM_NAME_LEN];
bool dot_appended = false; bool dot_appended = false;
...@@ -209,7 +209,7 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name) ...@@ -209,7 +209,7 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
if (!addr && dot_appended) if (!addr && dot_appended)
/* Let's try the original non-dot symbol lookup */ /* Let's try the original non-dot symbol lookup */
addr = kallsyms_lookup_name(name); addr = kallsyms_lookup_name(name);
#elif defined(PPC64_ELF_ABI_v2) #elif defined(CONFIG_PPC64_ELF_ABI_V2)
addr = kallsyms_lookup_name(name); addr = kallsyms_lookup_name(name);
if (addr) if (addr)
addr = ppc_function_entry((void *)addr); addr = ppc_function_entry((void *)addr);
...@@ -226,7 +226,7 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name) ...@@ -226,7 +226,7 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
*/ */
/* This must match the definition of STK_GOT in <asm/ppc_asm.h> */ /* This must match the definition of STK_GOT in <asm/ppc_asm.h> */
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
#define R2_STACK_OFFSET 24 #define R2_STACK_OFFSET 24
#else #else
#define R2_STACK_OFFSET 40 #define R2_STACK_OFFSET 40
......
...@@ -64,7 +64,7 @@ void ftrace_graph_func(unsigned long ip, unsigned long parent_ip, ...@@ -64,7 +64,7 @@ void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
* those. * those.
*/ */
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
{ {
/* We need to skip past the initial dot, and the __se_sys alias */ /* We need to skip past the initial dot, and the __se_sys alias */
...@@ -83,7 +83,7 @@ static inline bool arch_syscall_match_sym_name(const char *sym, const char *name ...@@ -83,7 +83,7 @@ static inline bool arch_syscall_match_sym_name(const char *sym, const char *name
(!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) || (!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) ||
(!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4)); (!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
} }
#endif /* PPC64_ELF_ABI_v1 */ #endif /* CONFIG_PPC64_ELF_ABI_V1 */
#endif /* CONFIG_FTRACE_SYSCALLS */ #endif /* CONFIG_FTRACE_SYSCALLS */
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <asm/types.h> #include <asm/types.h>
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
#define cond_syscall(x) \ #define cond_syscall(x) \
asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \ asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \
"\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n") "\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n")
......
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
#define __STK_REG(i) (112 + ((i)-14)*8) #define __STK_REG(i) (112 + ((i)-14)*8)
#define STK_REG(i) __STK_REG(__REG_##i) #define STK_REG(i) __STK_REG(__REG_##i)
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
#define STK_GOT 24 #define STK_GOT 24
#define __STK_PARAM(i) (32 + ((i)-3)*8) #define __STK_PARAM(i) (32 + ((i)-3)*8)
#else #else
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
#endif #endif
#define STK_PARAM(i) __STK_PARAM(__REG_##i) #define STK_PARAM(i) __STK_PARAM(__REG_##i)
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
#define _GLOBAL(name) \ #define _GLOBAL(name) \
.align 2 ; \ .align 2 ; \
......
...@@ -120,7 +120,7 @@ struct pt_regs ...@@ -120,7 +120,7 @@ struct pt_regs
STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)
#define STACK_FRAME_MARKER 12 #define STACK_FRAME_MARKER 12
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
#define STACK_FRAME_MIN_SIZE 32 #define STACK_FRAME_MIN_SIZE 32
#else #else
#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD #define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD
......
...@@ -435,7 +435,7 @@ generic_secondary_common_init: ...@@ -435,7 +435,7 @@ generic_secondary_common_init:
ld r12,CPU_SPEC_RESTORE(r23) ld r12,CPU_SPEC_RESTORE(r23)
cmpdi 0,r12,0 cmpdi 0,r12,0
beq 3f beq 3f
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
ld r12,0(r12) ld r12,0(r12)
#endif #endif
mtctr r12 mtctr r12
......
...@@ -711,7 +711,7 @@ _GLOBAL(ret_from_kernel_thread) ...@@ -711,7 +711,7 @@ _GLOBAL(ret_from_kernel_thread)
REST_NVGPRS(r1) REST_NVGPRS(r1)
mtctr r14 mtctr r14
mr r3,r15 mr r3,r15
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
mr r12,r14 mr r12,r14
#endif #endif
bctrl bctrl
......
...@@ -45,7 +45,7 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset) ...@@ -45,7 +45,7 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
{ {
kprobe_opcode_t *addr = NULL; kprobe_opcode_t *addr = NULL;
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
/* PPC64 ABIv2 needs local entry point */ /* PPC64 ABIv2 needs local entry point */
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
if (addr && !offset) { if (addr && !offset) {
...@@ -63,7 +63,7 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset) ...@@ -63,7 +63,7 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
#endif #endif
addr = (kprobe_opcode_t *)ppc_function_entry(addr); addr = (kprobe_opcode_t *)ppc_function_entry(addr);
} }
#elif defined(PPC64_ELF_ABI_v1) #elif defined(CONFIG_PPC64_ELF_ABI_V1)
/* /*
* 64bit powerpc ABIv1 uses function descriptors: * 64bit powerpc ABIv1 uses function descriptors:
* - Check for the dot variant of the symbol first. * - Check for the dot variant of the symbol first.
...@@ -107,7 +107,7 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset) ...@@ -107,7 +107,7 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
static bool arch_kprobe_on_func_entry(unsigned long offset) static bool arch_kprobe_on_func_entry(unsigned long offset)
{ {
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
#ifdef CONFIG_KPROBES_ON_FTRACE #ifdef CONFIG_KPROBES_ON_FTRACE
return offset <= 16; return offset <= 16;
#else #else
......
...@@ -454,7 +454,7 @@ _GLOBAL(kexec_sequence) ...@@ -454,7 +454,7 @@ _GLOBAL(kexec_sequence)
beq 1f beq 1f
/* clear out hardware hash page table and tlb */ /* clear out hardware hash page table and tlb */
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
ld r12,0(r27) /* deref function descriptor */ ld r12,0(r27) /* deref function descriptor */
#else #else
mr r12,r27 mr r12,r27
......
...@@ -64,13 +64,13 @@ int module_finalize(const Elf_Ehdr *hdr, ...@@ -64,13 +64,13 @@ int module_finalize(const Elf_Ehdr *hdr,
(void *)sect->sh_addr + sect->sh_size); (void *)sect->sh_addr + sect->sh_size);
#endif /* CONFIG_PPC64 */ #endif /* CONFIG_PPC64 */
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
sect = find_section(hdr, sechdrs, ".opd"); sect = find_section(hdr, sechdrs, ".opd");
if (sect != NULL) { if (sect != NULL) {
me->arch.start_opd = sect->sh_addr; me->arch.start_opd = sect->sh_addr;
me->arch.end_opd = sect->sh_addr + sect->sh_size; me->arch.end_opd = sect->sh_addr + sect->sh_size;
} }
#endif /* PPC64_ELF_ABI_v1 */ #endif /* CONFIG_PPC64_ELF_ABI_V1 */
#ifdef CONFIG_PPC_BARRIER_NOSPEC #ifdef CONFIG_PPC_BARRIER_NOSPEC
sect = find_section(hdr, sechdrs, "__spec_barrier_fixup"); sect = find_section(hdr, sechdrs, "__spec_barrier_fixup");
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
this, and makes other things simpler. Anton? this, and makes other things simpler. Anton?
--RR. */ --RR. */
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
static func_desc_t func_desc(unsigned long addr) static func_desc_t func_desc(unsigned long addr)
{ {
...@@ -122,7 +122,7 @@ static u32 ppc64_stub_insns[] = { ...@@ -122,7 +122,7 @@ static u32 ppc64_stub_insns[] = {
/* Save current r2 value in magic place on the stack. */ /* Save current r2 value in magic place on the stack. */
PPC_RAW_STD(_R2, _R1, R2_STACK_OFFSET), PPC_RAW_STD(_R2, _R1, R2_STACK_OFFSET),
PPC_RAW_LD(_R12, _R11, 32), PPC_RAW_LD(_R12, _R11, 32),
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
/* Set up new r2 from function descriptor */ /* Set up new r2 from function descriptor */
PPC_RAW_LD(_R2, _R11, 40), PPC_RAW_LD(_R2, _R11, 40),
#endif #endif
......
...@@ -445,7 +445,7 @@ void __init pt_regs_check(void) ...@@ -445,7 +445,7 @@ void __init pt_regs_check(void)
*/ */
BUILD_BUG_ON(PT_DSCR < sizeof(struct user_pt_regs) / sizeof(unsigned long)); BUILD_BUG_ON(PT_DSCR < sizeof(struct user_pt_regs) / sizeof(unsigned long));
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
BUILD_BUG_ON(!IS_ENABLED(CONFIG_HAVE_FUNCTION_DESCRIPTORS)); BUILD_BUG_ON(!IS_ENABLED(CONFIG_HAVE_FUNCTION_DESCRIPTORS));
#else #else
BUILD_BUG_ON(IS_ENABLED(CONFIG_HAVE_FUNCTION_DESCRIPTORS)); BUILD_BUG_ON(IS_ENABLED(CONFIG_HAVE_FUNCTION_DESCRIPTORS));
......
...@@ -953,7 +953,7 @@ unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip, ...@@ -953,7 +953,7 @@ unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip,
#endif #endif
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
char *arch_ftrace_match_adjust(char *str, const char *search) char *arch_ftrace_match_adjust(char *str, const char *search)
{ {
if (str[0] == '.' && search[0] != '.') if (str[0] == '.' && search[0] != '.')
...@@ -961,4 +961,4 @@ char *arch_ftrace_match_adjust(char *str, const char *search) ...@@ -961,4 +961,4 @@ char *arch_ftrace_match_adjust(char *str, const char *search)
else else
return str; return str;
} }
#endif /* PPC64_ELF_ABI_v1 */ #endif /* CONFIG_PPC64_ELF_ABI_V1 */
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <asm/asm-compat.h> #include <asm/asm-compat.h>
#if defined(CONFIG_PPC_BOOK3S_64) #if defined(CONFIG_PPC_BOOK3S_64)
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
#define FUNC(name) name #define FUNC(name) name
#else #else
#define FUNC(name) GLUE(.,name) #define FUNC(name) GLUE(.,name)
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#if defined(CONFIG_PPC_BOOK3S_64) #if defined(CONFIG_PPC_BOOK3S_64)
#ifdef PPC64_ELF_ABI_v2 #ifdef CONFIG_PPC64_ELF_ABI_V2
#define FUNC(name) name #define FUNC(name) name
#else #else
#define FUNC(name) GLUE(.,name) #define FUNC(name) GLUE(.,name)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <asm/types.h> #include <asm/types.h>
#include <asm/ppc-opcode.h> #include <asm/ppc-opcode.h>
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
#define FUNCTION_DESCR_SIZE 24 #define FUNCTION_DESCR_SIZE 24
#else #else
#define FUNCTION_DESCR_SIZE 0 #define FUNCTION_DESCR_SIZE 0
......
...@@ -276,7 +276,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) ...@@ -276,7 +276,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
*/ */
bpf_jit_dump(flen, proglen, pass, code_base); bpf_jit_dump(flen, proglen, pass, code_base);
#ifdef PPC64_ELF_ABI_v1 #ifdef CONFIG_PPC64_ELF_ABI_V1
/* Function descriptor nastiness: Address + TOC */ /* Function descriptor nastiness: Address + TOC */
((u64 *)image)[0] = (u64)code_base; ((u64 *)image)[0] = (u64)code_base;
((u64 *)image)[1] = local_paca->kernel_toc; ((u64 *)image)[1] = local_paca->kernel_toc;
......
...@@ -126,7 +126,7 @@ void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx) ...@@ -126,7 +126,7 @@ void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx)
{ {
int i; int i;
if (__is_defined(PPC64_ELF_ABI_v2)) if (__is_defined(CONFIG_PPC64_ELF_ABI_V2))
EMIT(PPC_RAW_LD(_R2, _R13, offsetof(struct paca_struct, kernel_toc))); EMIT(PPC_RAW_LD(_R2, _R13, offsetof(struct paca_struct, kernel_toc)));
/* /*
...@@ -266,7 +266,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o ...@@ -266,7 +266,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
int b2p_index = bpf_to_ppc(BPF_REG_3); int b2p_index = bpf_to_ppc(BPF_REG_3);
int bpf_tailcall_prologue_size = 8; int bpf_tailcall_prologue_size = 8;
if (__is_defined(PPC64_ELF_ABI_v2)) if (__is_defined(CONFIG_PPC64_ELF_ABI_V2))
bpf_tailcall_prologue_size += 4; /* skip past the toc load */ bpf_tailcall_prologue_size += 4; /* skip past the toc load */
/* /*
......
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