Module Name: src Committed By: mrg Date: Sun Mar 10 04:49:22 UTC 2024
Modified Files: src/sys/dev/ic: nvme.c Log Message: nvme(4): don't write to INTMC register if in intx mode this matches the handling of INTMS, both of which have the same restrictions on access in MSI-X mode. ideally, this register should be written to with a full set of values for MSI (upto 32 bits), but trying to force MSI mode for my test machine makes the system unstable. tested with samsung SM981 256GB, samsung 980 PRO 1TB, and intel 760p 250G. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 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.67 src/sys/dev/ic/nvme.c:1.68 --- src/sys/dev/ic/nvme.c:1.67 Tue Sep 13 10:14:20 2022 +++ src/sys/dev/ic/nvme.c Sun Mar 10 04:49:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.67 2022/09/13 10:14:20 riastradh Exp $ */ +/* $NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg 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.67 2022/09/13 10:14:20 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -620,7 +620,8 @@ nvme_resume(struct nvme_softc *sc) } } - nvme_write4(sc, NVME_INTMC, 1); + if (!sc->sc_use_mq) + nvme_write4(sc, NVME_INTMC, 1); return 0; @@ -2023,6 +2024,8 @@ nvme_intr(void *xsc) { struct nvme_softc *sc = xsc; + KASSERT(!sc->sc_use_mq); + /* * INTx is level triggered, controller deasserts the interrupt only * when we advance command queue head via write to the doorbell. @@ -2043,6 +2046,8 @@ nvme_softintr_intx(void *xq) struct nvme_queue *q = xq; struct nvme_softc *sc = q->q_sc; + KASSERT(!sc->sc_use_mq); + nvme_q_complete(sc, sc->sc_admin_q); if (sc->sc_q != NULL) nvme_q_complete(sc, sc->sc_q[0]);