[PATCH RFC 16/28] ARM: entry: Drop argument to asm_irqentry macros

From: Linus Walleij
Date: Thu Oct 10 2024 - 07:36:41 EST


asm_irqentry_enter_from_user_mode and asm_irqentry_exit_to_user_mode
have a "save" argument that will save and restore registers before
the call to the C function.

Now all invocations set this argument to 0 so drop the surplus
code.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
arch/arm/kernel/entry-armv.S | 8 ++++----
arch/arm/kernel/entry-common.S | 2 +-
arch/arm/kernel/entry-header.S | 18 ++----------------
3 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0328860475e1..09ce1be1f677 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -421,7 +421,7 @@ ENDPROC(__fiq_abt)
.align 5
__dabt_usr:
usr_entry uaccess=0
- asm_irqentry_enter_from_user_mode save = 0
+ asm_irqentry_enter_from_user_mode
kuser_cmpxchg_check
mov r2, sp
dabt_helper
@@ -432,7 +432,7 @@ ENDPROC(__dabt_usr)
.align 5
__irq_usr:
usr_entry
- asm_irqentry_enter_from_user_mode save = 0
+ asm_irqentry_enter_from_user_mode
kuser_cmpxchg_check
irq_handler from_user=1
get_thread_info tsk
@@ -446,7 +446,7 @@ ENDPROC(__irq_usr)
.align 5
__und_usr:
usr_entry uaccess=0
- asm_irqentry_enter_from_user_mode save = 0
+ asm_irqentry_enter_from_user_mode

@ IRQs must be enabled before attempting to read the instruction from
@ user space since that could cause a page/translation fault if the
@@ -471,7 +471,7 @@ ENDPROC(__und_usr)
.align 5
__pabt_usr:
usr_entry
- asm_irqentry_enter_from_user_mode save = 0
+ asm_irqentry_enter_from_user_mode
mov r2, sp @ regs
pabt_helper
UNWIND(.fnend )
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 14b2495cae3c..df564388905e 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -109,7 +109,7 @@ ENTRY(ret_to_user_from_irq)
movs r1, r1, lsl #16
bne slow_work_pending
no_work_pending:
- asm_irqentry_exit_to_user_mode save = 0
+ asm_irqentry_exit_to_user_mode

#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
bl stackleak_erase_on_task_stack
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index fb5bb019199b..50c0b55adc74 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -365,28 +365,14 @@ ALT_UP_B(.L1_\@)
* Context tracking and other mode transitions. Used to instrument transitions
* between user and kernel mode.
*/
- .macro asm_irqentry_enter_from_user_mode, save = 1
- .if \save
- stmdb sp!, {r0-r3, ip, lr}
+ .macro asm_irqentry_enter_from_user_mode
mov r0, sp @ regs
bl irqentry_enter_from_user_mode
- ldmia sp!, {r0-r3, ip, lr}
- .else
- mov r0, sp @ regs
- bl irqentry_enter_from_user_mode
- .endif
.endm

- .macro asm_irqentry_exit_to_user_mode, save = 1
- .if \save
- stmdb sp!, {r0-r3, ip, lr}
+ .macro asm_irqentry_exit_to_user_mode
mov r0, sp @ regs
bl irqentry_exit_to_user_mode
- ldmia sp!, {r0-r3, ip, lr}
- .else
- mov r0, sp @ regs
- bl irqentry_exit_to_user_mode
- .endif
.endm

/*

--
2.46.2