[PATCH 02/18] KVM: arm64: Don't override FFR save/restore argument

Vladimir Murzin vladimir.murzin at arm.com
Wed May 27 03:16:01 PDT 2026


On 5/21/26 14:25, Mark Rutland wrote:
> The __sve_save_state() and __sve_restore_state() functions take a
> parameter describing whether to save/restore the FFR, but both functions
> silently override this with '1'. This has always been benign (and
> callers have all passed 'true' since the parameter was introduced), but
> clearly this is not intentional.
> 
> Historically, the functions always saved/restored the FFR, and there was
> no parameter to control this.
> 
> In v5.16, the sve_save and sve_load assembly macros used by
> __sve_save_state() and __sve_restore_state() were changed to make
> saving/restoring FFR optional. The implementations of __sve_save_state()
> and __sve_restore_state() were changed to pass '1' to their respective
> macros, and the prototypes of __sve_save_state() and
> __sve_restore_state() were unchanged. See commit:
> 
>   9f5848665788 ("arm64/sve: Make access to FFR optional")
> 
> In v6.10, the prototypes of __sve_save_state() and __sve_restore_state()
> were changed to add 'save_ffr' and 'restore_ffr' parameters
> respectively, but the implementations were not changed to stop passing 1
> to their respective macros. All callers were changed to pass 'true' to
> __sve_save_state() and __sve_restore_state(). See commit:
> 
>   45f4ea9bcfe9 ("KVM: arm64: Fix prototype for __sve_save_state/__sve_restore_state")
> 
> This is all benign, but clearly unintentional, and it gets in the way of
> cleaning up the FPSIMD/SVE/SME code. Remove the unnecessary overriding.
> 
> Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Fuad Tabba <tabba at google.com>
> Cc: James Morse <james.morse at arm.com>
> Cc: Marc Zyngier <maz at kernel.org>
> Cc: Mark Brown <broonie at kernel.org>
> Cc: Oliver Upton <oupton at kernel.org>
> Cc: Will Deacon <will at kernel.org>
> ---
>  arch/arm64/kvm/hyp/fpsimd.S | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/arm64/kvm/hyp/fpsimd.S b/arch/arm64/kvm/hyp/fpsimd.S
> index e950875e31cee..6e16cbfc5df27 100644
> --- a/arch/arm64/kvm/hyp/fpsimd.S
> +++ b/arch/arm64/kvm/hyp/fpsimd.S
> @@ -21,13 +21,11 @@ SYM_FUNC_START(__fpsimd_restore_state)
>  SYM_FUNC_END(__fpsimd_restore_state)
>  
>  SYM_FUNC_START(__sve_restore_state)
> -	mov	x2, #1
>  	sve_load 0, x1, x2, 3
>  	ret
>  SYM_FUNC_END(__sve_restore_state)
>  
>  SYM_FUNC_START(__sve_save_state)
> -	mov	x2, #1
>  	sve_save 0, x1, x2, 3
>  	ret
>  SYM_FUNC_END(__sve_save_state)
> -- 2.30.2
> 

FWIW,

Reviewed-by: Vladimir Murzin <vladimir.murzin at arm.com>



More information about the linux-arm-kernel mailing list