Skip to content

Commit 46a2b02

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: entry: consolidate entry/exit helpers
To make the various entry/exit helpers easier to understand and easier to compare, this patch moves all the entry/exit helpers to be adjacent at the top of entry-common.c, rather than being spread out throughout the file. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Cc: James Morse <[email protected]> Cc: Joey Gouly <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-by: Joey Gouly <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent ff11764 commit 46a2b02

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

arch/arm64/kernel/entry-common.c

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ static void noinstr exit_to_kernel_mode(struct pt_regs *regs)
7575
}
7676
}
7777

78+
asmlinkage void noinstr enter_from_user_mode(void)
79+
{
80+
lockdep_hardirqs_off(CALLER_ADDR0);
81+
CT_WARN_ON(ct_state() != CONTEXT_USER);
82+
user_exit_irqoff();
83+
trace_hardirqs_off_finish();
84+
}
85+
86+
asmlinkage void noinstr exit_to_user_mode(void)
87+
{
88+
mte_check_tfsr_exit();
89+
90+
trace_hardirqs_on_prepare();
91+
lockdep_hardirqs_on_prepare(CALLER_ADDR0);
92+
user_enter_irqoff();
93+
lockdep_hardirqs_on(CALLER_ADDR0);
94+
}
95+
7896
static void noinstr arm64_enter_nmi(struct pt_regs *regs)
7997
{
8098
regs->lockdep_hardirqs = lockdep_hardirqs_enabled();
@@ -105,6 +123,30 @@ static void noinstr arm64_exit_nmi(struct pt_regs *regs)
105123
__nmi_exit();
106124
}
107125

126+
static void noinstr arm64_enter_el1_dbg(struct pt_regs *regs)
127+
{
128+
regs->lockdep_hardirqs = lockdep_hardirqs_enabled();
129+
130+
lockdep_hardirqs_off(CALLER_ADDR0);
131+
rcu_nmi_enter();
132+
133+
trace_hardirqs_off_finish();
134+
}
135+
136+
static void noinstr arm64_exit_el1_dbg(struct pt_regs *regs)
137+
{
138+
bool restore = regs->lockdep_hardirqs;
139+
140+
if (restore) {
141+
trace_hardirqs_on_prepare();
142+
lockdep_hardirqs_on_prepare(CALLER_ADDR0);
143+
}
144+
145+
rcu_nmi_exit();
146+
if (restore)
147+
lockdep_hardirqs_on(CALLER_ADDR0);
148+
}
149+
108150
static void noinstr enter_el1_irq_or_nmi(struct pt_regs *regs)
109151
{
110152
if (IS_ENABLED(CONFIG_ARM64_PSEUDO_NMI) && !interrupts_enabled(regs))
@@ -265,30 +307,6 @@ static void noinstr el1_undef(struct pt_regs *regs)
265307
exit_to_kernel_mode(regs);
266308
}
267309

268-
static void noinstr arm64_enter_el1_dbg(struct pt_regs *regs)
269-
{
270-
regs->lockdep_hardirqs = lockdep_hardirqs_enabled();
271-
272-
lockdep_hardirqs_off(CALLER_ADDR0);
273-
rcu_nmi_enter();
274-
275-
trace_hardirqs_off_finish();
276-
}
277-
278-
static void noinstr arm64_exit_el1_dbg(struct pt_regs *regs)
279-
{
280-
bool restore = regs->lockdep_hardirqs;
281-
282-
if (restore) {
283-
trace_hardirqs_on_prepare();
284-
lockdep_hardirqs_on_prepare(CALLER_ADDR0);
285-
}
286-
287-
rcu_nmi_exit();
288-
if (restore)
289-
lockdep_hardirqs_on(CALLER_ADDR0);
290-
}
291-
292310
static void noinstr el1_dbg(struct pt_regs *regs, unsigned long esr)
293311
{
294312
unsigned long far = read_sysreg(far_el1);
@@ -382,24 +400,6 @@ asmlinkage void noinstr el1h_64_error_handler(struct pt_regs *regs)
382400
arm64_exit_nmi(regs);
383401
}
384402

385-
asmlinkage void noinstr enter_from_user_mode(void)
386-
{
387-
lockdep_hardirqs_off(CALLER_ADDR0);
388-
CT_WARN_ON(ct_state() != CONTEXT_USER);
389-
user_exit_irqoff();
390-
trace_hardirqs_off_finish();
391-
}
392-
393-
asmlinkage void noinstr exit_to_user_mode(void)
394-
{
395-
mte_check_tfsr_exit();
396-
397-
trace_hardirqs_on_prepare();
398-
lockdep_hardirqs_on_prepare(CALLER_ADDR0);
399-
user_enter_irqoff();
400-
lockdep_hardirqs_on(CALLER_ADDR0);
401-
}
402-
403403
static void noinstr el0_da(struct pt_regs *regs, unsigned long esr)
404404
{
405405
unsigned long far = read_sysreg(far_el1);

0 commit comments

Comments
 (0)