Skip to content

Commit f24f21c

Browse files
committed
Merge branch 'topic/objtool' into next
Merge the powerpc objtool support, which we were keeping in a topic branch in case of any merge conflicts.
2 parents 64fdcbc + a39818a commit f24f21c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+429
-106
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,9 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_CC
933933
endif
934934
endif
935935
ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
936-
CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
936+
ifdef CONFIG_HAVE_OBJTOOL_NOP_MCOUNT
937+
CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
938+
endif
937939
endif
938940
ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
939941
ifdef CONFIG_HAVE_C_RECORDMCOUNT

arch/powerpc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ config PPC
241241
select HAVE_MOD_ARCH_SPECIFIC
242242
select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S)
243243
select HAVE_OPTPROBES
244+
select HAVE_OBJTOOL if PPC32 || MPROFILE_KERNEL
245+
select HAVE_OBJTOOL_MCOUNT if HAVE_OBJTOOL
244246
select HAVE_PERF_EVENTS
245247
select HAVE_PERF_EVENTS_NMI if PPC64
246248
select HAVE_PERF_REGS

arch/powerpc/include/asm/asm.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_POWERPC_ASM_H
3+
#define _ASM_POWERPC_ASM_H
4+
5+
#define _ASM_PTR " .long "
6+
7+
#endif /* _ASM_POWERPC_ASM_H */

arch/powerpc/include/asm/bug.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@
9999
__label__ __label_warn_on; \
100100
\
101101
WARN_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags), __label_warn_on); \
102-
unreachable(); \
102+
barrier_before_unreachable(); \
103+
__builtin_unreachable(); \
103104
\
104105
__label_warn_on: \
105106
break; \

arch/powerpc/include/asm/linkage.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#include <asm/types.h>
66

7+
#define __ALIGN .align 2
8+
#define __ALIGN_STR ".align 2"
9+
710
#ifdef CONFIG_PPC64_ELF_ABI_V1
811
#define cond_syscall(x) \
912
asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \

arch/powerpc/kernel/cpu_setup_6xx.S

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Copyright (C) 2003 Benjamin Herrenschmidt ([email protected])
55
*/
66

7+
#include <linux/linkage.h>
8+
79
#include <asm/processor.h>
810
#include <asm/page.h>
911
#include <asm/cputable.h>
@@ -81,7 +83,7 @@ _GLOBAL(__setup_cpu_745x)
8183
blr
8284

8385
/* Enable caches for 603's, 604, 750 & 7400 */
84-
setup_common_caches:
86+
SYM_FUNC_START_LOCAL(setup_common_caches)
8587
mfspr r11,SPRN_HID0
8688
andi. r0,r11,HID0_DCE
8789
ori r11,r11,HID0_ICE|HID0_DCE
@@ -95,11 +97,12 @@ setup_common_caches:
9597
sync
9698
isync
9799
blr
100+
SYM_FUNC_END(setup_common_caches)
98101

99102
/* 604, 604e, 604ev, ...
100103
* Enable superscalar execution & branch history table
101104
*/
102-
setup_604_hid0:
105+
SYM_FUNC_START_LOCAL(setup_604_hid0)
103106
mfspr r11,SPRN_HID0
104107
ori r11,r11,HID0_SIED|HID0_BHTE
105108
ori r8,r11,HID0_BTCD
@@ -110,6 +113,7 @@ setup_604_hid0:
110113
sync
111114
isync
112115
blr
116+
SYM_FUNC_END(setup_604_hid0)
113117

114118
/* 7400 <= rev 2.7 and 7410 rev = 1.0 suffer from some
115119
* erratas we work around here.
@@ -125,13 +129,14 @@ setup_604_hid0:
125129
* needed once we have applied workaround #5 (though it's
126130
* not set by Apple's firmware at least).
127131
*/
128-
setup_7400_workarounds:
132+
SYM_FUNC_START_LOCAL(setup_7400_workarounds)
129133
mfpvr r3
130134
rlwinm r3,r3,0,20,31
131135
cmpwi 0,r3,0x0207
132136
ble 1f
133137
blr
134-
setup_7410_workarounds:
138+
SYM_FUNC_END(setup_7400_workarounds)
139+
SYM_FUNC_START_LOCAL(setup_7410_workarounds)
135140
mfpvr r3
136141
rlwinm r3,r3,0,20,31
137142
cmpwi 0,r3,0x0100
@@ -151,14 +156,15 @@ setup_7410_workarounds:
151156
sync
152157
isync
153158
blr
159+
SYM_FUNC_END(setup_7410_workarounds)
154160

155161
/* 740/750/7400/7410
156162
* Enable Store Gathering (SGE), Address Broadcast (ABE),
157163
* Branch History Table (BHTE), Branch Target ICache (BTIC)
158164
* Dynamic Power Management (DPM), Speculative (SPD)
159165
* Clear Instruction cache throttling (ICTC)
160166
*/
161-
setup_750_7400_hid0:
167+
SYM_FUNC_START_LOCAL(setup_750_7400_hid0)
162168
mfspr r11,SPRN_HID0
163169
ori r11,r11,HID0_SGE | HID0_ABE | HID0_BHTE | HID0_BTIC
164170
oris r11,r11,HID0_DPM@h
@@ -177,12 +183,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_NO_DPM)
177183
sync
178184
isync
179185
blr
186+
SYM_FUNC_END(setup_750_7400_hid0)
180187

181188
/* 750cx specific
182189
* Looks like we have to disable NAP feature for some PLL settings...
183190
* (waiting for confirmation)
184191
*/
185-
setup_750cx:
192+
SYM_FUNC_START_LOCAL(setup_750cx)
186193
mfspr r10, SPRN_HID1
187194
rlwinm r10,r10,4,28,31
188195
cmpwi cr0,r10,7
@@ -196,11 +203,13 @@ setup_750cx:
196203
andc r6,r6,r7
197204
stw r6,CPU_SPEC_FEATURES(r4)
198205
blr
206+
SYM_FUNC_END(setup_750cx)
199207

200208
/* 750fx specific
201209
*/
202-
setup_750fx:
210+
SYM_FUNC_START_LOCAL(setup_750fx)
203211
blr
212+
SYM_FUNC_END(setup_750fx)
204213

205214
/* MPC 745x
206215
* Enable Store Gathering (SGE), Branch Folding (FOLD)
@@ -212,7 +221,7 @@ setup_750fx:
212221
* Clear Instruction cache throttling (ICTC)
213222
* Enable L2 HW prefetch
214223
*/
215-
setup_745x_specifics:
224+
SYM_FUNC_START_LOCAL(setup_745x_specifics)
216225
/* We check for the presence of an L3 cache setup by
217226
* the firmware. If any, we disable NAP capability as
218227
* it's known to be bogus on rev 2.1 and earlier
@@ -270,6 +279,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_NO_DPM)
270279
sync
271280
isync
272281
blr
282+
SYM_FUNC_END(setup_745x_specifics)
273283

274284
/*
275285
* Initialize the FPU registers. This is needed to work around an errata

arch/powerpc/kernel/cpu_setup_e500.S

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* Benjamin Herrenschmidt <[email protected]>
99
*/
1010

11+
#include <linux/linkage.h>
12+
1113
#include <asm/page.h>
1214
#include <asm/processor.h>
1315
#include <asm/cputable.h>
@@ -274,7 +276,7 @@ _GLOBAL(flush_dcache_L1)
274276

275277
blr
276278

277-
has_L2_cache:
279+
SYM_FUNC_START_LOCAL(has_L2_cache)
278280
/* skip L2 cache on P2040/P2040E as they have no L2 cache */
279281
mfspr r3, SPRN_SVR
280282
/* shift right by 8 bits and clear E bit of SVR */
@@ -290,9 +292,10 @@ has_L2_cache:
290292
1:
291293
li r3, 0
292294
blr
295+
SYM_FUNC_END(has_L2_cache)
293296

294297
/* flush backside L2 cache */
295-
flush_backside_L2_cache:
298+
SYM_FUNC_START_LOCAL(flush_backside_L2_cache)
296299
mflr r10
297300
bl has_L2_cache
298301
mtlr r10
@@ -313,6 +316,7 @@ flush_backside_L2_cache:
313316
bne 1b
314317
2:
315318
blr
319+
SYM_FUNC_END(flush_backside_L2_cache)
316320

317321
_GLOBAL(cpu_down_flush_e500v2)
318322
mflr r0

arch/powerpc/kernel/entry_32.S

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include <linux/err.h>
1919
#include <linux/sys.h>
2020
#include <linux/threads.h>
21+
#include <linux/linkage.h>
22+
2123
#include <asm/reg.h>
2224
#include <asm/page.h>
2325
#include <asm/mmu.h>
@@ -74,17 +76,18 @@ _ASM_NOKPROBE_SYMBOL(prepare_transfer_to_handler)
7476
#endif /* CONFIG_PPC_BOOK3S_32 || CONFIG_PPC_E500 */
7577

7678
#if defined(CONFIG_PPC_KUEP) && defined(CONFIG_PPC_BOOK3S_32)
77-
.globl __kuep_lock
78-
__kuep_lock:
79+
SYM_FUNC_START(__kuep_lock)
7980
lwz r9, THREAD+THSR0(r2)
8081
update_user_segments_by_4 r9, r10, r11, r12
8182
blr
83+
SYM_FUNC_END(__kuep_lock)
8284

83-
__kuep_unlock:
85+
SYM_FUNC_START_LOCAL(__kuep_unlock)
8486
lwz r9, THREAD+THSR0(r2)
8587
rlwinm r9,r9,0,~SR_NX
8688
update_user_segments_by_4 r9, r10, r11, r12
8789
blr
90+
SYM_FUNC_END(__kuep_unlock)
8891

8992
.macro kuep_lock
9093
bl __kuep_lock

arch/powerpc/kernel/entry_64.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* code, and exception/interrupt return code for PowerPC.
1515
*/
1616

17+
#include <linux/objtool.h>
1718
#include <linux/errno.h>
1819
#include <linux/err.h>
1920
#include <asm/cache.h>
@@ -73,6 +74,7 @@ flush_branch_caches:
7374

7475
// Flush the link stack
7576
.rept 64
77+
ANNOTATE_INTRA_FUNCTION_CALL
7678
bl .+4
7779
.endr
7880
b 1f

arch/powerpc/kernel/exceptions-64s.S

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
*/
1515

16+
#include <linux/linkage.h>
1617
#include <asm/hw_irq.h>
1718
#include <asm/exception-64s.h>
1819
#include <asm/ptrace.h>
@@ -3140,7 +3141,7 @@ _GLOBAL(enable_machine_check)
31403141
blr
31413142

31423143
/* MSR[RI] should be clear because this uses SRR[01] */
3143-
disable_machine_check:
3144+
SYM_FUNC_START_LOCAL(disable_machine_check)
31443145
mflr r0
31453146
bcl 20,31,$+4
31463147
0: mflr r3
@@ -3153,3 +3154,4 @@ disable_machine_check:
31533154
RFI_TO_KERNEL
31543155
1: mtlr r0
31553156
blr
3157+
SYM_FUNC_END(disable_machine_check)

0 commit comments

Comments
 (0)