]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.7/powerpc-fsl-fix-mfpmr-build-errors-with-newer-binuti.patch
Fixes for 6.7
[thirdparty/kernel/stable-queue.git] / queue-6.7 / powerpc-fsl-fix-mfpmr-build-errors-with-newer-binuti.patch
1 From 81806f18c95d35e1d8a8f1c069d32c2c6a703b82 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Thu, 29 Feb 2024 23:25:19 +1100
4 Subject: powerpc/fsl: Fix mfpmr build errors with newer binutils
5
6 From: Michael Ellerman <mpe@ellerman.id.au>
7
8 [ Upstream commit 5f491356b7149564ab22323ccce79c8d595bfd0c ]
9
10 Binutils 2.38 complains about the use of mfpmr when building
11 ppc6xx_defconfig:
12
13 CC arch/powerpc/kernel/pmc.o
14 {standard input}: Assembler messages:
15 {standard input}:45: Error: unrecognized opcode: `mfpmr'
16 {standard input}:56: Error: unrecognized opcode: `mtpmr'
17
18 This is because by default the kernel is built with -mcpu=powerpc, and
19 the mt/mfpmr instructions are not defined.
20
21 It can be avoided by enabling CONFIG_E300C3_CPU, but just adding that to
22 the defconfig will leave open the possibility of randconfig failures.
23
24 So add machine directives around the mt/mfpmr instructions to tell
25 binutils how to assemble them.
26
27 Cc: stable@vger.kernel.org
28 Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
29 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
30 Link: https://msgid.link/20240229122521.762431-3-mpe@ellerman.id.au
31 Signed-off-by: Sasha Levin <sashal@kernel.org>
32 ---
33 arch/powerpc/include/asm/reg_fsl_emb.h | 11 +++++++++--
34 1 file changed, 9 insertions(+), 2 deletions(-)
35
36 diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h b/arch/powerpc/include/asm/reg_fsl_emb.h
37 index a21f529c43d96..8359c06d92d9f 100644
38 --- a/arch/powerpc/include/asm/reg_fsl_emb.h
39 +++ b/arch/powerpc/include/asm/reg_fsl_emb.h
40 @@ -12,9 +12,16 @@
41 #ifndef __ASSEMBLY__
42 /* Performance Monitor Registers */
43 #define mfpmr(rn) ({unsigned int rval; \
44 - asm volatile("mfpmr %0," __stringify(rn) \
45 + asm volatile(".machine push; " \
46 + ".machine e300; " \
47 + "mfpmr %0," __stringify(rn) ";" \
48 + ".machine pop; " \
49 : "=r" (rval)); rval;})
50 -#define mtpmr(rn, v) asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
51 +#define mtpmr(rn, v) asm volatile(".machine push; " \
52 + ".machine e300; " \
53 + "mtpmr " __stringify(rn) ",%0; " \
54 + ".machine pop; " \
55 + : : "r" (v))
56 #endif /* __ASSEMBLY__ */
57
58 /* Freescale Book E Performance Monitor APU Registers */
59 --
60 2.43.0
61