Re: [PATCH v7 2/8] KVM: arm64: Make vcpu_{read,write}_sys_reg available to HYP code
From: Fuad Tabba
Date: Wed Jul 29 2026 - 11:17:03 EST
Hi Joey,
On Wed, 29 Jul 2026 at 14:52, Joey Gouly <joey.gouly@xxxxxxx> wrote:
...
> > +/* In nVHE hyp code, registers are always in memory: use the raw accessors. */
> > +#if defined(__KVM_NVHE_HYPERVISOR__)
> > +#define vcpu_read_sys_reg(v, r) __vcpu_sys_reg(v, r)
> > +#define vcpu_write_sys_reg(v, x, r) __vcpu_assign_sys_reg(v, r, x)
> > +#endif
> > +
>
> Does this make sense in arch/arm64/include/asm/kvm_host.h instead? Next
> to the definitions of __vcpu_sys_reg() etc.
It could go in kvm_host.h, but not next to __vcpu_sys_reg() as
suggested: the redirect has to come after the
vcpu_{read,write}_sys_reg() prototypes it overrides, or the nVHE
preprocessor expands the prototypes themselves. A placement that
builds has to sit below those prototypes, not next to the raw
accessors, so it wouldn't group with them the way you're suggesting
anyway.
It's currently in kvm_emulate.h, after those prototypes, which is
where Marc suggested putting it when he moved the patch off the
earlier rename [1]. I'd prefer to keep it there.
Cheers,
/fuad
[1] https://lore.kernel.org/all/86h5m1o79h.wl-maz@xxxxxxxxxx/