[PATCH v1 10/12] KVM: arm64: Calculate cptr_el2 traps on activating traps
Fuad Tabba
tabba at google.com
Thu Nov 21 05:30:27 PST 2024
Hi Quentin,
On Thu, 21 Nov 2024 at 10:10, Quentin Perret <qperret at google.com> wrote:
>
> 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.
Actually, _my_ bad :) This patch is still not quite right,
kvm_get_reset_cptr_el2()
gets the reset value for the host, not for the guest, which the code
in this patch just works around. I'll respin this before the end of
the week, with a fix for this.
Cheers,
/fuad
>
> Thanks,
> Quentin
More information about the linux-arm-kernel
mailing list