Thread (14 messages) 14 messages, 3 authors, 4d ago

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

From: Fuad Tabba <hidden>
Date: 2026-07-14 15:33:46
Also in: kvmarm, lkml

On Tue, 14 Jul 2026 at 16:19, Marc Zyngier [off-list ref] wrote:
On Tue, 14 Jul 2026 11:15:55 +0100,
Fuad Tabba [off-list ref] wrote:
quoted
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@kernel.org/ (local)

        m.

--
Without deviation from the norm, progress is not possible.
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help