arm64: neon: Allow EFI runtime services to use FPSIMD in irq context
authorDave Martin <Dave.Martin@arm.com>
Thu, 3 Aug 2017 16:23:22 +0000 (17:23 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 4 Aug 2017 14:00:54 +0000 (15:00 +0100)
commit4328825d4fdc185d365d8e858cace8b324198a70
tree1f4b0a11ca937b4d1f2f75906ba1886337d4e3f1
parent504641859e5c616210c0894149e09fb6928e398f
arm64: neon: Allow EFI runtime services to use FPSIMD in irq context

In order to be able to cope with kernel-mode NEON being unavailable
in hardirq/nmi context and non-nestable, we need special handling
for EFI runtime service calls that may be made during an interrupt
that interrupted a kernel_neon_begin()..._end() block.  This will
occur if the kernel tries to write diagnostic data to EFI
persistent storage during a panic triggered by an NMI for example.

EFI runtime services specify an ABI that clobbers the FPSIMD state,
rather than being able to use it optionally as an accelerator.
This means that EFI is really a special case and can be handled
specially.

To enable EFI calls from interrupts, this patch creates dedicated
__efi_fpsimd_{begin,end}() helpers solely for this purpose, which
save/restore to a separate percpu buffer if called in a context
where kernel_neon_begin() is not usable.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/efi.h
arch/arm64/include/asm/fpsimd.h
arch/arm64/kernel/fpsimd.c