git: 4b3364a4bceb - main - powerpc: move get_pcpu() to machine/pcpu.h

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Tue, 17 Nov 2026 08:40:41 UTC
The branch main has been updated by pkubaj:

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

commit 4b3364a4bceb61c5870f50b75bf56272ca850944
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-11-07 21:12:48 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-11-17 08:40:34 +0000

    powerpc: move get_pcpu() to machine/pcpu.h
    
    Every other arch defines get_pcpu() in machine/pcpu.h, powerpc has it in
    machine/cpufunc.h, which is entirely under _KERNEL. lsof includes
    sys/systm.h without _KERNEL first on purpose, so on powerpc cpufunc.h
    turns into an empty header and pcpup later expands to a call of an
    undeclared get_pcpu(). Since sys/mount.h started pulling in sys/proc.h
    this breaks the lsof build on powerpc64 and powerpc64le.
    
    Reviewed by:    jhibbits
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D61305
---
 sys/powerpc/include/cpufunc.h | 10 ----------
 sys/powerpc/include/pcpu.h    | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/sys/powerpc/include/cpufunc.h b/sys/powerpc/include/cpufunc.h
index 19a7ae01df0c..0754b51df1b9 100644
--- a/sys/powerpc/include/cpufunc.h
+++ b/sys/powerpc/include/cpufunc.h
@@ -246,16 +246,6 @@ intr_restore(register_t msr)
 	mtmsr(msr);
 }
 
-static __inline struct pcpu *
-get_pcpu(void)
-{
-	struct pcpu *ret;
-
-	__asm __volatile("mfsprg %0, 0" : "=r"(ret));
-
-	return (ret);
-}
-
 /* "NOP" operations to signify priorities to the kernel. */
 static __inline void
 nop_prio_vlow(void)
diff --git a/sys/powerpc/include/pcpu.h b/sys/powerpc/include/pcpu.h
index 994964cab63e..be80649b1265 100644
--- a/sys/powerpc/include/pcpu.h
+++ b/sys/powerpc/include/pcpu.h
@@ -155,6 +155,16 @@ struct pvo_entry;
 
 #ifdef _KERNEL
 
+static __inline struct pcpu *
+get_pcpu(void)
+{
+	struct pcpu *ret;
+
+	__asm __volatile("mfsprg %0, 0" : "=r"(ret));
+
+	return (ret);
+}
+
 #define pcpup	(get_pcpu())
 
 static __inline __pure2 struct thread *