Re: [PATCH v5 2/8] KVM: arm64: Make vcpu_{read,write}_sys_reg available to HYP code
From: Fuad Tabba
Date: Tue Jul 14 2026 - 11:34:09 EST
On Tue, 14 Jul 2026 at 16:19, Marc Zyngier <maz@xxxxxxxxxx> wrote:
>
> On Tue, 14 Jul 2026 11:15:55 +0100,
> Fuad Tabba <fuad.tabba@xxxxxxxxx> wrote:
> >
> > The vcpu_{read,write}_sys_reg() accessors are only valid on a VHE host,
> > so helpers built on them such as kvm_vcpu_set_be()/kvm_vcpu_is_be()
> > cannot be shared with hyp code. exception.c already wraps them in local
> > helpers that pick the host- or hyp-side accessor via has_vhe().
> >
> > Rename the host-only implementations to __vcpu_{read,write}_sysreg_vhe()
>
> I'm a bit puzzled by this. There is nothing that makes these functions
> VHE-specific. Look at where they are called from: plenty of non-VHE
> uses. These helpers are the canonical accessors for any system
> register, and they don't cater for any particular mode.
I might have misunderstood what Oliver asked me to do here [1]:
> Can you instead name the wrappers vcpu_{read,write}_sys_reg() and rename
> the current implementations, like __vcpu_{read,write}_sysreg_vhe()?
Since they're only used and gated by has_vhe(), they're vhe-specific?
Cheers,
/fuad
[1] https://lore.kernel.org/all/alWDI7uj9YFedXET@xxxxxxxxxx/
>
> m.
>
> --
> Without deviation from the norm, progress is not possible.