summaryrefslogtreecommitdiffstats
path: root/drivers/block/nvme.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew.r.wilcox@intel.com>2011-02-16 15:59:59 +0100
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2011-11-04 20:52:58 +0100
commit7547881d0951384f9833ec3a80fac8f3f16f3b98 (patch)
tree44efc578c7caf46df606aaed2dc117f94ee93af9 /drivers/block/nvme.c
parentNVMe: Let the kthread take care of devices earlier (diff)
downloadlinux-7547881d0951384f9833ec3a80fac8f3f16f3b98.tar.xz
linux-7547881d0951384f9833ec3a80fac8f3f16f3b98.zip
NVMe: Correct SQ doorbell semantics
The value written to the doorbell needs to be the first free index in the queue, not the most recently used index in the queue. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to '')
-rw-r--r--drivers/block/nvme.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index df1d8bda8c7c..af45e286d5dd 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -246,9 +246,9 @@ static int nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd)
spin_lock_irqsave(&nvmeq->q_lock, flags);
tail = nvmeq->sq_tail;
memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd));
- writel(tail, nvmeq->q_db);
if (++tail == nvmeq->q_depth)
tail = 0;
+ writel(tail, nvmeq->q_db);
nvmeq->sq_tail = tail;
spin_unlock_irqrestore(&nvmeq->q_lock, flags);
@@ -471,9 +471,9 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
cmnd->rw.control = cpu_to_le16(control);
cmnd->rw.dsmgmt = cpu_to_le32(dsmgmt);
- writel(nvmeq->sq_tail, nvmeq->q_db);
if (++nvmeq->sq_tail == nvmeq->q_depth)
nvmeq->sq_tail = 0;
+ writel(nvmeq->sq_tail, nvmeq->q_db);
return 0;