diff options
author | Mark Brown <broonie@kernel.org> | 2023-03-07 17:37:15 +0000 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2023-04-21 13:46:20 +0100 |
commit | d071cefdcca39fdbcdd4bf36868448820dbac34b (patch) | |
tree | 9b8696dbfcd7f2c509ca1af1fa7d58873038c603 /arch | |
parent | 4c181e3d352e9280c84fb4b4c7a8940ce005374e (diff) | |
download | linux-stable-d071cefdcca39fdbcdd4bf36868448820dbac34b.tar.gz linux-stable-d071cefdcca39fdbcdd4bf36868448820dbac34b.tar.bz2 linux-stable-d071cefdcca39fdbcdd4bf36868448820dbac34b.zip |
KVM: arm64: Restructure check for SVE support in FP trap handler
We share the same handler for general floating point and SVE traps with a
check to make sure we don't handle any SVE traps if the system doesn't
have SVE support. Since we will be adding SME support and wishing to handle
that along with other FP related traps rewrite the check to be more scalable
and a bit clearer too, ensuring we don't misidentify SME traps as SVE ones.
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-2-57ba0082e9ff@kernel.org
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm64/kvm/hyp/include/hyp/switch.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h index 07d37ff88a3f..d29d2ebf9126 100644 --- a/arch/arm64/kvm/hyp/include/hyp/switch.h +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h @@ -176,9 +176,17 @@ static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code) sve_guest = vcpu_has_sve(vcpu); esr_ec = kvm_vcpu_trap_get_class(vcpu); - /* Don't handle SVE traps for non-SVE vcpus here: */ - if (!sve_guest && esr_ec != ESR_ELx_EC_FP_ASIMD) + /* Only handle traps the vCPU can support here: */ + switch (esr_ec) { + case ESR_ELx_EC_FP_ASIMD: + break; + case ESR_ELx_EC_SVE: + if (!sve_guest) + return false; + break; + default: return false; + } /* Valid trap. Switch the context: */ |