[PATCH v1 10/12] KVM: arm64: Calculate cptr_el2 traps on activating traps

Quentin Perret qperret at google.com
Thu Nov 21 02:10:15 PST 2024


On Thursday 21 Nov 2024 at 09:41:46 (+0000), Fuad Tabba wrote:
> Hi Quentin,
> 
> On Thu, 21 Nov 2024 at 08:32, Quentin Perret <qperret at google.com> wrote:
> >
> > Hi Fuad,
> >
> > On Wednesday 20 Nov 2024 at 10:52:52 (+0000), Fuad Tabba wrote:
> > > -static void pvm_init_traps_cptr(struct kvm_vcpu *vcpu)
> > > -{
> > > -     struct kvm *kvm = vcpu->kvm;
> > > -     u64 val = vcpu->arch.cptr_el2;
> > > -
> > > -     if (!has_hvhe()) {
> > > -             val |= CPTR_NVHE_EL2_RES1;
> > > -             val &= ~(CPTR_NVHE_EL2_RES0);
> > > -     }
> >
> > To be on the safe side, should keep the RES1 stuff for nVHE?
> 
> Sure. My thinking in removing this is that, once consolidated, it
> would be easy to spot whether we could be clearing the wrong bit. But
> I could reintroduce this when I respin.

Actually, my bad, while checking how this worked for nVHE prior to your
patch I've realised kvm_get_reset_cptr_el2() was already setting those
bits correctly, which is arguably the right place to do it.

Thanks,
Quentin



More information about the linux-arm-kernel mailing list