LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/64e: Fix obtool warnings in exceptions-64e.S
@ 2023-06-22 11:24 Michael Ellerman
  2023-06-22 12:06 ` Christophe Leroy
  2023-07-17  0:29 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-06-22 11:24 UTC (permalink / raw)
  To: linuxppc-dev

Since commit aec0ba7472a7 ("powerpc/64: Use -mprofile-kernel for big
endian ELFv2 kernels"), this file is checked by objtool. Fix warnings
such as:

  arch/powerpc/kernel/idle_64e.o: warning: objtool: .text+0x20: unannotated intra-function call
  arch/powerpc/kernel/exceptions-64e.o: warning: objtool: .text+0x218: unannotated intra-function call

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/exceptions-64e.S | 31 ++++++++++++++++------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 3f86091e68b3..7ab4c8c0f1ab 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -5,6 +5,7 @@
  *  Copyright (C) 2007 Ben. Herrenschmidt (benh@kernel.crashing.org), IBM Corp.
  */
 
+#include <linux/linkage.h>
 #include <linux/threads.h>
 #include <asm/reg.h>
 #include <asm/page.h>
@@ -66,7 +67,7 @@
 #define SPECIAL_EXC_LOAD(reg, name) \
 	ld	reg, (SPECIAL_EXC_##name * 8 + SPECIAL_EXC_FRAME_OFFS)(r1)
 
-special_reg_save:
+SYM_CODE_START_LOCAL(special_reg_save)
 	/*
 	 * We only need (or have stack space) to save this stuff if
 	 * we interrupted the kernel.
@@ -131,8 +132,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
 	SPECIAL_EXC_STORE(r10,CSRR1)
 
 	blr
+SYM_CODE_END(special_reg_save)
 
-ret_from_level_except:
+SYM_CODE_START_LOCAL(ret_from_level_except)
 	ld	r3,_MSR(r1)
 	andi.	r3,r3,MSR_PR
 	beq	1f
@@ -206,6 +208,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
 	mtxer	r11
 
 	blr
+SYM_CODE_END(ret_from_level_except)
 
 .macro ret_from_level srr0 srr1 paca_ex scratch
 	bl	ret_from_level_except
@@ -232,13 +235,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
 	mfspr	r13,\scratch
 .endm
 
-ret_from_crit_except:
+SYM_CODE_START_LOCAL(ret_from_crit_except)
 	ret_from_level SPRN_CSRR0 SPRN_CSRR1 PACA_EXCRIT SPRN_SPRG_CRIT_SCRATCH
 	rfci
+SYM_CODE_END(ret_from_crit_except)
 
-ret_from_mc_except:
+SYM_CODE_START_LOCAL(ret_from_mc_except)
 	ret_from_level SPRN_MCSRR0 SPRN_MCSRR1 PACA_EXMC SPRN_SPRG_MC_SCRATCH
 	rfmci
+SYM_CODE_END(ret_from_mc_except)
 
 /* Exception prolog code for all exceptions */
 #define EXCEPTION_PROLOG(n, intnum, type, addition)	    		    \
@@ -978,20 +983,22 @@ masked_interrupt_book3e_0x2c0:
  * r14 and r15 containing the fault address and error code, with the
  * original values stashed away in the PACA
  */
-storage_fault_common:
+SYM_CODE_START_LOCAL(storage_fault_common)
 	addi	r3,r1,STACK_INT_FRAME_REGS
 	bl	do_page_fault
 	b	interrupt_return
+SYM_CODE_END(storage_fault_common)
 
 /*
  * Alignment exception doesn't fit entirely in the 0x100 bytes so it
  * continues here.
  */
-alignment_more:
+SYM_CODE_START_LOCAL(alignment_more)
 	addi	r3,r1,STACK_INT_FRAME_REGS
 	bl	alignment_exception
 	REST_NVGPRS(r1)
 	b	interrupt_return
+SYM_CODE_END(alignment_more)
 
 /*
  * Trampolines used when spotting a bad kernel stack pointer in
@@ -1030,8 +1037,7 @@ BAD_STACK_TRAMPOLINE(0xe00)
 BAD_STACK_TRAMPOLINE(0xf00)
 BAD_STACK_TRAMPOLINE(0xf20)
 
-	.globl	bad_stack_book3e
-bad_stack_book3e:
+_GLOBAL(bad_stack_book3e)
 	/* XXX: Needs to make SPRN_SPRG_GEN depend on exception type */
 	mfspr	r10,SPRN_SRR0;		  /* read SRR0 before touching stack */
 	ld	r1,PACAEMERGSP(r13)
@@ -1285,8 +1291,7 @@ have_hes:
 	 * ever takes any parameters, the SCOM code must also be updated to
 	 * provide them.
 	 */
-	.globl a2_tlbinit_code_start
-a2_tlbinit_code_start:
+_GLOBAL(a2_tlbinit_code_start)
 
 	ori	r11,r3,MAS0_WQ_ALLWAYS
 	oris	r11,r11,MAS0_ESEL(3)@h /* Use way 3: workaround A2 erratum 376 */
@@ -1479,8 +1484,7 @@ _GLOBAL(book3e_secondary_thread_init)
 	mflr	r28
 	b	3b
 
-	.globl init_core_book3e
-init_core_book3e:
+_GLOBAL(init_core_book3e)
 	/* Establish the interrupt vector base */
 	tovirt(r2,r2)
 	LOAD_REG_ADDR(r3, interrupt_base_book3e)
@@ -1488,7 +1492,7 @@ init_core_book3e:
 	sync
 	blr
 
-init_thread_book3e:
+SYM_CODE_START_LOCAL(init_thread_book3e)
 	lis	r3,(SPRN_EPCR_ICM | SPRN_EPCR_GICM)@h
 	mtspr	SPRN_EPCR,r3
 
@@ -1502,6 +1506,7 @@ init_thread_book3e:
 	mtspr	SPRN_TSR,r3
 
 	blr
+SYM_CODE_END(init_thread_book3e)
 
 _GLOBAL(__setup_base_ivors)
 	SET_IVOR(0, 0x020) /* Critical Input */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/64e: Fix obtool warnings in exceptions-64e.S
  2023-06-22 11:24 [PATCH] powerpc/64e: Fix obtool warnings in exceptions-64e.S Michael Ellerman
@ 2023-06-22 12:06 ` Christophe Leroy
  2023-06-22 23:46   ` Michael Ellerman
  2023-07-17  0:29 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy @ 2023-06-22 12:06 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev@lists.ozlabs.org



Le 22/06/2023 à 13:24, Michael Ellerman a écrit :
> Since commit aec0ba7472a7 ("powerpc/64: Use -mprofile-kernel for big
> endian ELFv2 kernels"), this file is checked by objtool. Fix warnings
> such as:
> 
>    arch/powerpc/kernel/idle_64e.o: warning: objtool: .text+0x20: unannotated intra-function call
>    arch/powerpc/kernel/exceptions-64e.o: warning: objtool: .text+0x218: unannotated intra-function call
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>   arch/powerpc/kernel/exceptions-64e.S | 31 ++++++++++++++++------------
>   1 file changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
> index 3f86091e68b3..7ab4c8c0f1ab 100644
> --- a/arch/powerpc/kernel/exceptions-64e.S
> +++ b/arch/powerpc/kernel/exceptions-64e.S
> @@ -1030,8 +1037,7 @@ BAD_STACK_TRAMPOLINE(0xe00)
>   BAD_STACK_TRAMPOLINE(0xf00)
>   BAD_STACK_TRAMPOLINE(0xf20)
>   
> -	.globl	bad_stack_book3e
> -bad_stack_book3e:
> +_GLOBAL(bad_stack_book3e)
>   	/* XXX: Needs to make SPRN_SPRG_GEN depend on exception type */
>   	mfspr	r10,SPRN_SRR0;		  /* read SRR0 before touching stack */
>   	ld	r1,PACAEMERGSP(r13)

If we start playing with that now, allthough I have a patch in my 
UACCESS validation series that totally disables OBJTOOL for ASM files, 
can we ban _GLOBAL macro and use SYM_FUNC_START / SYM_FUNC_END instead ?

Christophe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/64e: Fix obtool warnings in exceptions-64e.S
  2023-06-22 12:06 ` Christophe Leroy
@ 2023-06-22 23:46   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-06-22 23:46 UTC (permalink / raw)
  To: Christophe Leroy, linuxppc-dev@lists.ozlabs.org

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 22/06/2023 à 13:24, Michael Ellerman a écrit :
>> Since commit aec0ba7472a7 ("powerpc/64: Use -mprofile-kernel for big
>> endian ELFv2 kernels"), this file is checked by objtool. Fix warnings
>> such as:
>> 
>>    arch/powerpc/kernel/idle_64e.o: warning: objtool: .text+0x20: unannotated intra-function call
>>    arch/powerpc/kernel/exceptions-64e.o: warning: objtool: .text+0x218: unannotated intra-function call
>> 
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>> ---
>>   arch/powerpc/kernel/exceptions-64e.S | 31 ++++++++++++++++------------
>>   1 file changed, 18 insertions(+), 13 deletions(-)
>> 
>> diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
>> index 3f86091e68b3..7ab4c8c0f1ab 100644
>> --- a/arch/powerpc/kernel/exceptions-64e.S
>> +++ b/arch/powerpc/kernel/exceptions-64e.S
>> @@ -1030,8 +1037,7 @@ BAD_STACK_TRAMPOLINE(0xe00)
>>   BAD_STACK_TRAMPOLINE(0xf00)
>>   BAD_STACK_TRAMPOLINE(0xf20)
>>   
>> -	.globl	bad_stack_book3e
>> -bad_stack_book3e:
>> +_GLOBAL(bad_stack_book3e)
>>   	/* XXX: Needs to make SPRN_SPRG_GEN depend on exception type */
>>   	mfspr	r10,SPRN_SRR0;		  /* read SRR0 before touching stack */
>>   	ld	r1,PACAEMERGSP(r13)
>
> If we start playing with that now, allthough I have a patch in my 
> UACCESS validation series that totally disables OBJTOOL for ASM files,

Yeah I saw that, and it's probably a good idea in the interim while
we're getting all the uaccess stuff sorted out.

Though these warnings are firing today in my next branch, so I'll plan
to merge this patch for 6.5 to squash them.

> can we ban _GLOBAL macro and use SYM_FUNC_START / SYM_FUNC_END instead ?

Yeah, I'm not a fan of _GLOBAL, it does too much.

We'd obviously need to override the generic SYMC_FUNC_START to do all
the TOC setup and so on when it's needed.

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/64e: Fix obtool warnings in exceptions-64e.S
  2023-06-22 11:24 [PATCH] powerpc/64e: Fix obtool warnings in exceptions-64e.S Michael Ellerman
  2023-06-22 12:06 ` Christophe Leroy
@ 2023-07-17  0:29 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-07-17  0:29 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman

On Thu, 22 Jun 2023 21:24:51 +1000, Michael Ellerman wrote:
> Since commit aec0ba7472a7 ("powerpc/64: Use -mprofile-kernel for big
> endian ELFv2 kernels"), this file is checked by objtool. Fix warnings
> such as:
> 
>   arch/powerpc/kernel/idle_64e.o: warning: objtool: .text+0x20: unannotated intra-function call
>   arch/powerpc/kernel/exceptions-64e.o: warning: objtool: .text+0x218: unannotated intra-function call
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/64e: Fix obtool warnings in exceptions-64e.S
      https://git.kernel.org/powerpc/c/cf65b12c17b4910d099d78f6ed6919ec040ecdbc

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-17  0:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-22 11:24 [PATCH] powerpc/64e: Fix obtool warnings in exceptions-64e.S Michael Ellerman
2023-06-22 12:06 ` Christophe Leroy
2023-06-22 23:46   ` Michael Ellerman
2023-07-17  0:29 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox