From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PULL 3/5] block/nvme: don't touch the completion entries
Date: Mon, 22 Jul 2019 19:26:14 +0200 [thread overview]
Message-ID: <20190722172616.28797-4-mreitz@redhat.com> (raw)
In-Reply-To: <20190722172616.28797-1-mreitz@redhat.com>
From: Maxim Levitsky <mlevitsk@redhat.com>
Completion entries are meant to be only read by the host and written by the device.
The driver is supposed to scan the completions from the last point where it left,
and until it sees a completion with non flipped phase bit.
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190716163020.13383-4-mlevitsk@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/nvme.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/block/nvme.c b/block/nvme.c
index 35ce10dc79..c28755cc31 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -318,7 +318,7 @@ static bool nvme_process_completion(BDRVNVMeState *s, NVMeQueuePair *q)
while (q->inflight) {
int16_t cid;
c = (NvmeCqe *)&q->cq.queue[q->cq.head * NVME_CQ_ENTRY_BYTES];
- if (!c->cid || (le16_to_cpu(c->status) & 0x1) == q->cq_phase) {
+ if ((le16_to_cpu(c->status) & 0x1) == q->cq_phase) {
break;
}
q->cq.head = (q->cq.head + 1) % NVME_QUEUE_SIZE;
@@ -342,10 +342,7 @@ static bool nvme_process_completion(BDRVNVMeState *s, NVMeQueuePair *q)
qemu_mutex_unlock(&q->lock);
req.cb(req.opaque, nvme_translate_error(c));
qemu_mutex_lock(&q->lock);
- c->cid = cpu_to_le16(0);
q->inflight--;
- /* Flip Phase Tag bit. */
- c->status = cpu_to_le16(le16_to_cpu(c->status) ^ 0x1);
progress = true;
}
if (progress) {
--
2.21.0
next prev parent reply other threads:[~2019-07-22 17:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 17:26 [Qemu-devel] [PULL 0/5] Block patches for 4.1.0-rc2 Max Reitz
2019-07-22 17:26 ` [Qemu-devel] [PULL 1/5] block/nvme: fix doorbell stride Max Reitz
2019-07-22 17:26 ` [Qemu-devel] [PULL 2/5] block/nvme: support larger that 512 bytes sector devices Max Reitz
2019-07-29 13:16 ` Peter Maydell
2019-07-29 13:25 ` Max Reitz
2019-07-29 15:01 ` Maxim Levitsky
2019-07-29 14:50 ` [Qemu-devel] [Qemu-block] " Maxim Levitsky
2019-07-22 17:26 ` Max Reitz [this message]
2019-07-22 17:26 ` [Qemu-devel] [PULL 4/5] block: Dec. drained_end_counter before bdrv_wakeup Max Reitz
2019-07-22 17:26 ` [Qemu-devel] [PULL 5/5] block: Only the main loop can change AioContexts Max Reitz
2019-07-23 9:51 ` [Qemu-devel] [PULL 0/5] Block patches for 4.1.0-rc2 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190722172616.28797-4-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).