git: ad97b9bbfccd - main - amd64 pmap.h: make it easier to use the header for other consumers

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 05 Jan 2023 23:31:37 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=ad97b9bbfccdb36f17788033903b1dbf508fcb96

commit ad97b9bbfccdb36f17788033903b1dbf508fcb96
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-01-04 10:31:16 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-01-05 23:30:29 +0000

    amd64 pmap.h: make it easier to use the header for other consumers
    
    Guard pmap_invlpg() definition with checks that only provide it when
    both sys/pcpu.h and machine/cpufunc.h were already included.
    
    Requested by:   Elliott Mitchell
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 sys/amd64/include/pmap.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
index e7497c2f8b4b..a7e456d80fcf 100644
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -516,6 +516,7 @@ pmap_invalidate_cpu_mask(pmap_t pmap)
 	return (&pmap->pm_active);
 }
 
+#if defined(_SYS_PCPU_H_) && defined(_MACHINE_CPUFUNC_H_)
 /*
  * It seems that AlderLake+ small cores have some microarchitectural
  * bug, which results in the INVLPG instruction failing to flush all
@@ -533,6 +534,7 @@ pmap_invlpg(pmap_t pmap, vm_offset_t va)
 		invlpg(va);
 	}
 }
+#endif /* sys/pcpu.h && machine/cpufunc.h */
 
 #endif /* _KERNEL */