[PATCH v6 08/33] KVM: arm64: Use accessor functions for core regs

Steffen Eiden seiden at linux.ibm.com
Tue Aug 18 02:29:24 PDT 2026


On Thu, Aug 13, 2026 at 10:56:37AM +0100, Marc Zyngier wrote:
> On Wed, 12 Aug 2026 16:36:04 +0100,
> Steffen Eiden <seiden at linux.ibm.com> wrote:
> > 
> > Instead of accessing the value directly use assessor function that
> 
> s/assessor function/accessors/
> 
> > abstract the actual location of the register values. Add a helper
> > function to reset fpsimd registers. Enable other KVM implementations to
> > reuse this code.
> 
> to reuse this code by overloading the accessors.
> 

Will change

...

> > diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> > index b01d6622b872..773f6c8e5026 100644
> > --- a/arch/arm64/kvm/guest.c
> > +++ b/arch/arm64/kvm/guest.c
> > @@ -134,19 +134,19 @@ static void *core_reg_addr(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
> >  	     KVM_REG_ARM_CORE_REG(regs.regs[30]):
> >  		off -= KVM_REG_ARM_CORE_REG(regs.mregs[0]);
> >  		off /= 2;
> > -		return &vcpu->arch.ctxt.regs.regs[off];
> > +		return &vcpu_gp_regs(vcpu)[off];
> 
> Doesn't this belong to the previous patch?
> 

My thoughts about positioning this change in this patch:

The previous patch changes the semantics of vcpu_gp_regs and just
touched the part where the old semantic of the function was used.
This is mainly done by not using vcpu_gp_regs where it was used before
as it cannot be used to access e.g. pstate anymore.

This patch then introduces and *uses* new accessor functions for
abstractions (and uses the vcpu_gp_regs abstraction where it was not
used before). 
-> The patch changes direct accesses to using accessor functions.

However, I have no strong feelings for this. If you want this in the
previous patch, I can do that.

	Steffen




More information about the linux-arm-kernel mailing list