ANDROID: KVM: arm64: Don't save/flush fpsimd/sve state at host in pKVM
pKVM saves and restores the host fpsimd/sve state at the hypervisor. No
need to duplicate the effort and also save it at the host.
Bug: 411040189
Change-Id: If0a5a8d2eb2e45eade3b29cecf43d9f129ed314a
Signed-off-by: Fuad Tabba <tabba@google.com>
diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c
index c4282c7..d8a8c29 100644
--- a/arch/arm64/kvm/fpsimd.c
+++ b/arch/arm64/kvm/fpsimd.c
@@ -62,8 +62,10 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)
* When the host may use SME, fpsimd_save_and_flush_cpu_state() ensures
* that PSTATE.{SM,ZA} == {0,0}.
*/
- fpsimd_save_and_flush_cpu_state();
- vcpu->arch.fp_state = FP_STATE_FREE;
+ if (!is_protected_kvm_enabled()) {
+ fpsimd_save_and_flush_cpu_state();
+ vcpu->arch.fp_state = FP_STATE_FREE;
+ }
}
/*