Skip to content

Commit da5c7e0

Browse files
committed
kern/intr: enforce PPI interrupt for PPI requests
This should ensure devices needing a PPI interrupt receive a PPI interrupt. In debug kernels warn in case of mismatch between request and retrieved intr_event. Differential Revision: https://reviews.freebsd.org/D38448
1 parent 4466a03 commit da5c7e0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sys/kern/kern_intr.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,19 @@ intr_event_add_handler(struct intr_event *ie, const char *name,
629629
if (ie == NULL || name == NULL || (handler == NULL && filter == NULL))
630630
return (EINVAL);
631631

632+
if ((flags & INTR_MULTIPROC) && !(ie->ie_flags & IE_MULTIPROC)) {
633+
#if defined(INVARIANTS) || defined(DEBUG)
634+
printf("%s: Requested multi-processor interupt, but got "
635+
"uniprocessor interrupt\n", name);
636+
#endif
637+
return (ENODEV);
638+
}
639+
#if defined(INVARIANTS) || defined(DEBUG)
640+
if (!(flags & INTR_MULTIPROC) && (ie->ie_flags & IE_MULTIPROC))
641+
printf("%s: Requested uniprocessor interupt, but got "
642+
"multi-processor interrupt\n", name);
643+
#endif
644+
632645
/* Allocate and populate an interrupt handler structure. */
633646
ih = malloc(sizeof(struct intr_handler), M_ITHREAD, M_WAITOK | M_ZERO);
634647
ih->ih_filter = filter;

0 commit comments

Comments
 (0)