From: Klaus Jensen <its@irrelevant.dk>
To: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Cc: "Fam Zheng" <fam@euphon.net>, "Kevin Wolf" <kwolf@redhat.com>,
"Damien Le Moal" <damien.lemoal@wdc.com>,
qemu-block@nongnu.org, "Niklas Cassel" <niklas.cassel@wdc.com>,
"Klaus Jensen" <k.jensen@samsung.com>,
qemu-devel@nongnu.org, "Maxim Levitsky" <mlevitsk@redhat.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Keith Busch" <kbusch@kernel.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Matias Bjorling" <matias.bjorling@wdc.com>
Subject: Re: [PATCH v3 06/15] hw/block/nvme: Add support for Namespace Types
Date: Fri, 18 Sep 2020 23:29:59 +0200 [thread overview]
Message-ID: <20200918212959.GB581752@apples.localdomain> (raw)
In-Reply-To: <20200913221436.22844-7-dmitry.fomichev@wdc.com>
[-- Attachment #1: Type: text/plain, Size: 2967 bytes --]
On Sep 14 07:14, Dmitry Fomichev wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
>
> Namespace Types introduce a new command set, "I/O Command Sets",
> that allows the host to retrieve the command sets associated with
> a namespace. Introduce support for the command set and enable
> detection for the NVM Command Set.
>
> The new workflows for identify commands rely heavily on zero-filled
> identify structs. E.g., certain CNS commands are defined to return
> a zero-filled identify struct when an inactive namespace NSID
> is supplied.
>
> Add a helper function in order to avoid code duplication when
> reporting zero-filled identify structures.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
> ---
> hw/block/nvme.c | 235 +++++++++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 215 insertions(+), 20 deletions(-)
>
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index 4bd88f4046..d01c1c1e06 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -595,6 +595,33 @@ static inline uint16_t nvme_check_bounds(NvmeCtrl *n, NvmeNamespace *ns,
> return NVME_SUCCESS;
> }
>
> +static void nvme_fill_data(QEMUSGList *qsg, QEMUIOVector *iov,
> + uint64_t offset, uint8_t pattern)
> +{
> + ScatterGatherEntry *entry;
> + uint32_t len, ent_len;
> +
> + if (qsg->nsg > 0) {
> + entry = qsg->sg;
> + for (len = qsg->size; len > 0; len -= ent_len) {
> + ent_len = MIN(len, entry->len);
> + if (offset > ent_len) {
> + offset -= ent_len;
> + } else if (offset != 0) {
> + dma_memory_set(qsg->as, entry->base + offset,
> + pattern, ent_len - offset);
> + offset = 0;
> + } else {
> + dma_memory_set(qsg->as, entry->base, pattern, ent_len);
> + }
> + entry++;
> + }
> + } else if (iov->iov) {
> + qemu_iovec_memset(iov, offset, pattern,
> + iov_size(iov->iov, iov->niov) - offset);
> + }
> +}
> +
> static void nvme_rw_cb(void *opaque, int ret)
> {
> NvmeRequest *req = opaque;
> @@ -1153,6 +1180,19 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
> return NVME_SUCCESS;
> }
>
> +static uint16_t nvme_rpt_empty_id_struct(NvmeCtrl *n, uint64_t prp1,
> + uint64_t prp2, NvmeRequest *req)
> +{
> + uint16_t status;
> +
> + status = nvme_map_prp(n, prp1, prp2, NVME_IDENTIFY_DATA_SIZE, req);
> + if (status) {
> + return status;
> + }
> + nvme_fill_data(&req->qsg, &req->iov, 0, 0);
> + return NVME_SUCCESS;
> +}
> +
Instead of doing the filling, why not just directly call nvme_dma_prp
with an empty NvmeIdCtrl/NvmeIdNs stack allocated variable?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-09-18 21:36 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-13 22:14 [PATCH v3 00/15] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 01/15] hw/block/nvme: Define 64 bit cqe.result Dmitry Fomichev
2020-09-15 7:37 ` Klaus Jensen
2020-09-15 18:56 ` Dmitry Fomichev
2020-09-15 19:55 ` Klaus Jensen
2020-09-15 20:44 ` Dmitry Fomichev
2020-09-15 20:48 ` Klaus Jensen
2020-09-18 21:10 ` Keith Busch
2020-09-21 21:39 ` Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 02/15] hw/block/nvme: Report actual LBA data shift in LBAF Dmitry Fomichev
2020-09-15 7:34 ` Klaus Jensen
2020-09-15 18:57 ` Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 03/15] hw/block/nvme: Add Commands Supported and Effects log Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 04/15] hw/block/nvme: Introduce the Namespace Types definitions Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 05/15] hw/block/nvme: Define trace events related to NS Types Dmitry Fomichev
2020-09-14 6:35 ` Philippe Mathieu-Daudé
2020-09-13 22:14 ` [PATCH v3 06/15] hw/block/nvme: Add support for Namespace Types Dmitry Fomichev
2020-09-18 21:29 ` Klaus Jensen [this message]
2020-09-18 22:22 ` Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 07/15] hw/block/nvme: Add support for active/inactive namespaces Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 08/15] hw/block/nvme: Make Zoned NS Command Set definitions Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 09/15] hw/block/nvme: Define Zoned NS Command Set trace events Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 10/15] hw/block/nvme: Support Zoned Namespace Command Set Dmitry Fomichev
2020-09-18 21:20 ` Klaus Jensen
2020-09-18 22:07 ` Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 11/15] hw/block/nvme: Introduce max active and open zone limits Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 12/15] hw/block/nvme: Support Zone Descriptor Extensions Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 13/15] hw/block/nvme: Add injection of Offline/Read-Only zones Dmitry Fomichev
2020-09-13 22:14 ` [PATCH v3 14/15] hw/block/nvme: Use zone metadata file for persistence Dmitry Fomichev
2020-09-15 19:09 ` Klaus Jensen
2020-09-15 20:44 ` Dmitry Fomichev
2020-09-15 20:46 ` Klaus Jensen
2020-09-13 22:14 ` [PATCH v3 15/15] hw/block/nvme: Document zoned parameters in usage text Dmitry Fomichev
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=20200918212959.GB581752@apples.localdomain \
--to=its@irrelevant.dk \
--cc=alistair.francis@wdc.com \
--cc=damien.lemoal@wdc.com \
--cc=dmitry.fomichev@wdc.com \
--cc=fam@euphon.net \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=matias.bjorling@wdc.com \
--cc=mlevitsk@redhat.com \
--cc=niklas.cassel@wdc.com \
--cc=philmd@redhat.com \
--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).