Module Name: src
Committed By: martin
Date: Tue Mar 12 09:59:31 UTC 2024
Modified Files:
src/sys/dev/ic [netbsd-9]: nvme.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.44.2.6 -r1.44.2.7 src/sys/dev/ic/nvme.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/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.44.2.6 src/sys/dev/ic/nvme.c:1.44.2.7
--- src/sys/dev/ic/nvme.c:1.44.2.6 Mon Jun 21 17:25:48 2021
+++ src/sys/dev/ic/nvme.c Tue Mar 12 09:59:31 2024
@@ -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 f
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));