[PATCH v3 12/18] KVM: arm64: Prevent host PC adjustments for protected vCPUs
Fuad Tabba
fuad.tabba at linux.dev
Tue Sep 15 04:19:26 PDT 2026
On Tue, 15 Sept 2026 at 12:02, Marc Zyngier <maz at kernel.org> wrote:
>
> On Mon, 14 Sep 2026 15:43:16 +0100,
> Fuad Tabba <fuad.tabba at linux.dev> wrote:
> >
> > > > + hyp_vcpu = pkvm_get_loaded_hyp_vcpu();
> > > > + if (!hyp_vcpu || hyp_vcpu->host_vcpu != vcpu)
> > >
> > > Under which circumstances do we get hyp_vcpu->host_vcpu != vcpu?
> >
> > When EL2 calls __kvm_adjust_pc() on the hyp vCPU itself:
> > __kvm_vcpu_run() at guest entry and inject_sync64() in nvhe/sys_regs.c
> > both pass &hyp_vcpu->vcpu. There the vCPU passed is the one to adjust,
> > so it's returned as is.
>
> If this is the sole case, why not check for '&hyp_cpu->vcpu == vcpu'
> instead of this odd inequality?
That's the only case. The inequality is the same test as in
__get_host_hyp_vcpus(), but &hyp_vcpu->vcpu == vcpu is clearer here.
I'll change it if there's a v4, or feel free to fold it in if you're
applying v3 as is.
Cheers,
/fuad
>
> Thanks,
>
> M.
>
> --
> Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list