Re: [PATCH RESEND v4 2/3] x86/apic: Introduce a variable to track the number of EILVT registers
From: Naveen N Rao
Date: Thu Sep 24 2026 - 08:02:29 EST
On Mon, Sep 21, 2026 at 10:36:10PM -0700, Borislav Petkov wrote:
> On Thu, Sep 03, 2026 at 02:58:40PM +0530, Naveen N Rao (AMD) wrote:
> > diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> > index 90025451ace2..c990f403ec7f 100644
> > --- a/arch/x86/kernel/apic/apic.c
> > +++ b/arch/x86/kernel/apic/apic.c
> > @@ -410,6 +410,15 @@ int setup_APIC_eilvt(u8 offset, u8 vector, u8 msg_type, u8 mask)
> > }
> > EXPORT_SYMBOL_GPL(setup_APIC_eilvt);
> >
> > +static __init void init_eilvt(void)
> > +{
> > + if (cpu_feature_enabled(X86_FEATURE_EXTAPIC))
> > + apic->eilvt_regs_count = APIC_EFEAT_XLC(apic_read(APIC_EFEAT));
> > +
> > + if (!apic->eilvt_regs_count && boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
> > + apic->eilvt_regs_count = APIC_EILVT_NR_AMD_10H;
>
> Why not simply:
>
> if (cpu_feature_enabled(X86_FEATURE_EXTAPIC))
> apic->eilvt_regs_count = APIC_EFEAT_XLC(apic_read(APIC_EFEAT));
> else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
> apic->eilvt_regs_count = APIC_EILVT_NR_AMD_10H;
Cause I didn't want to risk changing the current default EILVT register
count for some ~2 decade old processor that may be advertising
X86_FEATURE_EXTAPIC but encoding a count of zero in APIC_EFEAT.
I did look up BKDGs for some of the older processors, but couldn't work
out if this ever was a problem. This was discussed here:
https://lore.kernel.org/all/agckJQQuLsARA4ul@blrnaveerao1/
> And now I see the big picture - you have a single logical patch - add
> eilvt_regs_count - and the rest of the code is reorg and cleanup.
Isn't that the case for most patch series? ;)
>
> So why are there three patches?
Right, the split reflects how I viewed the changes, and to hopefully
simplify the review. Looks like I got the split wrong as it looks to
have been counter-productive here.
Thanks,
- Naveen