Re: UP APIC reenabling vs. cpu type detection ordering

From: H. Peter Anvin (
Date: Wed Feb 07 2001 - 12:01:28 EST

Petr Vandrovec wrote:
> Hi,
> Mikael Pettersson pointed to me that current kernel code should not
> reenable local APIC on AMD K7, as it tests boot_cpu_data.x86_vendor.
> But boot_cpu_data.x86_vendor is uninitialized (or contains wrong
> value) when detect_init_APIC is invoked.
> As side effect I can confirm that APIC reenabling code works also on
> my AMD K7.
> Best regards,
> Petr Vandrovec
> P.S.: I'm getting 'spurious 8259A interrupt: IRQ7' few seconds after boot.
> It does not cause any harm AFAIS.
> int detect_init_APIC (void)
> {
> u32 h, l, dummy, features;
> if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
> printk("No APIC support for non-Intel processors.\n");
> return -1;
> }
> ...
> rdmsr(MSR_IA32_APICBASE, l, h);
> if (!(l & MSR_IA32_APICBASE_ENABLE)) {
> printk("Local APIC disabled by BIOS -- reenabling.\n");
> wrmsr(MSR_IA32_APICBASE, l, h);
> }
> }

Why is the test there in the first place? If the machine has an APIC, it
should be able to use it. Presumably no other CPU uses the same MSR
address (am I wrong?) for anything else -- if so, it should be able to
poke it as long as the kernel intercepts the #GP(0) that may come if it
is not enabled. The Linux kernel has pretty sophisticated support for
trapping faults.

In other words, I'd like to see a reason for making any vendor-specific
determinations, and if so, they should ideally be centralized to the CPU
feature-determination code.


<> at work, <> in private!
"Unix gives you enough rope to shoot yourself in the foot."
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Wed Feb 07 2001 - 21:00:27 EST