Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abba7597 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Masahiro Yamada
Browse files

powerpc/kbuild: move -mprofile-kernel check to Kconfig



This eliminates the workaround that requires disabling
-mprofile-kernel by default in Kconfig.

Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 8373b7d9
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -459,23 +459,9 @@ config LD_HEAD_STUB_CATCH

	  If unsure, say "N".

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
	  disable this. Otherwise leave it enabled. If you're not sure, say
	  "Y".

config MPROFILE_KERNEL
	depends on PPC64 && CPU_LITTLE_ENDIAN
	def_bool !DISABLE_MPROFILE_KERNEL
	def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)

config HOTPLUG_CPU
	bool "Support for enabling/disabling CPUs"
+1 −12
Original line number Diff line number Diff line
@@ -161,18 +161,7 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
endif

ifdef CONFIG_MPROFILE_KERNEL
    ifeq ($(shell $(srctree)/arch/powerpc/tools/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)
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
#include <asm-generic/module.h>


#ifdef CC_USING_MPROFILE_KERNEL
#ifdef CONFIG_MPROFILE_KERNEL
#define MODULE_ARCH_VERMAGIC_FTRACE	"mprofile-kernel "
#else
#define MODULE_ARCH_VERMAGIC_FTRACE	""
+2 −2
Original line number Diff line number Diff line
@@ -466,7 +466,7 @@ static unsigned long stub_for_addr(const Elf64_Shdr *sechdrs,
	return (unsigned long)&stubs[i];
}

#ifdef CC_USING_MPROFILE_KERNEL
#ifdef CONFIG_MPROFILE_KERNEL
static bool is_mprofile_mcount_callsite(const char *name, u32 *instruction)
{
	if (strcmp("_mcount", name))
@@ -753,7 +753,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,

#ifdef CONFIG_DYNAMIC_FTRACE

#ifdef CC_USING_MPROFILE_KERNEL
#ifdef CONFIG_MPROFILE_KERNEL

#define PACATOC offsetof(struct paca_struct, kernel_toc)

+3 −3
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ __ftrace_make_nop(struct module *mod,
		return -EINVAL;
	}

#ifdef CC_USING_MPROFILE_KERNEL
#ifdef CONFIG_MPROFILE_KERNEL
	/* When using -mkernel_profile there is no load to jump over */
	pop = PPC_INST_NOP;

@@ -188,7 +188,7 @@ __ftrace_make_nop(struct module *mod,
		pr_err("Expected %08x found %08x\n", PPC_INST_LD_TOC, op);
		return -EINVAL;
	}
#endif /* CC_USING_MPROFILE_KERNEL */
#endif /* CONFIG_MPROFILE_KERNEL */

	if (patch_instruction((unsigned int *)ip, pop)) {
		pr_err("Patching NOP failed.\n");
@@ -324,7 +324,7 @@ int ftrace_make_nop(struct module *mod,
 * They should effectively be a NOP, and follow formal constraints,
 * depending on the ABI. Return false if they don't.
 */
#ifndef CC_USING_MPROFILE_KERNEL
#ifndef CONFIG_MPROFILE_KERNEL
static int
expected_nop_sequence(void *ip, unsigned int op0, unsigned int op1)
{
Loading