Message ID | 20240730-kvm-arm64-sme-assert-v3-1-8699454e5cb8@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3] KVM: arm64: Fix confusion in documentation for pKVM SME assert | expand |
On Tue, Jul 30, 2024 at 02:33:03PM +0100, Mark Brown wrote: > As raised in the review comments for the original patch the assert and > comment added in afb91f5f8ad7 ("KVM: arm64: Ensure that SME controls are > disabled in protected mode") are bogus. The comments says that we check > that we do not have SME enabled for a pKVM guest but the assert actually > checks to see if the host has anything set in SVCR which is unrelated to > the guest features or state, regardless of if those guests are protected > or not. This check is also made in the hypervisor, it will refuse to run > a guest if the check fails, so it appears that the assert here is > intended to improve diagnostics. This hasn't had any feedback for a whole release cycle - are there any issues with the patch? > Fixes: afb91f5f8ad7 ("KVM: arm64: Ensure that SME controls are disabled in protected mode") > Reviewed-by: Fuad Tabba <tabba@google.com> > Signed-off-by: Mark Brown <broonie@kernel.org> Faud reviewed it during the prior cycle.
diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c index c53e5b14038d..8eca6b338bb2 100644 --- a/arch/arm64/kvm/fpsimd.c +++ b/arch/arm64/kvm/fpsimd.c @@ -92,11 +92,14 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) } /* - * If normal guests gain SME support, maintain this behavior for pKVM - * guests, which don't support SME. + * The pKVM hypervisor does not yet understand how to save or + * restore SME state for the host so double check that if we + * are running with pKVM we have disabled SME. The hypervisor + * enforces this when the guest is run, this check is for + * clearer diagnostics. */ - WARN_ON(is_protected_kvm_enabled() && system_supports_sme() && - read_sysreg_s(SYS_SVCR)); + WARN_ON_ONCE(is_protected_kvm_enabled() && system_supports_sme() && + read_sysreg_s(SYS_SVCR)); } /*