From bd941bcc683c7723a8db5439fb62ef6b1cdad3d9 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Fri, 11 Mar 2022 21:29:06 -0500 Subject: [PATCH] arm64: implement CONFIG_IRQ_OFFLOAD_NESTED It can easily be done now, so why not. Suffice to increment the nested count like with actual IRQs. Signed-off-by: Nicolas Pitre --- arch/Kconfig | 1 + arch/arm64/core/switch.S | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index d12131ecbef..ea5a7bf6ec2 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -46,6 +46,7 @@ config ARM64 select ARCH_HAS_THREAD_LOCAL_STORAGE select USE_SWITCH select USE_SWITCH_SUPPORTED + select IRQ_OFFLOAD_NESTED if IRQ_OFFLOAD help ARM64 (AArch64) architecture diff --git a/arch/arm64/core/switch.S b/arch/arm64/core/switch.S index 310279dafcd..694bed2d9d4 100644 --- a/arch/arm64/core/switch.S +++ b/arch/arm64/core/switch.S @@ -154,16 +154,19 @@ offload: */ ldp x1, x0, [sp, ___esf_t_x0_x1_OFFSET] - /* _current_cpu->nested=1, to be checked by arch_is_in_isr() */ - get_cpu x2 - mov w3, #1 - str w3, [x2, #___cpu_t_nested_OFFSET] - /* switch to IRQ stack and save current sp on it. */ + /* ++_current_cpu->nested to be checked by arch_is_in_isr() */ + get_cpu x2 + ldr w3, [x2, #___cpu_t_nested_OFFSET] + add w4, w3, #1 + str w4, [x2, #___cpu_t_nested_OFFSET] + + /* If not nested: switch to IRQ stack and save current sp on it. */ + cbnz w3, 1f ldr x3, [x2, #___cpu_t_irq_stack_OFFSET] mov x4, sp mov sp, x3 str x4, [sp, #-16]! - +1: /* Execute provided routine (argument is in x0 already). */ blr x1