[PATCH v3 24/42] KVM: arm64: Unconditionally configure fine-grain traps
Marc Zyngier
maz at kernel.org
Tue Apr 29 06:49:37 PDT 2025
On Tue, 29 Apr 2025 14:08:27 +0100,
Ben Horgan <ben.horgan at arm.com> wrote:
>
> Hi Marc,
>
> On 4/26/25 13:28, Marc Zyngier wrote:
> > From: Mark Rutland <mark.rutland at arm.com>
> >
> > ... otherwise we can inherit the host configuration if this differs from
> > the KVM configuration.
> >
> > Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> > [maz: simplified a couple of things]
> > Signed-off-by: Marc Zyngier <maz at kernel.org>
> > ---
> > arch/arm64/kvm/hyp/include/hyp/switch.h | 39 ++++++++++---------------
> > 1 file changed, 15 insertions(+), 24 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h
> > index 027d05f308f75..925a3288bd5be 100644
> > --- a/arch/arm64/kvm/hyp/include/hyp/switch.h
> > +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h
> > @@ -107,7 +107,8 @@ static inline void __activate_traps_fpsimd32(struct kvm_vcpu *vcpu)
> > [...]
> > static inline void __deactivate_traps_hfgxtr(struct kvm_vcpu
> > *vcpu)
> > {
> > struct kvm_cpu_context *hctxt = host_data_ptr(host_ctxt);
> > - struct kvm *kvm = kern_hyp_va(vcpu->kvm);
> > if (!cpus_have_final_cap(ARM64_HAS_FGT))
> > return;
> > - __deactivate_fgt(hctxt, vcpu, kvm, HFGRTR_EL2);
> > - if (cpus_have_final_cap(ARM64_WORKAROUND_AMPERE_AC03_CPU_38))
> Don't we need to continue considering the ampere errata here? Or, at
> least worth a mention in the commit message.
The FGT registers are always context switched, so whatever was saved
*before* the workaround was applied in __activate_traps_hfgxtr() is
blindly restored...
> > - write_sysreg_s(ctxt_sys_reg(hctxt, HFGWTR_EL2), SYS_HFGWTR_EL2);
... and this write always happens.
M.
--
Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list