aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2015-09-22 13:07:41 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-10-26 04:49:40 -0400
commitc1a0e9bc885d46e519fd87d35af6a7937abfb986 (patch)
tree164b0f0d9277c233eea8eccb2baa8bb60ec3cf0f
parent05513992c69d159e698bb4b5f651abd0ceff525c (diff)
MIPS: Allow compact branch policy to be changed
When debugging it can be helpful to change the policy for compiler use of MIPSr6 compact branches, in order to rule out or home in on their involvement in bugs. Allow the GCC -mcompact-branches= flag to be set via Kconfig under the "Kernel hacking" menu. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/11178/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/Kconfig.debug36
-rw-r--r--arch/mips/Makefile4
2 files changed, 40 insertions, 0 deletions
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index e250524021ac..13d796547ebd 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -113,4 +113,40 @@ config SPINLOCK_TEST
113 help 113 help
114 Add several files to the debugfs to test spinlock speed. 114 Add several files to the debugfs to test spinlock speed.
115 115
116if CPU_MIPSR6
117
118choice
119 prompt "Compact branch policy"
120 default MIPS_COMPACT_BRANCHES_OPTIMAL
121
122config MIPS_COMPACT_BRANCHES_NEVER
123 bool "Never (force delay slot branches)"
124 help
125 Pass the -mcompact-branches=never flag to the compiler in order to
126 force it to always emit branches with delay slots, and make no use
127 of the compact branch instructions introduced by MIPSr6. This is
128 useful if you suspect there may be an issue with compact branches in
129 either the compiler or the CPU.
130
131config MIPS_COMPACT_BRANCHES_OPTIMAL
132 bool "Optimal (use where beneficial)"
133 help
134 Pass the -mcompact-branches=optimal flag to the compiler in order for
135 it to make use of compact branch instructions where it deems them
136 beneficial, and use branches with delay slots elsewhere. This is the
137 default compiler behaviour, and should be used unless you have a
138 reason to choose otherwise.
139
140config MIPS_COMPACT_BRANCHES_ALWAYS
141 bool "Always (force compact branches)"
142 help
143 Pass the -mcompact-branches=always flag to the compiler in order to
144 force it to always emit compact branches, making no use of branch
145 instructions with delay slots. This can result in more compact code
146 which may be beneficial in some scenarios.
147
148endchoice
149
150endif # CPU_MIPSR6
151
116endmenu 152endmenu
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 252e347958f3..3f70ba54ae21 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -204,6 +204,10 @@ toolchain-msa := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(
204cflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA 204cflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA
205endif 205endif
206 206
207cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_NEVER) += -mcompact-branches=never
208cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_OPTIMAL) += -mcompact-branches=optimal
209cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_ALWAYS) += -mcompact-branches=always
210
207# 211#
208# Firmware support 212# Firmware support
209# 213#