Skip to content

Commit 5f49135

Browse files
committed
powerpc/fsl: Fix mfpmr build errors with newer binutils
Binutils 2.38 complains about the use of mfpmr when building ppc6xx_defconfig: CC arch/powerpc/kernel/pmc.o {standard input}: Assembler messages: {standard input}:45: Error: unrecognized opcode: `mfpmr' {standard input}:56: Error: unrecognized opcode: `mtpmr' This is because by default the kernel is built with -mcpu=powerpc, and the mt/mfpmr instructions are not defined. It can be avoided by enabling CONFIG_E300C3_CPU, but just adding that to the defconfig will leave open the possibility of randconfig failures. So add machine directives around the mt/mfpmr instructions to tell binutils how to assemble them. Cc: stable@vger.kernel.org Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240229122521.762431-3-mpe@ellerman.id.au
1 parent 4e284e3 commit 5f49135

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

arch/powerpc/include/asm/reg_fsl_emb.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@
1212
#ifndef __ASSEMBLY__
1313
/* Performance Monitor Registers */
1414
#define mfpmr(rn) ({unsigned int rval; \
15-
asm volatile("mfpmr %0," __stringify(rn) \
15+
asm volatile(".machine push; " \
16+
".machine e300; " \
17+
"mfpmr %0," __stringify(rn) ";" \
18+
".machine pop; " \
1619
: "=r" (rval)); rval;})
17-
#define mtpmr(rn, v) asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
20+
#define mtpmr(rn, v) asm volatile(".machine push; " \
21+
".machine e300; " \
22+
"mtpmr " __stringify(rn) ",%0; " \
23+
".machine pop; " \
24+
: : "r" (v))
1825
#endif /* __ASSEMBLY__ */
1926

2027
/* Freescale Book E Performance Monitor APU Registers */

0 commit comments

Comments
 (0)