From 8cacd2cc0aa7bc7b51c0017edcd6a49db5b4f95e Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 30 Mar 2017 23:33:46 +0200 Subject: [PATCH 1/2] sdnvme: don't write completion queue doorbell register when nothing has been processed turns out on real hardware, the front falls off if we write the completion queue doorbell registers without consuming an entry. so only write the register when we have processed something. --- sys/src/9/pc/sdnvme.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/src/9/pc/sdnvme.c b/sys/src/9/pc/sdnvme.c index c8605c0d2..537578d5d 100644 --- a/sys/src/9/pc/sdnvme.c +++ b/sys/src/9/pc/sdnvme.c @@ -165,7 +165,7 @@ nvmeintr(Ureg *, void *arg) if(cq->base == nil) continue; phaseshift = 16 - cq->shift; - for(;; cq->head++){ + for(;;){ e = &cq->base[(cq->head & cq->mask)<<2]; if(((e[3] ^ (cq->head << phaseshift)) & 0x10000) == 0) break; @@ -183,11 +183,9 @@ nvmeintr(Ureg *, void *arg) *wp = nil; wakeup(z); } + ctlr->reg[DBell + ((cq-ctlr->cq)*2+1 << ctlr->dstrd)] = ++cq->head & cq->mask; } - ctlr->reg[DBell + ((cq-ctlr->cq)*2+1 << ctlr->dstrd)] = cq->head & cq->mask; } - if((ctlr->reg[CSts] & 3) != 1) - iprint("nvmeintr: fatal controller error\n"); ctlr->reg[IntMc] = ctlr->ints; iunlock(&ctlr->intr); } From 557cbe10adb61ffd3d29689b26c9f42fa2f850c9 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 30 Mar 2017 23:37:28 +0200 Subject: [PATCH 2/2] sdnvme: enable in pcf, pccpuf, pc64 kernel configuration --- sys/src/9/pc/pccpuf | 1 + sys/src/9/pc/pcf | 1 + sys/src/9/pc64/pc64 | 1 + 3 files changed, 3 insertions(+) diff --git a/sys/src/9/pc/pccpuf b/sys/src/9/pc/pccpuf index 72a412f00..1f1011942 100644 --- a/sys/src/9/pc/pccpuf +++ b/sys/src/9/pc/pccpuf @@ -101,6 +101,7 @@ misc sdodin pci sdscsi led sdvirtio pci sdscsi sdmmc pci pmmc + sdnvme pci sdloop vga3dfx +cur diff --git a/sys/src/9/pc/pcf b/sys/src/9/pc/pcf index 2ea4b9ec5..a34964559 100644 --- a/sys/src/9/pc/pcf +++ b/sys/src/9/pc/pcf @@ -98,6 +98,7 @@ misc sdodin pci sdscsi led sdvirtio pci sdscsi sdmmc pci pmmc + sdnvme pci sdloop uarti8250 diff --git a/sys/src/9/pc64/pc64 b/sys/src/9/pc64/pc64 index ca047e0ff..ba51d7ccd 100644 --- a/sys/src/9/pc64/pc64 +++ b/sys/src/9/pc64/pc64 @@ -96,6 +96,7 @@ misc # sdodin pci sdscsi led sdvirtio pci sdscsi sdmmc pci pmmc + sdnvme pci sdloop uarti8250