Loading arch/powerpc/Kconfig +19 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ config PPC select OF_RESERVED_MEM select HAVE_FTRACE_MCOUNT_RECORD select HAVE_DYNAMIC_FTRACE select HAVE_DYNAMIC_FTRACE_WITH_REGS if MPROFILE_KERNEL select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_GRAPH_TRACER select SYSCTL_EXCEPTION_TRACE Loading Loading @@ -373,6 +374,24 @@ config PPC_TRANSACTIONAL_MEM ---help--- Support user-mode Transactional Memory on POWERPC. config DISABLE_MPROFILE_KERNEL bool "Disable use of mprofile-kernel for kernel tracing" depends on PPC64 && CPU_LITTLE_ENDIAN default y help Selecting this options disables use of the mprofile-kernel ABI for kernel tracing. That will cause options such as live patching (CONFIG_LIVEPATCH) which depend on CONFIG_DYNAMIC_FTRACE_WITH_REGS to be disabled also. If you have a toolchain which supports mprofile-kernel, then you can enable this. Otherwise leave it disabled. If you're not sure, say "N". config MPROFILE_KERNEL depends on PPC64 && CPU_LITTLE_ENDIAN def_bool !DISABLE_MPROFILE_KERNEL config IOMMU_HELPER def_bool PPC64 Loading arch/powerpc/Makefile +15 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,21 @@ else CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif ifdef CONFIG_MPROFILE_KERNEL ifeq ($(shell $(srctree)/arch/powerpc/scripts/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK) CC_FLAGS_FTRACE := -pg -mprofile-kernel KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL else # If the user asked for mprofile-kernel but the toolchain doesn't # support it, emit a warning and deliberately break the build later # with mprofile-kernel-not-supported. We would prefer to make this an # error right here, but then the user would never be able to run # oldconfig to change their configuration. $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL) CC_FLAGS_FTRACE := -mprofile-kernel-not-supported endif endif CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell) CFLAGS-$(CONFIG_POWER4_CPU) += $(call cc-option,-mcpu=power4) CFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5) Loading arch/powerpc/include/asm/code-patching.h +21 −0 Original line number Diff line number Diff line Loading @@ -99,4 +99,25 @@ static inline unsigned long ppc_global_function_entry(void *func) #endif } #ifdef CONFIG_PPC64 /* * Some instruction encodings commonly used in dynamic ftracing * and function live patching. */ /* This must match the definition of STK_GOT in <asm/ppc_asm.h> */ #if defined(_CALL_ELF) && _CALL_ELF == 2 #define R2_STACK_OFFSET 24 #else #define R2_STACK_OFFSET 40 #endif #define PPC_INST_LD_TOC (PPC_INST_LD | ___PPC_RT(__REG_R2) | \ ___PPC_RA(__REG_R1) | R2_STACK_OFFSET) /* usually preceded by a mflr r0 */ #define PPC_INST_STD_LR (PPC_INST_STD | ___PPC_RS(__REG_R0) | \ ___PPC_RA(__REG_R1) | PPC_LR_STKOFF) #endif /* CONFIG_PPC64 */ #endif /* _ASM_POWERPC_CODE_PATCHING_H */ arch/powerpc/include/asm/ftrace.h +5 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ extern void _mcount(void); #ifdef CONFIG_DYNAMIC_FTRACE # define FTRACE_ADDR ((unsigned long)ftrace_caller) # define FTRACE_REGS_ADDR FTRACE_ADDR static inline unsigned long ftrace_call_adjust(unsigned long addr) { /* reloction of mcount call site is the same as the address */ Loading @@ -58,6 +60,9 @@ struct dyn_arch_ftrace { #endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* __ASSEMBLY__ */ #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS #define ARCH_SUPPORTS_FTRACE_OPS 1 #endif #endif #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64) && !defined(__ASSEMBLY__) Loading arch/powerpc/include/asm/module.h +10 −2 Original line number Diff line number Diff line Loading @@ -78,10 +78,18 @@ struct mod_arch_specific { # endif /* MODULE */ #endif bool is_module_trampoline(u32 *insns); int module_trampoline_target(struct module *mod, u32 *trampoline, int module_trampoline_target(struct module *mod, unsigned long trampoline, unsigned long *target); #ifdef CONFIG_DYNAMIC_FTRACE int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs); #else static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs) { return 0; } #endif struct exception_table_entry; void sort_ex_table(struct exception_table_entry *start, struct exception_table_entry *finish); Loading Loading
arch/powerpc/Kconfig +19 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ config PPC select OF_RESERVED_MEM select HAVE_FTRACE_MCOUNT_RECORD select HAVE_DYNAMIC_FTRACE select HAVE_DYNAMIC_FTRACE_WITH_REGS if MPROFILE_KERNEL select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_GRAPH_TRACER select SYSCTL_EXCEPTION_TRACE Loading Loading @@ -373,6 +374,24 @@ config PPC_TRANSACTIONAL_MEM ---help--- Support user-mode Transactional Memory on POWERPC. config DISABLE_MPROFILE_KERNEL bool "Disable use of mprofile-kernel for kernel tracing" depends on PPC64 && CPU_LITTLE_ENDIAN default y help Selecting this options disables use of the mprofile-kernel ABI for kernel tracing. That will cause options such as live patching (CONFIG_LIVEPATCH) which depend on CONFIG_DYNAMIC_FTRACE_WITH_REGS to be disabled also. If you have a toolchain which supports mprofile-kernel, then you can enable this. Otherwise leave it disabled. If you're not sure, say "N". config MPROFILE_KERNEL depends on PPC64 && CPU_LITTLE_ENDIAN def_bool !DISABLE_MPROFILE_KERNEL config IOMMU_HELPER def_bool PPC64 Loading
arch/powerpc/Makefile +15 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,21 @@ else CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif ifdef CONFIG_MPROFILE_KERNEL ifeq ($(shell $(srctree)/arch/powerpc/scripts/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK) CC_FLAGS_FTRACE := -pg -mprofile-kernel KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL else # If the user asked for mprofile-kernel but the toolchain doesn't # support it, emit a warning and deliberately break the build later # with mprofile-kernel-not-supported. We would prefer to make this an # error right here, but then the user would never be able to run # oldconfig to change their configuration. $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL) CC_FLAGS_FTRACE := -mprofile-kernel-not-supported endif endif CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell) CFLAGS-$(CONFIG_POWER4_CPU) += $(call cc-option,-mcpu=power4) CFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5) Loading
arch/powerpc/include/asm/code-patching.h +21 −0 Original line number Diff line number Diff line Loading @@ -99,4 +99,25 @@ static inline unsigned long ppc_global_function_entry(void *func) #endif } #ifdef CONFIG_PPC64 /* * Some instruction encodings commonly used in dynamic ftracing * and function live patching. */ /* This must match the definition of STK_GOT in <asm/ppc_asm.h> */ #if defined(_CALL_ELF) && _CALL_ELF == 2 #define R2_STACK_OFFSET 24 #else #define R2_STACK_OFFSET 40 #endif #define PPC_INST_LD_TOC (PPC_INST_LD | ___PPC_RT(__REG_R2) | \ ___PPC_RA(__REG_R1) | R2_STACK_OFFSET) /* usually preceded by a mflr r0 */ #define PPC_INST_STD_LR (PPC_INST_STD | ___PPC_RS(__REG_R0) | \ ___PPC_RA(__REG_R1) | PPC_LR_STKOFF) #endif /* CONFIG_PPC64 */ #endif /* _ASM_POWERPC_CODE_PATCHING_H */
arch/powerpc/include/asm/ftrace.h +5 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ extern void _mcount(void); #ifdef CONFIG_DYNAMIC_FTRACE # define FTRACE_ADDR ((unsigned long)ftrace_caller) # define FTRACE_REGS_ADDR FTRACE_ADDR static inline unsigned long ftrace_call_adjust(unsigned long addr) { /* reloction of mcount call site is the same as the address */ Loading @@ -58,6 +60,9 @@ struct dyn_arch_ftrace { #endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* __ASSEMBLY__ */ #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS #define ARCH_SUPPORTS_FTRACE_OPS 1 #endif #endif #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64) && !defined(__ASSEMBLY__) Loading
arch/powerpc/include/asm/module.h +10 −2 Original line number Diff line number Diff line Loading @@ -78,10 +78,18 @@ struct mod_arch_specific { # endif /* MODULE */ #endif bool is_module_trampoline(u32 *insns); int module_trampoline_target(struct module *mod, u32 *trampoline, int module_trampoline_target(struct module *mod, unsigned long trampoline, unsigned long *target); #ifdef CONFIG_DYNAMIC_FTRACE int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs); #else static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs) { return 0; } #endif struct exception_table_entry; void sort_ex_table(struct exception_table_entry *start, struct exception_table_entry *finish); Loading