Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/fdt pcihost: Don't call fdtbus_intr_disestablis...
details: https://anonhg.NetBSD.org/src/rev/fecd1ecd0500
branches: trunk
changeset: 369853:fecd1ecd0500
user: skrll <skrll%NetBSD.org@localhost>
date: Sun Sep 04 10:20:33 2022 +0000
description:
pcihost: Don't call fdtbus_intr_disestablish for MSI/MSI-X interrupts.
This avoids a KASSERT firing when using 'drvctl -d' on a pci device that
uses MSI/MSI-X interrupts.
diffstat:
sys/arch/arm/fdt/pcihost_fdt.c | 40 +++++++++++++++++++++++++++++++---------
1 files changed, 31 insertions(+), 9 deletions(-)
diffs (80 lines):
diff -r d792e7564918 -r fecd1ecd0500 sys/arch/arm/fdt/pcihost_fdt.c
--- a/sys/arch/arm/fdt/pcihost_fdt.c Sun Sep 04 09:23:07 2022 +0000
+++ b/sys/arch/arm/fdt/pcihost_fdt.c Sun Sep 04 10:20:33 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdt.c,v 1.28 2022/08/13 16:01:34 jmcneill Exp $ */
+/* $NetBSD: pcihost_fdt.c,v 1.29 2022/09/04 10:20:33 skrll Exp $ */
/*-
* Copyright (c) 2018 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.28 2022/08/13 16:01:34 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.29 2022/09/04 10:20:33 skrll Exp $");
#include <sys/param.h>
@@ -600,32 +600,54 @@
}
}
+struct pcihost_cookie {
+ pci_intr_handle_t phic_pih;
+ void *phic_ih;
+};
+
+
static void *
-pcihost_intr_establish(void *v, pci_intr_handle_t ih, int ipl,
+pcihost_intr_establish(void *v, pci_intr_handle_t pih, int ipl,
int (*callback)(void *), void *arg, const char *xname)
{
struct pcihost_softc *sc = v;
- const int flags = (ih & ARM_PCI_INTR_MPSAFE) ? FDT_INTR_MPSAFE : 0;
+ const int flags = (pih & ARM_PCI_INTR_MPSAFE) ? FDT_INTR_MPSAFE : 0;
const u_int *specifier;
int ihandle;
- if ((ih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0)
- return arm_pci_msi_intr_establish(&sc->sc_pc, ih, ipl, callback, arg, xname);
+ struct pcihost_cookie * const phic = kmem_alloc(sizeof(*phic), KM_SLEEP);
+ phic->phic_pih = pih;
+ if ((pih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0) {
+ phic->phic_ih = arm_pci_msi_intr_establish(&sc->sc_pc, pih, ipl,
+ callback, arg, xname);
- specifier = pcihost_find_intr(sc, ih & ARM_PCI_INTR_IRQ, &ihandle);
+ return phic;
+ }
+
+ specifier = pcihost_find_intr(sc, pih & ARM_PCI_INTR_IRQ, &ihandle);
if (specifier == NULL)
return NULL;
- return fdtbus_intr_establish_raw(ihandle, specifier, ipl, flags,
+ phic->phic_ih = fdtbus_intr_establish_raw(ihandle, specifier, ipl, flags,
callback, arg, xname);
+
+ return phic;
}
static void
pcihost_intr_disestablish(void *v, void *vih)
{
struct pcihost_softc *sc = v;
+ struct pcihost_cookie * const phic = vih;
+ const pci_intr_handle_t pih = phic->phic_pih;
+ void * const ih = phic->phic_ih;
- fdtbus_intr_disestablish(sc->sc_phandle, vih);
+ kmem_free(phic, sizeof(*phic));
+
+ if ((pih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0)
+ return;
+
+ fdtbus_intr_disestablish(sc->sc_phandle, ih);
}
static int
Home |
Main Index |
Thread Index |
Old Index