aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-12-28 22:42:12 +0000
committerMark Johnston <markj@FreeBSD.org>2021-12-28 22:47:49 +0000
commitdeca0138dc659747c9edd4648690cdfdb01f58e8 (patch)
tree80c50be649d63b399964aa7f1cafa53e94274565
parent254e4e5b77d7788c46333ae35d5e9f347e22c746 (diff)
downloadsrc-deca0138dc659747c9edd4648690cdfdb01f58e8.tar.gz
src-deca0138dc659747c9edd4648690cdfdb01f58e8.zip
x86: Check for APIC presence only if DEV_ATPIC is defined
We only attempt to gracefully handle absence of an APIC if "device atpic" is defined in the kernel configuration. Suggested by: kib Reviewed by: jhb, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/x86/x86/local_apic.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index ac3dfa4ca1d3..1264eeaaf7b8 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -932,9 +932,11 @@ native_lapic_enable_pmc(void)
#ifdef HWPMC_HOOKS
u_int32_t maxlvt;
+#ifdef DEV_ATPIC
/* Fail if the local APIC is not present. */
if (!x2apic_mode && lapic_map == NULL)
return (0);
+#endif
/* Fail if the PMC LVT is not present. */
maxlvt = (lapic_read32(LAPIC_VERSION) & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
@@ -971,9 +973,11 @@ native_lapic_disable_pmc(void)
#ifdef HWPMC_HOOKS
u_int32_t maxlvt;
+#ifdef DEV_ATPIC
/* Fail if the local APIC is not present. */
if (!x2apic_mode && lapic_map == NULL)
return;
+#endif
/* Fail if the PMC LVT is not present. */
maxlvt = (lapic_read32(LAPIC_VERSION) & APIC_VER_MAXLVT) >> MAXLVTSHIFT;