Skip to content

Commit

Permalink
x86/of: Fix the APIC address registration
Browse files Browse the repository at this point in the history
The device tree APIC parser tries to force-enable the local APIC when it is
not set in CPUID. apic_force_enable() registers the boot CPU apic on
success.

If that succeeds then dtb_lapic_setup() registers the local APIC again
eventually with a different address.

Rewrite the code so that it only registers it once.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Tested-by: Juergen Gross <jgross@suse.com> # Xen PV (dom0 and unpriv. guest)
  • Loading branch information
Thomas Gleixner authored and Dave Hansen committed Aug 9, 2023
1 parent 004671e commit 2906a67
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions arch/x86/kernel/devicetree.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,15 @@ static void __init dtb_lapic_setup(void)

/* Did the boot loader setup the local APIC ? */
if (!boot_cpu_has(X86_FEATURE_APIC)) {
/* Try force enabling, which registers the APIC address */
if (apic_force_enable(lapic_addr))
return;
}
smp_found_config = 1;
if (of_property_read_bool(dn, "intel,virtual-wire-mode")) {
pr_info("Virtual Wire compatibility mode.\n");
pic_mode = 0;
} else {
pr_info("IMCR and PIC compatibility mode.\n");
pic_mode = 1;
register_lapic_address(lapic_addr);
}

register_lapic_address(lapic_addr);
smp_found_config = 1;
pic_mode = !of_property_read_bool(dn, "intel,virtual-wire-mode");
pr_info("%s compatibility mode.\n", pic_mode ? "IMCR and PIC" : "Virtual Wire");
}

#endif /* CONFIG_X86_LOCAL_APIC */
Expand Down

0 comments on commit 2906a67

Please sign in to comment.