diff options
author | Maxim Levitsky <mlevitsk@redhat.com> | 2019-07-16 19:30:20 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-07-22 18:40:32 +0200 |
commit | 258867d1dc32c300690cc32bfcf3e648ae12c4c9 (patch) | |
tree | 01afda530fd50b9f5530ef37c71ef8d6ef17b00e /block | |
parent | 118d1b6a81c7c22023ab1c3aad46d37184d1d838 (diff) | |
download | qemu-258867d1dc32c300690cc32bfcf3e648ae12c4c9.zip qemu-258867d1dc32c300690cc32bfcf3e648ae12c4c9.tar.gz qemu-258867d1dc32c300690cc32bfcf3e648ae12c4c9.tar.bz2 |
block/nvme: don't touch the completion entries
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/nvme.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/block/nvme.c b/block/nvme.c index 35ce10d..c28755c 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) { |