Re: [PATCH v4 03/30] KVM: x86: Rename __{g,s}et_sregs2() => kvm_x86_vcpu_ioctl_{g,s}et_sregs2()

From: Sean Christopherson

Date: Mon Jun 15 2026 - 12:05:41 EST


On Mon, Jun 15, 2026, Binbin Wu wrote:
> On 6/13/2026 8:03 AM, Sean Christopherson wrote:
> > Rename the KVM_{G,S}ET_SREGS2 helpers in anticipation of moving them out of
> > x86.c (while leaving the ioctl dispatch behind). Having globally visible
> > APIs named __{g,s}et_sregs2() would be "fine", but ugly, given that
> > __{g,s}et_sregs() will NOT be globally visible. As a bonus, this makes it
> > a bit more obvious that the helpers implement newer versions of
> > kvm_arch_vcpu_ioctl_set_sregs().
> >
> > No functional change intended.
> >
> > Cc: Yosry Ahmed <yosry@xxxxxxxxxx>
> > Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> > ---
> > arch/x86/kvm/x86.c | 16 ++++++++++------
> > 1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index 0f48cd630c32..0fa8a9e3b8b2 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -133,8 +133,10 @@ static void __kvm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags);
> > static void store_regs(struct kvm_vcpu *vcpu);
> > static int sync_regs(struct kvm_vcpu *vcpu);
> >
> > -static int __set_sregs2(struct kvm_vcpu *vcpu, struct kvm_sregs2 *sregs2);
> > -static void __get_sregs2(struct kvm_vcpu *vcpu, struct kvm_sregs2 *sregs2);
> > +static int kvm_x86_vcpu_ioctl_set_sregs2(struct kvm_vcpu *vcpu,
> > + struct kvm_sregs2 *sregs2);
> > +static void kvm_x86_vcpu_ioctl_get_sregs2(struct kvm_vcpu *vcpu,
> > + struct kvm_sregs2 *sregs2);
> >
>
> Existing code uses the pattern kvm_vcpu_ioctl_x86_xxx, is it better to
> align the pattern?

Yeah, good call, I'll use kvm_vcpu_ioctl_x86_xxx. In find the effective namespace
to be a bit odd, but that's not a good reason for these to be different.