Module Name: src Committed By: knakahara Date: Fri Oct 9 12:56:02 UTC 2015
Modified Files: src/sys/arch/x86/x86: intr.c Log Message: fix: "intrctl list" causes panic when the device using pci_intr_alloc() shares IRQ. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/x86/x86/intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.88 src/sys/arch/x86/x86/intr.c:1.89 --- src/sys/arch/x86/x86/intr.c:1.88 Tue Oct 6 09:44:31 2015 +++ src/sys/arch/x86/x86/intr.c Fri Oct 9 12:56:02 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.88 2015/10/06 09:44:31 knakahara Exp $ */ +/* $NetBSD: intr.c,v 1.89 2015/10/09 12:56:02 knakahara Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.88 2015/10/06 09:44:31 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.89 2015/10/09 12:56:02 knakahara Exp $"); #include "opt_intrdebug.h" #include "opt_multiprocessor.h" @@ -1007,6 +1007,21 @@ intr_establish_xname(int legacy_irq, str /* NOTREACHED */ } + /* + * If the establishing interrupt uses shared IRQ, the interrupt uses + * "ci->ci_isources[slot]" instead of allocated by the establishing + * device's pci_intr_alloc() or this function. + */ + if (source->is_handlers != NULL) { + struct intrsource *isp; + + SIMPLEQ_FOREACH(isp, &io_interrupt_sources, is_list) { + if (strncmp(intrstr, isp->is_intrid, INTRIDBUF - 1) == 0 + && isp->is_handlers == NULL) + intr_free_io_intrsource_direct(isp); + } + } + /* * We're now committed. Mask the interrupt in hardware and * count it for load distribution.