git: 26d5c4fc04df - main - powerpc64/powernv: Migrate XICS to PIC_AP_INIT

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Sun, 30 Aug 2026 04:04:46 UTC
The branch main has been updated by jhibbits:

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

commit 26d5c4fc04dff332e47dd5249034160b8613c232
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2026-08-30 04:03:34 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2026-08-30 04:04:30 +0000

    powerpc64/powernv: Migrate XICS to PIC_AP_INIT
    
    Get rid of the powernv-specific AP callback and use the new-ish
    PIC_AP_INIT() PIC KPI instead.
---
 sys/powerpc/pseries/xics.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/sys/powerpc/pseries/xics.c b/sys/powerpc/pseries/xics.c
index 6195307114b7..2a6db5e5b200 100644
--- a/sys/powerpc/pseries/xics.c
+++ b/sys/powerpc/pseries/xics.c
@@ -75,8 +75,7 @@ static void	xicp_mask(device_t, u_int, void *priv);
 static void	xicp_unmask(device_t, u_int, void *priv);
 
 #ifdef POWERNV
-extern void (*powernv_smp_ap_extra_init)(void);
-static void	xicp_smp_cpu_startup(void);
+static void	xicp_ap_init(device_t);
 #endif
 
 static device_method_t  xicp_methods[] = {
@@ -92,6 +91,9 @@ static device_method_t  xicp_methods[] = {
 	DEVMETHOD(pic_ipi,		xicp_ipi),
 	DEVMETHOD(pic_mask,		xicp_mask),
 	DEVMETHOD(pic_unmask,		xicp_unmask),
+#ifdef POWERNV
+	DEVMETHOD(pic_ap_init,		xicp_ap_init),
+#endif
 
 	DEVMETHOD_END
 };
@@ -275,11 +277,6 @@ xicp_attach(device_t dev)
 	    1 /* Number of IPIs */, FALSE);
 	root_pic = dev;
 
-#ifdef POWERNV
-	if (sc->xics_emu)
-		powernv_smp_ap_extra_init = xicp_smp_cpu_startup;
-#endif
-
 	return (0);
 }
 
@@ -554,14 +551,14 @@ xicp_unmask(device_t dev, u_int irq, void *priv)
 }
 
 #ifdef POWERNV
-/* This is only used on POWER9 systems with the XIVE's XICS emulation. */
+/* Only meaningful on POWER9 systems using the XIVE's XICS-emulation mode. */
 static void
-xicp_smp_cpu_startup(void)
+xicp_ap_init(device_t dev)
 {
 	struct xicp_softc *sc;
 
 	if (mfmsr() & PSL_HV) {
-		sc = device_get_softc(root_pic);
+		sc = device_get_softc(dev);
 
 		if (sc->xics_emu)
 			opal_call(OPAL_INT_SET_CPPR, 0xff);