]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: arm64: Remove host FPSIMD saving for non-protected KVM
authorMark Rutland <mark.rutland@arm.com>
Tue, 8 Apr 2025 18:10:03 +0000 (19:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:44:16 +0000 (07:44 +0200)
[ Upstream commit 8eca7f6d5100b6997df4f532090bc3f7e0203bef ]

Now that the host eagerly saves its own FPSIMD/SVE/SME state,
non-protected KVM never needs to save the host FPSIMD/SVE/SME state,
and the code to do this is never used. Protected KVM still needs to
save/restore the host FPSIMD/SVE state to avoid leaking guest state to
the host (and to avoid revealing to the host whether the guest used
FPSIMD/SVE/SME), and that code needs to be retained.

Remove the unused code and data structures.

To avoid the need for a stub copy of kvm_hyp_save_fpsimd_host() in the
VHE hyp code, the nVHE/hVHE version is moved into the shared switch
header, where it is only invoked when KVM is in protected mode.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Tested-by: Mark Brown <broonie@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Fuad Tabba <tabba@google.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20250210195226.1215254-3-mark.rutland@arm.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/fpsimd.c
arch/arm64/kvm/hyp/include/hyp/switch.h

index ecae31b0dab32479aa6a0739585c0d1d0c981a2c..06e8d4645ecd4b216851feaee7b970ed1adceb5c 100644 (file)
@@ -333,7 +333,6 @@ struct kvm_vcpu_arch {
        struct kvm_guest_debug_arch external_debug_state;
 
        struct thread_info *host_thread_info;   /* hyp VA */
-       struct user_fpsimd_state *host_fpsimd_state;    /* hyp VA */
 
        struct {
                /* {Break,watch}point registers */
index 2afa2521bce133153abcd2a322d365a018f35a15..1ef9d6cb91ee5351f8cfae0411e0d34c5461bdd0 100644 (file)
@@ -55,7 +55,6 @@ int kvm_arch_vcpu_run_map_fp(struct kvm_vcpu *vcpu)
        }
 
        vcpu->arch.host_thread_info = kern_hyp_va(ti);
-       vcpu->arch.host_fpsimd_state = kern_hyp_va(fpsimd);
 error:
        return ret;
 }
index 269ec358721003348f38248fb4ac9e84dbfcd770..cc102e46b0e2563b35e6a912d8bb8f23a753b9e3 100644 (file)
@@ -251,11 +251,7 @@ static inline bool __hyp_handle_fpsimd(struct kvm_vcpu *vcpu)
        }
        isb();
 
-       if (vcpu->arch.flags & KVM_ARM64_FP_HOST) {
-               __fpsimd_save_state(vcpu->arch.host_fpsimd_state);
-               vcpu->arch.flags &= ~KVM_ARM64_FP_HOST;
-       }
-
+       /* Restore the guest state */
        if (sve_guest)
                __hyp_sve_restore_guest(vcpu);
        else