Pull up following revision(s) (requested by riastradh in ticket #1817):

sys/dev/ic/nvme.c: revision 1.69

nvme(4): Disestablish admin q interrupt while suspended.

And re-establish on resume.  Fixes nvmectl(8) after a suspend/resume
cycle on some systems.

Adapted from a patch by mrg@.

PR kern/58025
This commit is contained in:
martin 2024-03-12 09:59:31 +00:00
parent b0c7a08c49
commit 9928f3c209
1 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nvme.c,v 1.44.2.6 2021/06/21 17:25:48 martin Exp $ */
/* $NetBSD: nvme.c,v 1.44.2.7 2024/03/12 09:59:31 martin Exp $ */
/* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
/*
@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.6 2021/06/21 17:25:48 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.7 2024/03/12 09:59:31 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -552,7 +552,6 @@ nvme_detach(struct nvme_softc *sc, int flags)
return error;
/* from now on we are committed to detach, following will never fail */
sc->sc_intr_disestablish(sc, NVME_ADMIN_Q);
for (i = 0; i < sc->sc_nq; i++)
nvme_q_free(sc, sc->sc_q[i]);
kmem_free(sc->sc_q, sizeof(*sc->sc_q) * sc->sc_nq);
@ -582,6 +581,11 @@ nvme_resume(struct nvme_softc *sc)
}
nvme_q_reset(sc, sc->sc_admin_q);
if (sc->sc_intr_establish(sc, NVME_ADMIN_Q, sc->sc_admin_q)) {
error = EIO;
device_printf(sc->sc_dev, "unable to establish admin q\n");
goto disable;
}
error = nvme_enable(sc, ffs(sc->sc_mps) - 1);
if (error) {
@ -643,6 +647,8 @@ nvme_shutdown(struct nvme_softc *sc)
if (disabled)
goto disable;
sc->sc_intr_disestablish(sc, NVME_ADMIN_Q);
cc = nvme_read4(sc, NVME_CC);
CLR(cc, NVME_CC_SHN_MASK);
SET(cc, NVME_CC_SHN(NVME_CC_SHN_NORMAL));