From 0ecda8d5ae896b229f13bfe73ffa3a7fc81cc550 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Tue, 28 Dec 2021 17:44:57 -0500 Subject: [PATCH] x86: Do not attempt to calibrate the LAPIC timer if no APIC is present Reported and tested by: Michael Butler Reviewed by: jhb, kib Fixes: 62d09b46ad75 ("x86: Defer LAPIC calibration until after timecounters are available") MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33669 --- sys/x86/x86/local_apic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 1264eeaaf7b..23b780b121e 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -913,6 +913,12 @@ native_lapic_calibrate_timer(void) struct lapic *la; register_t intr; +#ifdef DEV_ATPIC + /* Fail if the local APIC is not present. */ + if (!x2apic_mode && lapic_map == NULL) + return; +#endif + intr = intr_disable(); la = &lapics[lapic_id()];