diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2019-06-06 03:11:59 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2019-06-06 03:11:59 +0000 |
commit | e70abcb9b02774fcd3cef1e67147058e15efd46e (patch) | |
tree | 5f68376f0c638a7e9bf6d05e41b32554a47115b0 /sys/dev/pci/if_mcx.c | |
parent | cdf7c044bd31ff8e2e91fdfd8d8a7494ed142692 (diff) |
Set up the interrupt handler before creating the event queue.
Apparently the boot rom on some cards leaves an interrupt vector set up,
which will be run on completion of the first command after we set up the
event queue, causing kernel crashes. chris@ reported this a while ago.
Diffstat (limited to 'sys/dev/pci/if_mcx.c')
-rw-r--r-- | sys/dev/pci/if_mcx.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c index a13eebf3981..5dc37758a69 100644 --- a/sys/dev/pci/if_mcx.c +++ b/sys/dev/pci/if_mcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mcx.c,v 1.17 2019/06/05 04:45:42 jmatthew Exp $ */ +/* $OpenBSD: if_mcx.c,v 1.18 2019/06/06 03:11:58 jmatthew Exp $ */ /* * Copyright (c) 2017 David Gwynne <dlg@openbsd.org> @@ -2271,6 +2271,26 @@ mcx_attach(struct device *parent, struct device *self, void *aux) goto teardown; } + /* + * PRM makes no mention of msi interrupts, just legacy and msi-x. + * mellanox support tells me legacy interrupts are not supported, + * so we're stuck with just msi-x. + */ + if (pci_intr_map_msix(pa, 0, &sc->sc_ih) != 0) { + printf(": unable to map interrupt\n"); + goto teardown; + } + intrstr = pci_intr_string(sc->sc_pc, sc->sc_ih); + sc->sc_ihc = pci_intr_establish(sc->sc_pc, sc->sc_ih, + IPL_NET | IPL_MPSAFE, mcx_intr, sc, DEVNAME(sc)); + if (sc->sc_ihc == NULL) { + printf(": unable to establish interrupt"); + if (intrstr != NULL) + printf(" at %s", intrstr); + printf("\n"); + goto teardown; + } + if (mcx_create_eq(sc) != 0) { /* error printed by mcx_create_eq */ goto teardown; @@ -2291,25 +2311,6 @@ mcx_attach(struct device *parent, struct device *self, void *aux) goto teardown; } - /* - * PRM makes no mention of msi interrupts, just legacy and msi-x. - * mellanox support tells me legacy interrupts are not supported, - * so we're stuck with just msi-x. - */ - if (pci_intr_map_msix(pa, 0, &sc->sc_ih) != 0) { - printf(": unable to map interrupt\n"); - goto teardown; - } - intrstr = pci_intr_string(sc->sc_pc, sc->sc_ih); - sc->sc_ihc = pci_intr_establish(sc->sc_pc, sc->sc_ih, - IPL_NET | IPL_MPSAFE, mcx_intr, sc, DEVNAME(sc)); - if (sc->sc_ihc == NULL) { - printf(": unable to establish interrupt"); - if (intrstr != NULL) - printf(" at %s", intrstr); - printf("\n"); - goto teardown; - } printf(", %s, address %s\n", intrstr, ether_sprintf(sc->sc_ac.ac_enaddr)); |