Skip to content

Commit 2906a67

Browse files
KAGA-KOKOhansendc
authored andcommitted
x86/of: Fix the APIC address registration
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 <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Sohil Mehta <[email protected]> Tested-by: Juergen Gross <[email protected]> # Xen PV (dom0 and unpriv. guest)
1 parent 004671e commit 2906a67

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

arch/x86/kernel/devicetree.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,15 @@ static void __init dtb_lapic_setup(void)
157157

158158
/* Did the boot loader setup the local APIC ? */
159159
if (!boot_cpu_has(X86_FEATURE_APIC)) {
160+
/* Try force enabling, which registers the APIC address */
160161
if (apic_force_enable(lapic_addr))
161162
return;
162-
}
163-
smp_found_config = 1;
164-
if (of_property_read_bool(dn, "intel,virtual-wire-mode")) {
165-
pr_info("Virtual Wire compatibility mode.\n");
166-
pic_mode = 0;
167163
} else {
168-
pr_info("IMCR and PIC compatibility mode.\n");
169-
pic_mode = 1;
164+
register_lapic_address(lapic_addr);
170165
}
171-
172-
register_lapic_address(lapic_addr);
166+
smp_found_config = 1;
167+
pic_mode = !of_property_read_bool(dn, "intel,virtual-wire-mode");
168+
pr_info("%s compatibility mode.\n", pic_mode ? "IMCR and PIC" : "Virtual Wire");
173169
}
174170

175171
#endif /* CONFIG_X86_LOCAL_APIC */

0 commit comments

Comments
 (0)