]> asedeno.scripts.mit.edu Git - linux.git/commit
arm64/sve: Preserve SVE registers around EFI runtime service calls
authorDave Martin <Dave.Martin@arm.com>
Tue, 31 Oct 2017 15:51:12 +0000 (15:51 +0000)
committerWill Deacon <will.deacon@arm.com>
Fri, 3 Nov 2017 15:24:18 +0000 (15:24 +0000)
commitfdfa976cae5cbd46aa4b4f9e554a93c9f8b35c62
treea567030512f04e995ecb7627b39517033fef61e3
parent1bd3f93641ec710015fcb3badca07dacd58c91d3
arm64/sve: Preserve SVE registers around EFI runtime service calls

The EFI runtime services ABI allows EFI to make free use of the
FPSIMD registers during EFI runtime service calls, subject to the
callee-save requirements of the AArch64 procedure call standard.

However, the SVE architecture allows upper bits of the SVE vector
registers to be zeroed as a side-effect of FPSIMD V-register
writes.  This means that the SVE vector registers must be saved in
their entirety in order to avoid data loss: non-SVE-aware EFI
implementations cannot restore them correctly.

The non-IRQ case is already handled gracefully by
kernel_neon_begin().  For the IRQ case, this patch allocates a
suitable per-CPU stash buffer for the full SVE register state and
uses it to preserve the affected registers around EFI calls.  It is
currently unclear how the EFI runtime services ABI will be
clarified with respect to SVE, so it safest to assume that the
predicate registers and FFR must be saved and restored too.

No attempt is made to restore the restore the vector length after
a call, for now.  It is deemed rather insane for EFI to change it,
and contemporary EFI implementations certainly won't.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/fpsimd.c