summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2023-03-07 18:37:14 +0100
committerMarc Zyngier <maz@kernel.org>2023-04-21 14:46:20 +0200
commit4c181e3d352e9280c84fb4b4c7a8940ce005374e (patch)
treea6b4102317e80bc45c1447383897aa09201784a1 /arch/arm64/kvm
parentKVM: arm64: Fix repeated words in comments (diff)
downloadlinux-4c181e3d352e9280c84fb4b4c7a8940ce005374e.tar.xz
linux-4c181e3d352e9280c84fb4b4c7a8940ce005374e.zip
KVM: arm64: Document check for TIF_FOREIGN_FPSTATE
In kvm_arch_vcpu_load_fp() we unconditionally set the current FP state to FP_STATE_HOST_OWNED, this will be overridden to FP_STATE_NONE if TIF_FOREIGN_FPSTATE is set but the check is deferred until kvm_arch_vcpu_ctxflush_fp() where we are no longer preemptable. Add a comment to this effect to help avoid people being concerned about the lack of a check and discover where the check is done. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20221214-kvm-arm64-sme-context-switch-v2-1-57ba0082e9ff@kernel.org
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r--arch/arm64/kvm/fpsimd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c
index 1279949599b5..3fd0ce6a3500 100644
--- a/arch/arm64/kvm/fpsimd.c
+++ b/arch/arm64/kvm/fpsimd.c
@@ -81,6 +81,11 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)
fpsimd_kvm_prepare();
+ /*
+ * We will check TIF_FOREIGN_FPSTATE just before entering the
+ * guest in kvm_arch_vcpu_ctxflush_fp() and override this to
+ * FP_STATE_FREE if the flag set.
+ */
vcpu->arch.fp_state = FP_STATE_HOST_OWNED;
vcpu_clear_flag(vcpu, HOST_SVE_ENABLED);