* [PULL 0/2] hw/nvme fixes
@ 2023-03-27 17:09 Klaus Jensen
2023-03-27 17:09 ` [PULL 1/2] hw/nvme: Change alignment in dma functions for nvme_blk_* Klaus Jensen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Klaus Jensen @ 2023-03-27 17:09 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Kevin Wolf, Philippe Mathieu-Daudé, Fam Zheng, qemu-block,
Hanna Reitz, Stefan Hajnoczi, Keith Busch, Klaus Jensen,
Klaus Jensen
From: Klaus Jensen <k.jensen@samsung.com>
Hi Peter,
The following changes since commit e3debd5e7d0ce031356024878a0a18b9d109354a:
Merge tag 'pull-request-2023-03-24' of https://gitlab.com/thuth/qemu into staging (2023-03-24 16:08:46 +0000)
are available in the Git repository at:
https://gitlab.com/birkelund/qemu.git tags/nvme-next-pull-request
for you to fetch changes up to ca2a091802872b265bc6007a2d36276d51d8e4b3:
hw/nvme: fix missing DNR on compare failure (2023-03-27 19:05:23 +0200)
----------------------------------------------------------------
hw/nvme fixes
----------------------------------------------------------------
Klaus Jensen (1):
hw/nvme: fix missing DNR on compare failure
Mateusz Kozlowski (1):
hw/nvme: Change alignment in dma functions for nvme_blk_*
hw/nvme/ctrl.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PULL 1/2] hw/nvme: Change alignment in dma functions for nvme_blk_*
2023-03-27 17:09 [PULL 0/2] hw/nvme fixes Klaus Jensen
@ 2023-03-27 17:09 ` Klaus Jensen
2023-03-27 17:09 ` [PULL 2/2] hw/nvme: fix missing DNR on compare failure Klaus Jensen
2023-03-28 16:00 ` [PULL 0/2] hw/nvme fixes Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Klaus Jensen @ 2023-03-27 17:09 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Kevin Wolf, Philippe Mathieu-Daudé, Fam Zheng, qemu-block,
Hanna Reitz, Stefan Hajnoczi, Keith Busch, Klaus Jensen,
Mateusz Kozlowski, Klaus Jensen
From: Mateusz Kozlowski <kozlowski.mateuszpl@gmail.com>
Since the nvme_blk_read/write are used by both the data and metadata
portions of the IO, it can't have the 512B alignment requirement.
Without this change any metadata transfer, which length isn't a multiple
of 512B and which is bigger than 512B, will result in only a partial
transfer.
Signed-off-by: Mateusz Kozlowski <kozlowski.mateuszpl@gmail.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/nvme/ctrl.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 49c1210fce2b..291009545f03 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1434,26 +1434,26 @@ uint16_t nvme_bounce_mdata(NvmeCtrl *n, void *ptr, uint32_t len,
}
static inline void nvme_blk_read(BlockBackend *blk, int64_t offset,
- BlockCompletionFunc *cb, NvmeRequest *req)
+ uint32_t align, BlockCompletionFunc *cb,
+ NvmeRequest *req)
{
assert(req->sg.flags & NVME_SG_ALLOC);
if (req->sg.flags & NVME_SG_DMA) {
- req->aiocb = dma_blk_read(blk, &req->sg.qsg, offset, BDRV_SECTOR_SIZE,
- cb, req);
+ req->aiocb = dma_blk_read(blk, &req->sg.qsg, offset, align, cb, req);
} else {
req->aiocb = blk_aio_preadv(blk, offset, &req->sg.iov, 0, cb, req);
}
}
static inline void nvme_blk_write(BlockBackend *blk, int64_t offset,
- BlockCompletionFunc *cb, NvmeRequest *req)
+ uint32_t align, BlockCompletionFunc *cb,
+ NvmeRequest *req)
{
assert(req->sg.flags & NVME_SG_ALLOC);
if (req->sg.flags & NVME_SG_DMA) {
- req->aiocb = dma_blk_write(blk, &req->sg.qsg, offset, BDRV_SECTOR_SIZE,
- cb, req);
+ req->aiocb = dma_blk_write(blk, &req->sg.qsg, offset, align, cb, req);
} else {
req->aiocb = blk_aio_pwritev(blk, offset, &req->sg.iov, 0, cb, req);
}
@@ -2207,10 +2207,10 @@ static void nvme_rw_cb(void *opaque, int ret)
}
if (req->cmd.opcode == NVME_CMD_READ) {
- return nvme_blk_read(blk, offset, nvme_rw_complete_cb, req);
+ return nvme_blk_read(blk, offset, 1, nvme_rw_complete_cb, req);
}
- return nvme_blk_write(blk, offset, nvme_rw_complete_cb, req);
+ return nvme_blk_write(blk, offset, 1, nvme_rw_complete_cb, req);
}
}
@@ -3437,7 +3437,7 @@ static uint16_t nvme_read(NvmeCtrl *n, NvmeRequest *req)
block_acct_start(blk_get_stats(blk), &req->acct, data_size,
BLOCK_ACCT_READ);
- nvme_blk_read(blk, data_offset, nvme_rw_cb, req);
+ nvme_blk_read(blk, data_offset, BDRV_SECTOR_SIZE, nvme_rw_cb, req);
return NVME_NO_COMPLETE;
invalid:
@@ -3607,7 +3607,7 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
block_acct_start(blk_get_stats(blk), &req->acct, data_size,
BLOCK_ACCT_WRITE);
- nvme_blk_write(blk, data_offset, nvme_rw_cb, req);
+ nvme_blk_write(blk, data_offset, BDRV_SECTOR_SIZE, nvme_rw_cb, req);
} else {
req->aiocb = blk_aio_pwrite_zeroes(blk, data_offset, data_size,
BDRV_REQ_MAY_UNMAP, nvme_rw_cb,
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PULL 2/2] hw/nvme: fix missing DNR on compare failure
2023-03-27 17:09 [PULL 0/2] hw/nvme fixes Klaus Jensen
2023-03-27 17:09 ` [PULL 1/2] hw/nvme: Change alignment in dma functions for nvme_blk_* Klaus Jensen
@ 2023-03-27 17:09 ` Klaus Jensen
2023-03-28 16:00 ` [PULL 0/2] hw/nvme fixes Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Klaus Jensen @ 2023-03-27 17:09 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Kevin Wolf, Philippe Mathieu-Daudé, Fam Zheng, qemu-block,
Hanna Reitz, Stefan Hajnoczi, Keith Busch, Klaus Jensen,
Klaus Jensen, Jim Harris
From: Klaus Jensen <k.jensen@samsung.com>
Even if the host is somehow using compare to do compare-and-write, the
host should be notified immediately about the compare failure and not
have to wait for the driver to potentially retry the command.
Fixes: 0a384f923f51 ("hw/block/nvme: add compare command")
Reported-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/nvme/ctrl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 291009545f03..8b7be1420912 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -2378,7 +2378,7 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
for (bufp = buf; mbufp < end; bufp += ns->lbaf.ms, mbufp += ns->lbaf.ms) {
if (memcmp(bufp + pil, mbufp + pil, ns->lbaf.ms - pil)) {
- req->status = NVME_CMP_FAILURE;
+ req->status = NVME_CMP_FAILURE | NVME_DNR;
goto out;
}
}
@@ -2387,7 +2387,7 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
}
if (memcmp(buf, ctx->mdata.bounce, ctx->mdata.iov.size)) {
- req->status = NVME_CMP_FAILURE;
+ req->status = NVME_CMP_FAILURE | NVME_DNR;
goto out;
}
@@ -2436,7 +2436,7 @@ static void nvme_compare_data_cb(void *opaque, int ret)
}
if (memcmp(buf, ctx->data.bounce, ctx->data.iov.size)) {
- req->status = NVME_CMP_FAILURE;
+ req->status = NVME_CMP_FAILURE | NVME_DNR;
goto out;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PULL 0/2] hw/nvme fixes
2023-03-27 17:09 [PULL 0/2] hw/nvme fixes Klaus Jensen
2023-03-27 17:09 ` [PULL 1/2] hw/nvme: Change alignment in dma functions for nvme_blk_* Klaus Jensen
2023-03-27 17:09 ` [PULL 2/2] hw/nvme: fix missing DNR on compare failure Klaus Jensen
@ 2023-03-28 16:00 ` Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2023-03-28 16:00 UTC (permalink / raw)
To: Klaus Jensen
Cc: qemu-devel, Kevin Wolf, Philippe Mathieu-Daudé, Fam Zheng,
qemu-block, Hanna Reitz, Stefan Hajnoczi, Keith Busch,
Klaus Jensen
On Mon, 27 Mar 2023 at 18:09, Klaus Jensen <its@irrelevant.dk> wrote:
>
> From: Klaus Jensen <k.jensen@samsung.com>
>
> Hi Peter,
>
> The following changes since commit e3debd5e7d0ce031356024878a0a18b9d109354a:
>
> Merge tag 'pull-request-2023-03-24' of https://gitlab.com/thuth/qemu into staging (2023-03-24 16:08:46 +0000)
>
> are available in the Git repository at:
>
> https://gitlab.com/birkelund/qemu.git tags/nvme-next-pull-request
>
> for you to fetch changes up to ca2a091802872b265bc6007a2d36276d51d8e4b3:
>
> hw/nvme: fix missing DNR on compare failure (2023-03-27 19:05:23 +0200)
>
> ----------------------------------------------------------------
> hw/nvme fixes
>
> ----------------------------------------------------------------
>
> Klaus Jensen (1):
> hw/nvme: fix missing DNR on compare failure
>
> Mateusz Kozlowski (1):
> hw/nvme: Change alignment in dma functions for nvme_blk_*
>
> hw/nvme/ctrl.c | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-28 16:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-27 17:09 [PULL 0/2] hw/nvme fixes Klaus Jensen
2023-03-27 17:09 ` [PULL 1/2] hw/nvme: Change alignment in dma functions for nvme_blk_* Klaus Jensen
2023-03-27 17:09 ` [PULL 2/2] hw/nvme: fix missing DNR on compare failure Klaus Jensen
2023-03-28 16:00 ` [PULL 0/2] hw/nvme fixes Peter Maydell
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).