* [PATCH 2/3] hw/block/nvme: add id ns flbas enum
[not found] <CGME20210421125941epcas5p175aede7ce4b56ac001693172e58dded4@epcas5p1.samsung.com>
@ 2021-04-21 12:56 ` Gollu Appalanaidu
2021-04-22 6:49 ` Klaus Jensen
0 siblings, 1 reply; 2+ messages in thread
From: Gollu Appalanaidu @ 2021-04-21 12:56 UTC (permalink / raw)
To: qemu-devel
Cc: fam, kwolf, qemu-block, Gollu Appalanaidu, mreitz, its, stefanha, kbusch
Add the Identify Namespace FLBAS related enums and remove
NVME_ID_NS_FLBAS_EXTENDEND macro its being used in only
one place and converted into enum.
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
---
hw/block/nvme-ns.c | 2 +-
hw/block/nvme-ns.h | 2 +-
include/block/nvme.h | 5 ++++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
index ae56142fcd..9065a7ae99 100644
--- a/hw/block/nvme-ns.c
+++ b/hw/block/nvme-ns.c
@@ -88,7 +88,7 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
id_ns->mc = 0x3;
if (ms && ns->params.mset) {
- id_ns->flbas |= 0x10;
+ id_ns->flbas |= NVME_ID_NS_FLBAS_EXTENDEND;
}
id_ns->dpc = 0x1f;
diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
index fb0a41f912..5aa36cd1d2 100644
--- a/hw/block/nvme-ns.h
+++ b/hw/block/nvme-ns.h
@@ -134,7 +134,7 @@ static inline size_t nvme_m2b(NvmeNamespace *ns, uint64_t lba)
static inline bool nvme_ns_ext(NvmeNamespace *ns)
{
- return !!NVME_ID_NS_FLBAS_EXTENDED(ns->id_ns.flbas);
+ return ns->id_ns.flbas & NVME_ID_NS_FLBAS_EXTENDEND;
}
/* calculate the number of LBAs that the namespace can accomodate */
diff --git a/include/block/nvme.h b/include/block/nvme.h
index 4ac926fbc6..1d61030756 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -1321,7 +1321,6 @@ typedef struct QEMU_PACKED NvmeIdNsZoned {
#define NVME_ID_NS_NSFEAT_THIN(nsfeat) ((nsfeat & 0x1))
#define NVME_ID_NS_NSFEAT_DULBE(nsfeat) ((nsfeat >> 2) & 0x1)
-#define NVME_ID_NS_FLBAS_EXTENDED(flbas) ((flbas >> 4) & 0x1)
#define NVME_ID_NS_FLBAS_INDEX(flbas) ((flbas & 0xf))
#define NVME_ID_NS_MC_SEPARATE(mc) ((mc >> 1) & 0x1)
#define NVME_ID_NS_MC_EXTENDED(mc) ((mc & 0x1))
@@ -1341,6 +1340,10 @@ enum NvmeIdNsDps {
NVME_ID_NS_DPS_FIRST_EIGHT = 8,
};
+enum NvmeIdNsFlbas {
+ NVME_ID_NS_FLBAS_EXTENDEND = 1 << 4,
+};
+
#define NVME_ID_NS_DPS_TYPE(dps) (dps & NVME_ID_NS_DPS_TYPE_MASK)
typedef struct NvmeDifTuple {
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/3] hw/block/nvme: add id ns flbas enum
2021-04-21 12:56 ` [PATCH 2/3] hw/block/nvme: add id ns flbas enum Gollu Appalanaidu
@ 2021-04-22 6:49 ` Klaus Jensen
0 siblings, 0 replies; 2+ messages in thread
From: Klaus Jensen @ 2021-04-22 6:49 UTC (permalink / raw)
To: Gollu Appalanaidu
Cc: fam, kwolf, qemu-block, qemu-devel, mreitz, stefanha, kbusch
[-- Attachment #1: Type: text/plain, Size: 2362 bytes --]
On Apr 21 18:26, Gollu Appalanaidu wrote:
>Add the Identify Namespace FLBAS related enums and remove
>NVME_ID_NS_FLBAS_EXTENDEND macro its being used in only
>one place and converted into enum.
>
>Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
>---
> hw/block/nvme-ns.c | 2 +-
> hw/block/nvme-ns.h | 2 +-
> include/block/nvme.h | 5 ++++-
> 3 files changed, 6 insertions(+), 3 deletions(-)
>
>diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
>index ae56142fcd..9065a7ae99 100644
>--- a/hw/block/nvme-ns.c
>+++ b/hw/block/nvme-ns.c
>@@ -88,7 +88,7 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
> id_ns->mc = 0x3;
>
> if (ms && ns->params.mset) {
>- id_ns->flbas |= 0x10;
>+ id_ns->flbas |= NVME_ID_NS_FLBAS_EXTENDEND;
> }
>
> id_ns->dpc = 0x1f;
>diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
>index fb0a41f912..5aa36cd1d2 100644
>--- a/hw/block/nvme-ns.h
>+++ b/hw/block/nvme-ns.h
>@@ -134,7 +134,7 @@ static inline size_t nvme_m2b(NvmeNamespace *ns, uint64_t lba)
>
> static inline bool nvme_ns_ext(NvmeNamespace *ns)
> {
>- return !!NVME_ID_NS_FLBAS_EXTENDED(ns->id_ns.flbas);
>+ return ns->id_ns.flbas & NVME_ID_NS_FLBAS_EXTENDEND;
> }
>
> /* calculate the number of LBAs that the namespace can accomodate */
>diff --git a/include/block/nvme.h b/include/block/nvme.h
>index 4ac926fbc6..1d61030756 100644
>--- a/include/block/nvme.h
>+++ b/include/block/nvme.h
>@@ -1321,7 +1321,6 @@ typedef struct QEMU_PACKED NvmeIdNsZoned {
>
> #define NVME_ID_NS_NSFEAT_THIN(nsfeat) ((nsfeat & 0x1))
> #define NVME_ID_NS_NSFEAT_DULBE(nsfeat) ((nsfeat >> 2) & 0x1)
>-#define NVME_ID_NS_FLBAS_EXTENDED(flbas) ((flbas >> 4) & 0x1)
> #define NVME_ID_NS_FLBAS_INDEX(flbas) ((flbas & 0xf))
> #define NVME_ID_NS_MC_SEPARATE(mc) ((mc >> 1) & 0x1)
> #define NVME_ID_NS_MC_EXTENDED(mc) ((mc & 0x1))
>@@ -1341,6 +1340,10 @@ enum NvmeIdNsDps {
> NVME_ID_NS_DPS_FIRST_EIGHT = 8,
> };
>
>+enum NvmeIdNsFlbas {
>+ NVME_ID_NS_FLBAS_EXTENDEND = 1 << 4,
>+};
>+
> #define NVME_ID_NS_DPS_TYPE(dps) (dps & NVME_ID_NS_DPS_TYPE_MASK)
>
> typedef struct NvmeDifTuple {
>--
>2.17.1
>
>
Apart from the misspelling of EXTENDED (I'll fix it up when applied):
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-22 6:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20210421125941epcas5p175aede7ce4b56ac001693172e58dded4@epcas5p1.samsung.com>
2021-04-21 12:56 ` [PATCH 2/3] hw/block/nvme: add id ns flbas enum Gollu Appalanaidu
2021-04-22 6:49 ` Klaus Jensen
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).