All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] hw/block/nvme: fixes lbaf formats initialization and adds idns enums
       [not found] <CGME20210421125407epcas5p1f843d6b3035e05805de4bb410c93cb71@epcas5p1.samsung.com>
@ 2021-04-21 12:50 ` Gollu Appalanaidu
       [not found]   ` <CGME20210421125424epcas5p4f88500b9f49948e24e6f362375860745@epcas5p4.samsung.com>
  2021-05-22  6:48   ` [PATCH 0/3] hw/block/nvme: fixes lbaf formats initialization and adds idns enums Klaus Jensen
  0 siblings, 2 replies; 3+ messages in thread
From: Gollu Appalanaidu @ 2021-04-21 12:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: fam, kwolf, qemu-block, Gollu Appalanaidu, mreitz, its, stefanha,
	kbusch, philmd

This series fixes the LBAF Formats intialization and Adds the
Identify Namespace Parameters enums to make to more readable.

Gollu Appalanaidu (3):
  hw/block/nvme: fix lbaf formats initialization
  hw/block/nvme: add id ns flbas enum
  hw/block/nvme: add id ns metadata cap (mc) enum

 hw/block/nvme-ns.c   | 51 +++++++++++++++++++-------------------------
 hw/block/nvme-ns.h   |  2 +-
 include/block/nvme.h | 10 ++++++++-
 3 files changed, 32 insertions(+), 31 deletions(-)

-- 
2.17.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/3] hw/block/nvme: fix lbaf formats initialization
       [not found]   ` <CGME20210421125424epcas5p4f88500b9f49948e24e6f362375860745@epcas5p4.samsung.com>
@ 2021-04-21 12:51     ` Gollu Appalanaidu
  0 siblings, 0 replies; 3+ messages in thread
From: Gollu Appalanaidu @ 2021-04-21 12:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: fam, kwolf, qemu-block, Gollu Appalanaidu, mreitz, its, stefanha,
	kbusch, philmd

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.

And make LBAF array as read-only.

Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
---
 hw/block/nvme-ns.c | 51 ++++++++++++++++++++--------------------------
 1 file changed, 22 insertions(+), 29 deletions(-)

diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
index 7bb618f182..ae56142fcd 100644
--- a/hw/block/nvme-ns.c
+++ b/hw/block/nvme-ns.c
@@ -85,39 +85,32 @@ 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;
-        }
-
-        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 },
-        };
+    if (ms && ns->params.mset) {
+        id_ns->flbas |= 0x10;
+    }
 
-        memcpy(&id_ns->lbaf, &lbaf, sizeof(lbaf));
-        id_ns->nlbaf = 1;
+    id_ns->dpc = 0x1f;
+    id_ns->dps = ns->params.pi;
+    if (ns->params.pi && ns->params.pil) {
+        id_ns->dps |= NVME_ID_NS_DPS_FIRST_EIGHT;
     }
 
+    static const 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];
         if (lbaf->ds == ds) {
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/3] hw/block/nvme: fixes lbaf formats initialization and adds idns enums
  2021-04-21 12:50 ` [PATCH 0/3] hw/block/nvme: fixes lbaf formats initialization and adds idns enums Gollu Appalanaidu
       [not found]   ` <CGME20210421125424epcas5p4f88500b9f49948e24e6f362375860745@epcas5p4.samsung.com>
@ 2021-05-22  6:48   ` Klaus Jensen
  1 sibling, 0 replies; 3+ messages in thread
From: Klaus Jensen @ 2021-05-22  6:48 UTC (permalink / raw)
  To: Gollu Appalanaidu
  Cc: fam, kwolf, qemu-block, qemu-devel, mreitz, stefanha, kbusch, philmd

[-- Attachment #1: Type: text/plain, Size: 635 bytes --]

On Apr 21 18:20, Gollu Appalanaidu wrote:
>This series fixes the LBAF Formats intialization and Adds the
>Identify Namespace Parameters enums to make to more readable.
>
>Gollu Appalanaidu (3):
>  hw/block/nvme: fix lbaf formats initialization
>  hw/block/nvme: add id ns flbas enum
>  hw/block/nvme: add id ns metadata cap (mc) enum
>
> hw/block/nvme-ns.c   | 51 +++++++++++++++++++-------------------------
> hw/block/nvme-ns.h   |  2 +-
> include/block/nvme.h | 10 ++++++++-
> 3 files changed, 32 insertions(+), 31 deletions(-)
>
>-- 
>2.17.1
>

Thanks, applied this to nvme-next!

I squashed up patch 2 and 3.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-22  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210421125407epcas5p1f843d6b3035e05805de4bb410c93cb71@epcas5p1.samsung.com>
2021-04-21 12:50 ` [PATCH 0/3] hw/block/nvme: fixes lbaf formats initialization and adds idns enums Gollu Appalanaidu
     [not found]   ` <CGME20210421125424epcas5p4f88500b9f49948e24e6f362375860745@epcas5p4.samsung.com>
2021-04-21 12:51     ` [PATCH 1/3] hw/block/nvme: fix lbaf formats initialization Gollu Appalanaidu
2021-05-22  6:48   ` [PATCH 0/3] hw/block/nvme: fixes lbaf formats initialization and adds idns enums Klaus Jensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.