diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -3,6 +3,7 @@ * * Copyright (c) 1997, Stefan Esser * All rights reserved. + * Copyright © 2023 Elliott Mitchell * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -286,8 +287,8 @@ struct intr_event *ie; va_list ap; - /* The only valid flag during creation is IE_SOFT. */ - if ((flags & ~IE_SOFT) != 0) + /* The flags valid during creation are IE_SOFT and IE_MULTIPROC. */ + if ((flags & ~(IE_SOFT | IE_MULTIPROC)) != 0) return (EINVAL); ie = malloc(sizeof(struct intr_event), M_ITHREAD, M_WAITOK | M_ZERO); ie->ie_source = source; @@ -1059,18 +1060,22 @@ void *arg, int pri, enum intr_type flags, void **cookiep) { struct intr_event *ie; + int eflags = IE_SOFT; int error = 0; if (flags & INTR_ENTROPY) return (EINVAL); + if (flags & INTR_MULTIPROC) + eflags |= IE_MULTIPROC; + ie = (eventp != NULL) ? *eventp : NULL; if (ie != NULL) { if (!(ie->ie_flags & IE_SOFT)) return (EINVAL); } else { - error = intr_event_create(&ie, NULL, IE_SOFT, 0, + error = intr_event_create(&ie, NULL, eflags, 0, NULL, NULL, NULL, swi_assign_cpu, "swi%d:", pri); if (error) return (error); @@ -1626,7 +1631,7 @@ { if (swi_add(&clk_intr_event, "clk", NULL, NULL, SWI_CLOCK, - INTR_MPSAFE, NULL)) + INTR_MPSAFE | INTR_MULTIPROC, NULL)) panic("died while creating clk swi ithread"); } SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -2,7 +2,7 @@ * Copyright (c) 2015-2016 Svatopluk Kraus * Copyright (c) 2015-2016 Michal Meloun * All rights reserved. - * Copyright © 2022 Elliott Mitchell + * Copyright © 2022-2023 Elliott Mitchell * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -626,12 +626,15 @@ isrc_event_create(struct intr_irqsrc *isrc) { struct intr_event *ie; + u_int flags = 0; int error; if (isrc->isrc_event != NULL) return (0); - error = intr_event_create(&ie, isrc, 0, isrc->isrc_irq, + if (isrc->isrc_flags & (INTR_ISRCF_IPI|INTR_ISRCF_PPI)) + flags |= IE_MULTIPROC; + error = intr_event_create(&ie, isrc, flags, isrc->isrc_irq, intr_isrc_pre_ithread, intr_isrc_post_ithread, intr_isrc_post_filter, intr_isrc_assign_cpu, "%s:", isrc->isrc_name); if (error) diff --git a/sys/sys/bus.h b/sys/sys/bus.h --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -281,7 +281,8 @@ INTR_MD1 = 4096, /* flag reserved for MD use */ INTR_MD2 = 8192, /* flag reserved for MD use */ INTR_MD3 = 16384, /* flag reserved for MD use */ - INTR_MD4 = 32768 /* flag reserved for MD use */ + INTR_MD4 = 32768, /* flag reserved for MD use */ + INTR_MULTIPROC = 0x10000, /* interrupt occurs on multiple procs */ }; enum intr_trigger { diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -132,6 +132,7 @@ /* Interrupt event flags kept in ie_flags. */ #define IE_SOFT 0x000001 /* Software interrupt. */ #define IE_ADDING_THREAD 0x000004 /* Currently building an ithread. */ +#define IE_MULTIPROC 0x000008 /* Interrupt occurs on multiple procs */ /* Flags to pass to swi_sched. */ #define SWI_FROMNMI 0x1