From 24534b3511828c66215fdf1533d77a7bf2e1fdb2 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Thu, 29 Mar 2018 15:13:23 +0200 Subject: arm64: assembler: add macros to conditionally yield the NEON under PREEMPT Add support macros to conditionally yield the NEON (and thus the CPU) that may be called from the assembler code. In some cases, yielding the NEON involves saving and restoring a non trivial amount of context (especially in the CRC folding algorithms), and so the macro is split into three, and the code in between is only executed when the yield path is taken, allowing the context to be preserved. The third macro takes an optional label argument that marks the resume path after a yield has been performed. Signed-off-by: Ard Biesheuvel Reviewed-by: Dave Martin Signed-off-by: Will Deacon --- arch/arm64/include/asm/assembler.h | 73 ++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/asm-offsets.c | 3 ++ 2 files changed, 76 insertions(+) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index fe2ff3efe1f0..0bcc98dbba56 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -628,4 +628,77 @@ USER(\label, ic ivau, \tmp2) // invalidate I line PoU .endif .endm +/* + * Check whether to yield to another runnable task from kernel mode NEON code + * (which runs with preemption disabled). + * + * if_will_cond_yield_neon + * // pre-yield patchup code + * do_cond_yield_neon + * // post-yield patchup code + * endif_yield_neon