Re: [PATCH v7 2/8] KVM: arm64: Make vcpu_{read,write}_sys_reg available to HYP code

Fuad Tabba <[email protected]>
Newsgroups dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <CA+EHjTzjb+LX-+C=DkXXkVLiradjHqQN8H_df1hUVk6aoT8+vg@mail.gmail.com>
Hi Joey,

On Wed, 29 Jul 2026 at 14:52, Joey Gouly <[email protected]> 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/[email protected]/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.