From 0fe7b9f2bcdf754c483399c841e5f0ec71e53ef3 Mon Sep 17 00:00:00 2001 From: Olivier Deprez Date: Tue, 11 Oct 2022 15:38:27 +0200 Subject: feat: pass SMCCCv1.3 SVE hint bit to dispatchers SMCCCv1.3 introduces the SVE hint bit added to the SMC FID (bit 16) denoting that the world issuing an SMC doesn't expect the callee to preserve the SVE state (FFR, predicates, Zn vector bits greater than 127). Update the generic SMC handler to copy the SVE hint bit state to SMC flags and mask out the bit by default for the services called by the standard dispatcher. It is permitted by the SMCCC standard to ignore the bit as long as the SVE state is preserved. In any case a callee must preserve the NEON state (FPCR/FPSR, Vn 128b vectors) whichever the SVE hint bit state. Signed-off-by: Olivier Deprez Change-Id: I2b163ed83dc311b8f81f96b23c942829ae9fa1b5 --- bl31/aarch64/runtime_exceptions.S | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'bl31') diff --git a/bl31/aarch64/runtime_exceptions.S b/bl31/aarch64/runtime_exceptions.S index bf5bd8d8d..028355396 100644 --- a/bl31/aarch64/runtime_exceptions.S +++ b/bl31/aarch64/runtime_exceptions.S @@ -512,7 +512,7 @@ smc_handler64: /* * Shift copied SCR_EL3.NSE bit by 5 to create space for - * SCR_EL3.NS bit. Bit 5 of the flag correspondes to + * SCR_EL3.NS bit. Bit 5 of the flag corresponds to * the SCR_EL3.NSE bit. */ lsl x7, x7, #5 @@ -521,6 +521,16 @@ smc_handler64: /* Copy SCR_EL3.NS bit to the flag to indicate caller's security */ bfi x7, x18, #0, #1 + /* + * Per SMCCCv1.3 a caller can set the SVE hint bit in the SMC FID + * passed through x0. Copy the SVE hint bit to flags and mask the + * bit in smc_fid passed to the standard service dispatcher. + * A service/dispatcher can retrieve the SVE hint bit state from + * flags using the appropriate helper. + */ + bfi x7, x0, #FUNCID_SVE_HINT_SHIFT, #FUNCID_SVE_HINT_MASK + bic x0, x0, #(FUNCID_SVE_HINT_MASK << FUNCID_SVE_HINT_SHIFT) + mov sp, x12 /* Get the unique owning entity number */ -- cgit v1.2.1