From: Klaus Jensen <its@irrelevant.dk>
To: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Cc: fam@euphon.net, kwolf@redhat.com, qemu-block@nongnu.org,
qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com,
kbusch@kernel.org
Subject: Re: [PATCH 2/2] hw/block/nvme: fix lbaf formats initialization
Date: Fri, 16 Apr 2021 10:48:16 +0200 [thread overview]
Message-ID: <YHlPUMYBcnl/Newj@apples.localdomain> (raw)
In-Reply-To: <20210416072234.25732-2-anaidu.gollu@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 2786 bytes --]
On Apr 16 12:52, Gollu Appalanaidu wrote:
>Currently LBAF formats are being intialized based on metadata
>size if and only if nvme-ns "ms" parameter is non-zero value.
>Since FormatNVM command being supported device parameter "ms"
>may not be the criteria to initialize the supported LBAFs.
>
>Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
>---
> hw/block/nvme-ns.c | 48 ++++++++++++++++++----------------------------
> 1 file changed, 19 insertions(+), 29 deletions(-)
>
>diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
>index 7bb618f182..573dbb5a9d 100644
>--- a/hw/block/nvme-ns.c
>+++ b/hw/block/nvme-ns.c
>@@ -85,38 +85,28 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
> ds = 31 - clz32(ns->blkconf.logical_block_size);
> ms = ns->params.ms;
>
>- if (ns->params.ms) {
>- id_ns->mc = 0x3;
>+ id_ns->mc = 0x3;
>
>- if (ns->params.mset) {
>- id_ns->flbas |= 0x10;
>- }
>+ if (ms && ns->params.mset) {
>+ id_ns->flbas |= 0x10;
>+ }
>
>- id_ns->dpc = 0x1f;
>- id_ns->dps = ((ns->params.pil & 0x1) << 3) | ns->params.pi;
>-
>- NvmeLBAF lbaf[16] = {
>- [0] = { .ds = 9 },
>- [1] = { .ds = 9, .ms = 8 },
>- [2] = { .ds = 9, .ms = 16 },
>- [3] = { .ds = 9, .ms = 64 },
>- [4] = { .ds = 12 },
>- [5] = { .ds = 12, .ms = 8 },
>- [6] = { .ds = 12, .ms = 16 },
>- [7] = { .ds = 12, .ms = 64 },
>- };
>-
>- memcpy(&id_ns->lbaf, &lbaf, sizeof(lbaf));
>- id_ns->nlbaf = 7;
>- } else {
>- NvmeLBAF lbaf[16] = {
>- [0] = { .ds = 9 },
>- [1] = { .ds = 12 },
>- };
>+ id_ns->dpc = 0x1f;
>+ id_ns->dps = ((ns->params.pil & 0x1) << 3) | ns->params.pi;
While nvme_ns_check_constraints() will error out if pi is set and the
metadata bytes are insufficient, I don't think this should set bit 3
unless both metadata and pi is enabled. It's not against the spec, but
it's just slightly weird.
>
>- memcpy(&id_ns->lbaf, &lbaf, sizeof(lbaf));
>- id_ns->nlbaf = 1;
>- }
>+ NvmeLBAF lbaf[16] = {
>+ [0] = { .ds = 9 },
>+ [1] = { .ds = 9, .ms = 8 },
>+ [2] = { .ds = 9, .ms = 16 },
>+ [3] = { .ds = 9, .ms = 64 },
>+ [4] = { .ds = 12 },
>+ [5] = { .ds = 12, .ms = 8 },
>+ [6] = { .ds = 12, .ms = 16 },
>+ [7] = { .ds = 12, .ms = 64 },
>+ };
>+
>+ memcpy(&id_ns->lbaf, &lbaf, sizeof(lbaf));
>+ id_ns->nlbaf = 7;
>
> for (i = 0; i <= id_ns->nlbaf; i++) {
> NvmeLBAF *lbaf = &id_ns->lbaf[i];
>--
>2.17.1
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-04-16 8:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210416072533epcas5p305e83206f2b3d947e9b5fef9fde1c969@epcas5p3.samsung.com>
2021-04-16 7:22 ` [PATCH 1/2] hw/block/nvme: consider metadata read aio return value in compare Gollu Appalanaidu
[not found] ` <CGME20210416072544epcas5p26bf011c82ad4b60693cfaac32bc9e36f@epcas5p2.samsung.com>
2021-04-16 7:22 ` [PATCH 2/2] hw/block/nvme: fix lbaf formats initialization Gollu Appalanaidu
2021-04-16 8:48 ` Klaus Jensen [this message]
2021-04-16 10:50 ` Gollu Appalanaidu
2021-04-16 12:06 ` [PATCH 1/2] hw/block/nvme: consider metadata read aio return value in compare Klaus Jensen
2021-04-20 19:58 ` Klaus Jensen
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=YHlPUMYBcnl/Newj@apples.localdomain \
--to=its@irrelevant.dk \
--cc=anaidu.gollu@samsung.com \
--cc=fam@euphon.net \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).