git: 927c85811494 - stable/13 - x86: Check for APIC presence only if DEV_ATPIC is defined
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Jul 2022 14:09:31 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=927c85811494679b75f8c9c3f570888bf972b53d
commit 927c85811494679b75f8c9c3f570888bf972b53d
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-12-28 22:42:12 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-07-19 14:03:15 +0000
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
Sponsored by: The FreeBSD Foundation
(cherry picked from commit deca0138dc659747c9edd4648690cdfdb01f58e8)
---
sys/x86/x86/local_apic.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index bbe3a63157d4..4ebe345e8926 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -939,9 +939,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;
@@ -978,9 +980,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;