Re: [PATCH v3 5/6] KVM: SVM: Move global "avic" variable to avic.c

From: Naveen N Rao

Date: Fri Sep 19 2025 - 14:28:45 EST


On Fri, Sep 19, 2025 at 07:44:29AM -0700, Sean Christopherson wrote:
> On Fri, Sep 19, 2025, Naveen N Rao wrote:
> > On Thu, Sep 18, 2025 at 05:21:35PM -0700, Sean Christopherson wrote:
> > > @@ -1141,15 +1149,9 @@ void avic_vcpu_unblocking(struct kvm_vcpu *vcpu)
> > > avic_vcpu_load(vcpu, vcpu->cpu);
> > > }
> > >
> > > -/*
> > > - * Note:
> > > - * - The module param avic enable both xAPIC and x2APIC mode.
> > > - * - Hypervisor can support both xAVIC and x2AVIC in the same guest.
> > > - * - The mode can be switched at run-time.
> > > - */
> > > -bool __init avic_hardware_setup(struct kvm_x86_ops *svm_ops)
> > > +static bool __init avic_want_avic_enable(void)
> >
> > Maybe avic_can_enable()?
>
> That was actualy one of my first names, but I didn't want to use "can" because
> (to me at least) that doesn't capture that the helper is incorporating input from
> the user, i.e. that it's also checking what the user "wants".

Makes sense.

>
> I agree the name isn't great. Does avic_want_avic_enabled() read any better?

Yes, though I think avic_want_enabled() suffices. But, I'm ok if you
want it to be explicit.


- Naveen