git: 700f7e793b37 - main - powerpc: Get rid of interrupt subterfuge for IPIs

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Wed, 27 Nov 2024 23:48:29 UTC
The branch main has been updated by jhibbits:

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

commit 700f7e793b3793606fbb9942eda03ac02991c126
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2024-11-27 14:13:57 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2024-11-27 23:36:49 +0000

    powerpc: Get rid of interrupt subterfuge for IPIs
    
    Instead of playing games with the interrupt event structure after the
    fact when setting up IPIs, do the work in the interrupt initializer.
---
 sys/powerpc/powerpc/intr_machdep.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/sys/powerpc/powerpc/intr_machdep.c b/sys/powerpc/powerpc/intr_machdep.c
index 9d361c73a240..e0eb06129dd1 100644
--- a/sys/powerpc/powerpc/intr_machdep.c
+++ b/sys/powerpc/powerpc/intr_machdep.c
@@ -147,6 +147,10 @@ device_t root_pic;
 static void *ipi_cookie;
 #endif
 
+static int powerpc_setup_intr_int(const char *name, u_int irq, driver_filter_t
+    filter, driver_intr_t handler, void *arg, enum intr_type flags, void
+    **cookiep, int domain, bool ipi);
+
 static void
 intrcnt_setname(const char *name, int index)
 {
@@ -464,24 +468,15 @@ powerpc_enable_intr(void)
 			KASSERT(piclist[n].ipis != 0,
 			    ("%s: SMP root PIC does not supply any IPIs",
 			    __func__));
-			error = powerpc_setup_intr("IPI",
+			error = powerpc_setup_intr_int("IPI",
 			    MAP_IRQ(piclist[n].node, piclist[n].irqs),
 			    powerpc_ipi_handler, NULL, NULL,
 			    INTR_TYPE_MISC | INTR_EXCL, &ipi_cookie,
-			    0 /* domain XXX */);
+			    0 /* domain XXX */, true);
 			if (error) {
 				printf("unable to setup IPI handler\n");
 				return (error);
 			}
-
-			/*
-			 * Some subterfuge: disable late EOI and mark this
-			 * as an IPI to the dispatch layer.
-			 */
-			i = intr_lookup(MAP_IRQ(piclist[n].node,
-			    piclist[n].irqs));
-			i->event->ie_post_filter = NULL;
-			i->ipi = 1;
 		}
 	}
 #endif
@@ -514,6 +509,17 @@ powerpc_setup_intr(const char *name, u_int irq, driver_filter_t filter,
     driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep,
     int domain)
 {
+
+	return (powerpc_setup_intr_int(name, irq, filter, handler, arg, flags,
+	    cookiep, domain, false));
+}
+
+
+static int
+powerpc_setup_intr_int(const char *name, u_int irq, driver_filter_t filter,
+    driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep,
+    int domain, bool ipi)
+{
 	struct powerpc_intr *i;
 	int error, enable = 0;
 
@@ -524,12 +530,14 @@ powerpc_setup_intr(const char *name, u_int irq, driver_filter_t filter,
 	if (i->event == NULL) {
 		error = intr_event_create(&i->event, (void *)i, 0, irq,
 		    powerpc_intr_pre_ithread, powerpc_intr_post_ithread,
-		    powerpc_intr_eoi, powerpc_assign_intr_cpu, "irq%u:", irq);
+		    (ipi ? NULL : powerpc_intr_eoi), powerpc_assign_intr_cpu,
+		    "irq%u:", irq);
 		if (error)
 			return (error);
 
 		enable = 1;
 	}
+	i->ipi = ipi;
 
 	error = intr_event_add_handler(i->event, name, filter, handler, arg,
 	    intr_priority(flags), flags, cookiep);