All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] hw/block/nvme: misc fixes
@ 2021-01-25  8:22 Klaus Jensen
  2021-01-25  8:22 ` [PATCH 1/3] hw/block/nvme: fix set feature for error recovery Klaus Jensen
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Klaus Jensen @ 2021-01-25  8:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, qemu-block, Klaus Jensen, Max Reitz, Keith Busch,
	Klaus Jensen

From: Klaus Jensen <k.jensen@samsung.com>

Misc fixes from Gollu.

Gollu Appalanaidu (3):
  hw/block/nvme: fix set feature for error recovery
  hw/block/nvme: fix set feature save field check
  hw/block/nvme: align with existing style

 hw/block/nvme.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

-- 
2.30.0



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

* [PATCH 1/3] hw/block/nvme: fix set feature for error recovery
  2021-01-25  8:22 [PATCH 0/3] hw/block/nvme: misc fixes Klaus Jensen
@ 2021-01-25  8:22 ` Klaus Jensen
  2021-01-25  8:22 ` [PATCH 2/3] hw/block/nvme: fix set feature save field check Klaus Jensen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Klaus Jensen @ 2021-01-25  8:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, qemu-block, Klaus Jensen, Gollu Appalanaidu,
	Max Reitz, Keith Busch, Klaus Jensen

From: Gollu Appalanaidu <anaidu.gollu@samsung.com>

Only enable DULBE if the namespace supports it.

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

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 21aec90637fa..e7983ff422f2 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -3396,7 +3396,9 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
         }
 
         assert(ns);
-        ns->features.err_rec = dw11;
+        if (NVME_ID_NS_NSFEAT_DULBE(ns->id_ns.nsfeat))  {
+            ns->features.err_rec = dw11;
+        }
         break;
     case NVME_VOLATILE_WRITE_CACHE:
         for (i = 1; i <= n->num_namespaces; i++) {
-- 
2.30.0



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

* [PATCH 2/3] hw/block/nvme: fix set feature save field check
  2021-01-25  8:22 [PATCH 0/3] hw/block/nvme: misc fixes Klaus Jensen
  2021-01-25  8:22 ` [PATCH 1/3] hw/block/nvme: fix set feature for error recovery Klaus Jensen
@ 2021-01-25  8:22 ` Klaus Jensen
  2021-01-25  8:22 ` [PATCH 3/3] hw/block/nvme: align with existing style Klaus Jensen
  2021-01-25 18:02 ` [PATCH 0/3] hw/block/nvme: misc fixes Keith Busch
  3 siblings, 0 replies; 8+ messages in thread
From: Klaus Jensen @ 2021-01-25  8:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, qemu-block, Klaus Jensen, Gollu Appalanaidu,
	Max Reitz, Keith Busch, Klaus Jensen

From: Gollu Appalanaidu <anaidu.gollu@samsung.com>

Currently, no features are saveable, so the current check is not wrong,
but add a check against the feature capabilities to make sure this will
not regress if saveable features are added later.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
---
 hw/block/nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index e7983ff422f2..1be5b54e0fed 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -3324,7 +3324,7 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
 
     trace_pci_nvme_setfeat(nvme_cid(req), nsid, fid, save, dw11);
 
-    if (save) {
+    if (save && !(nvme_feature_cap[fid] & NVME_FEAT_CAP_SAVE)) {
         return NVME_FID_NOT_SAVEABLE | NVME_DNR;
     }
 
-- 
2.30.0



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

* [PATCH 3/3] hw/block/nvme: align with existing style
  2021-01-25  8:22 [PATCH 0/3] hw/block/nvme: misc fixes Klaus Jensen
  2021-01-25  8:22 ` [PATCH 1/3] hw/block/nvme: fix set feature for error recovery Klaus Jensen
  2021-01-25  8:22 ` [PATCH 2/3] hw/block/nvme: fix set feature save field check Klaus Jensen
@ 2021-01-25  8:22 ` Klaus Jensen
  2021-01-26  4:59   ` Dmitry Fomichev
  2021-01-25 18:02 ` [PATCH 0/3] hw/block/nvme: misc fixes Keith Busch
  3 siblings, 1 reply; 8+ messages in thread
From: Klaus Jensen @ 2021-01-25  8:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, qemu-block, Dmitry Fomichev, Klaus Jensen,
	Gollu Appalanaidu, Max Reitz, Keith Busch, Klaus Jensen

From: Gollu Appalanaidu <anaidu.gollu@samsung.com>

Change status checks to align with the existing style and remove the
explicit check against NVME_SUCCESS.

Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
---
 hw/block/nvme.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 1be5b54e0fed..98d84fe26644 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1198,7 +1198,7 @@ static uint16_t nvme_check_zone_write(NvmeCtrl *n, NvmeNamespace *ns,
         status = nvme_check_zone_state_for_write(zone);
     }
 
-    if (status != NVME_SUCCESS) {
+    if (status) {
         trace_pci_nvme_err_zone_write_not_ok(slba, nlb, status);
     } else {
         assert(nvme_wp_is_valid(zone));
@@ -1253,7 +1253,7 @@ static uint16_t nvme_check_zone_read(NvmeNamespace *ns, uint64_t slba,
     uint16_t status;
 
     status = nvme_check_zone_state_for_read(zone);
-    if (status != NVME_SUCCESS) {
+    if (status) {
         ;
     } else if (unlikely(end > bndry)) {
         if (!ns->params.cross_zone_read) {
@@ -1266,7 +1266,7 @@ static uint16_t nvme_check_zone_read(NvmeNamespace *ns, uint64_t slba,
             do {
                 zone++;
                 status = nvme_check_zone_state_for_read(zone);
-                if (status != NVME_SUCCESS) {
+                if (status) {
                     break;
                 }
             } while (end > nvme_zone_rd_boundary(ns, zone));
@@ -1677,7 +1677,7 @@ static uint16_t nvme_read(NvmeCtrl *n, NvmeRequest *req)
 
     if (ns->params.zoned) {
         status = nvme_check_zone_read(ns, slba, nlb);
-        if (status != NVME_SUCCESS) {
+        if (status) {
             trace_pci_nvme_err_zone_read_not_ok(slba, nlb, status);
             goto invalid;
         }
@@ -1748,12 +1748,12 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
         zone = nvme_get_zone_by_slba(ns, slba);
 
         status = nvme_check_zone_write(n, ns, zone, slba, nlb, append);
-        if (status != NVME_SUCCESS) {
+        if (status) {
             goto invalid;
         }
 
         status = nvme_auto_open_zone(ns, zone);
-        if (status != NVME_SUCCESS) {
+        if (status) {
             goto invalid;
         }
 
@@ -1852,14 +1852,14 @@ static uint16_t nvme_open_zone(NvmeNamespace *ns, NvmeZone *zone,
     switch (state) {
     case NVME_ZONE_STATE_EMPTY:
         status = nvme_aor_check(ns, 1, 0);
-        if (status != NVME_SUCCESS) {
+        if (status) {
             return status;
         }
         nvme_aor_inc_active(ns);
         /* fall through */
     case NVME_ZONE_STATE_CLOSED:
         status = nvme_aor_check(ns, 0, 1);
-        if (status != NVME_SUCCESS) {
+        if (status) {
             if (state == NVME_ZONE_STATE_EMPTY) {
                 nvme_aor_dec_active(ns);
             }
@@ -1972,7 +1972,7 @@ static uint16_t nvme_set_zd_ext(NvmeNamespace *ns, NvmeZone *zone)
 
     if (state == NVME_ZONE_STATE_EMPTY) {
         status = nvme_aor_check(ns, 1, 0);
-        if (status != NVME_SUCCESS) {
+        if (status) {
             return status;
         }
         nvme_aor_inc_active(ns);
@@ -3301,7 +3301,7 @@ static uint16_t nvme_set_feature_timestamp(NvmeCtrl *n, NvmeRequest *req)
 
     ret = nvme_dma(n, (uint8_t *)&timestamp, sizeof(timestamp),
                    DMA_DIRECTION_TO_DEVICE, req);
-    if (ret != NVME_SUCCESS) {
+    if (ret) {
         return ret;
     }
 
-- 
2.30.0



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

* Re: [PATCH 0/3] hw/block/nvme: misc fixes
  2021-01-25  8:22 [PATCH 0/3] hw/block/nvme: misc fixes Klaus Jensen
                   ` (2 preceding siblings ...)
  2021-01-25  8:22 ` [PATCH 3/3] hw/block/nvme: align with existing style Klaus Jensen
@ 2021-01-25 18:02 ` Keith Busch
  2021-01-25 18:07   ` Klaus Jensen
  3 siblings, 1 reply; 8+ messages in thread
From: Keith Busch @ 2021-01-25 18:02 UTC (permalink / raw)
  To: Klaus Jensen; +Cc: Kevin Wolf, Klaus Jensen, qemu-devel, qemu-block, Max Reitz

On Mon, Jan 25, 2021 at 09:22:24AM +0100, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
> 
> Misc fixes from Gollu.

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>


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

* Re: [PATCH 0/3] hw/block/nvme: misc fixes
  2021-01-25 18:02 ` [PATCH 0/3] hw/block/nvme: misc fixes Keith Busch
@ 2021-01-25 18:07   ` Klaus Jensen
  0 siblings, 0 replies; 8+ messages in thread
From: Klaus Jensen @ 2021-01-25 18:07 UTC (permalink / raw)
  To: Keith Busch; +Cc: Kevin Wolf, Klaus Jensen, qemu-devel, qemu-block, Max Reitz

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

On Jan 25 10:02, Keith Busch wrote:
> On Mon, Jan 25, 2021 at 09:22:24AM +0100, Klaus Jensen wrote:
> > From: Klaus Jensen <k.jensen@samsung.com>
> > 
> > Misc fixes from Gollu.
> 
> Looks good.
> 
> Reviewed-by: Keith Busch <kbusch@kernel.org>

Thanks, applied!

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

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

* Re: [PATCH 3/3] hw/block/nvme: align with existing style
  2021-01-25  8:22 ` [PATCH 3/3] hw/block/nvme: align with existing style Klaus Jensen
@ 2021-01-26  4:59   ` Dmitry Fomichev
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Fomichev @ 2021-01-26  4:59 UTC (permalink / raw)
  To: its, qemu-devel; +Cc: kwolf, qemu-block, k.jensen, anaidu.gollu, mreitz, kbusch

On Mon, 2021-01-25 at 09:22 +0100, Klaus Jensen wrote:
> From: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> 
> Change status checks to align with the existing style and remove the
> explicit check against NVME_SUCCESS.
> 
> Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
> Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> Reviewed-by: Klaus Jensen <k.jensen@samsung.com>

Looks good.
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>

> ---
>  hw/block/nvme.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index 1be5b54e0fed..98d84fe26644 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -1198,7 +1198,7 @@ static uint16_t nvme_check_zone_write(NvmeCtrl *n, NvmeNamespace *ns,
>          status = nvme_check_zone_state_for_write(zone);
>      }
>  
> 
> 
> 
> -    if (status != NVME_SUCCESS) {
> +    if (status) {
>          trace_pci_nvme_err_zone_write_not_ok(slba, nlb, status);
>      } else {
>          assert(nvme_wp_is_valid(zone));
> @@ -1253,7 +1253,7 @@ static uint16_t nvme_check_zone_read(NvmeNamespace *ns, uint64_t slba,
>      uint16_t status;
>  
> 
> 
> 
>      status = nvme_check_zone_state_for_read(zone);
> -    if (status != NVME_SUCCESS) {
> +    if (status) {
>          ;
>      } else if (unlikely(end > bndry)) {
>          if (!ns->params.cross_zone_read) {
> @@ -1266,7 +1266,7 @@ static uint16_t nvme_check_zone_read(NvmeNamespace *ns, uint64_t slba,
>              do {
>                  zone++;
>                  status = nvme_check_zone_state_for_read(zone);
> -                if (status != NVME_SUCCESS) {
> +                if (status) {
>                      break;
>                  }
>              } while (end > nvme_zone_rd_boundary(ns, zone));
> @@ -1677,7 +1677,7 @@ static uint16_t nvme_read(NvmeCtrl *n, NvmeRequest *req)
>  
> 
> 
> 
>      if (ns->params.zoned) {
>          status = nvme_check_zone_read(ns, slba, nlb);
> -        if (status != NVME_SUCCESS) {
> +        if (status) {
>              trace_pci_nvme_err_zone_read_not_ok(slba, nlb, status);
>              goto invalid;
>          }
> @@ -1748,12 +1748,12 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
>          zone = nvme_get_zone_by_slba(ns, slba);
>  
> 
> 
> 
>          status = nvme_check_zone_write(n, ns, zone, slba, nlb, append);
> -        if (status != NVME_SUCCESS) {
> +        if (status) {
>              goto invalid;
>          }
>  
> 
> 
> 
>          status = nvme_auto_open_zone(ns, zone);
> -        if (status != NVME_SUCCESS) {
> +        if (status) {
>              goto invalid;
>          }
>  
> 
> 
> 
> @@ -1852,14 +1852,14 @@ static uint16_t nvme_open_zone(NvmeNamespace *ns, NvmeZone *zone,
>      switch (state) {
>      case NVME_ZONE_STATE_EMPTY:
>          status = nvme_aor_check(ns, 1, 0);
> -        if (status != NVME_SUCCESS) {
> +        if (status) {
>              return status;
>          }
>          nvme_aor_inc_active(ns);
>          /* fall through */
>      case NVME_ZONE_STATE_CLOSED:
>          status = nvme_aor_check(ns, 0, 1);
> -        if (status != NVME_SUCCESS) {
> +        if (status) {
>              if (state == NVME_ZONE_STATE_EMPTY) {
>                  nvme_aor_dec_active(ns);
>              }
> @@ -1972,7 +1972,7 @@ static uint16_t nvme_set_zd_ext(NvmeNamespace *ns, NvmeZone *zone)
>  
> 
> 
> 
>      if (state == NVME_ZONE_STATE_EMPTY) {
>          status = nvme_aor_check(ns, 1, 0);
> -        if (status != NVME_SUCCESS) {
> +        if (status) {
>              return status;
>          }
>          nvme_aor_inc_active(ns);
> @@ -3301,7 +3301,7 @@ static uint16_t nvme_set_feature_timestamp(NvmeCtrl *n, NvmeRequest *req)
>  
> 
> 
> 
>      ret = nvme_dma(n, (uint8_t *)&timestamp, sizeof(timestamp),
>                     DMA_DIRECTION_TO_DEVICE, req);
> -    if (ret != NVME_SUCCESS) {
> +    if (ret) {
>          return ret;
>      }
>  
> 
> 
> 


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

* [PATCH 0/3] hw/block/nvme: misc fixes
@ 2021-02-22  7:06 Klaus Jensen
  0 siblings, 0 replies; 8+ messages in thread
From: Klaus Jensen @ 2021-02-22  7:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Fam Zheng, qemu-block, Klaus Jensen, Max Reitz,
	Keith Busch, Stefan Hajnoczi, Klaus Jensen

From: Klaus Jensen <k.jensen@samsung.com>

Small set of misc fixes from Gollu.

Gollu Appalanaidu (3):
  hw/block/nvme: nvme_identify fixes
  hw/block/nvme: fix potential compilation error
  hw/block/nvme: report non-mdts command size limit for dsm

 hw/block/nvme.h       |  1 +
 include/block/nvme.h  | 11 +++++++++++
 hw/block/nvme.c       | 46 +++++++++++++++++++++++++++----------------
 hw/block/trace-events |  2 ++
 4 files changed, 43 insertions(+), 17 deletions(-)

-- 
2.30.1



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

end of thread, other threads:[~2021-02-22  7:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25  8:22 [PATCH 0/3] hw/block/nvme: misc fixes Klaus Jensen
2021-01-25  8:22 ` [PATCH 1/3] hw/block/nvme: fix set feature for error recovery Klaus Jensen
2021-01-25  8:22 ` [PATCH 2/3] hw/block/nvme: fix set feature save field check Klaus Jensen
2021-01-25  8:22 ` [PATCH 3/3] hw/block/nvme: align with existing style Klaus Jensen
2021-01-26  4:59   ` Dmitry Fomichev
2021-01-25 18:02 ` [PATCH 0/3] hw/block/nvme: misc fixes Keith Busch
2021-01-25 18:07   ` Klaus Jensen
2021-02-22  7:06 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.