qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters
@ 2025-06-02 23:04 Alan Adamson
  2025-06-02 23:04 ` [PATCH 1/2] hw/nvme: enable ns atomic writes Alan Adamson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alan Adamson @ 2025-06-02 23:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: alan.adamson, foss, kbusch, its, qemu-block

This patch set is a follow on to commit ebd1568fc732 ("hw/nvme: add atomic
write support").  These patches introduces two updates to the NVMe subsystem in QEMU,
both aimed at enhancing atomic write support for namespaces.

hw/nvme: enable ns atomic writes
--------------------------------
This patch introduces support for namespace-specific atomic write parameters: NAWUN
and NAWUPF, as defined by the NVMe specification. The atomic parameters are
utilized to guarantee that writes conforming to these boundaries will be atomic,
improving data integrity for namespaces that require atomic operations.

The patch introduces new NVMe QEMU parameters:
	atomic.nawun (default: 0)
	atomic.nawupf (default: 0)
	atomic.nsfeat (default: off)

The addition of atomic.nsfeat sets the Namespace Supported Atomic Boundary &
Power (NSABP) bit in the Identify Namespace Data Structure, enabling namespace-specific
atomic write features. The patch also ensures that atomic write behavior adheres to the
NACWU and NAWUPF parameters.

hw/nvme: add atomic boundary support
------------------------------------
The second patch expands on the atomic write capabilities by adding support for atomic
boundary parameters: NABO, NABSN, and NABSPF. These parameters define the atomic
boundary size for writes and ensure that any writes crossing these boundaries are
treated atomically, based on the AWUN and AWUPF values.

The following parameters are added:
	atomic.nabo (default: 0)
	atomic.nabsn (default: 0)
	atomic.nabspf (default: 0)

If the atomic boundary is crossed, the writes are guaranteed to be atomic only if their
size does not exceed the values defined by AWUN and AWUPF. This ensures that larger
writes crossing atomic boundaries are not subject to partial updates, thereby improving
the robustness of atomic operations across boundaries.

See the NVMe Specification for more information.

Alan Adamson (2):
  hw/nvme: enable ns atomic writes
  hw/nvme: add atomic boundary support

 hw/nvme/ctrl.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/nvme/ns.c   | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
 hw/nvme/nvme.h | 14 ++++++++++
 3 files changed, 164 insertions(+)

-- 
2.43.5



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

* [PATCH 1/2] hw/nvme: enable ns atomic writes
  2025-06-02 23:04 [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters Alan Adamson
@ 2025-06-02 23:04 ` Alan Adamson
  2025-06-02 23:04 ` [PATCH 2/2] hw/nvme: add atomic boundary support Alan Adamson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alan Adamson @ 2025-06-02 23:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: alan.adamson, foss, kbusch, its, qemu-block

Add support for the namespace atomic paramters: NAWUN and NAWUN. Namespace
Atomic Compare and Write Unit (NACWU) is not currently supported.

Writes that adhere to the NACWU and NAWUPF parameters are guaranteed to be
atomic.

New NVMe QEMU Paramters (See NVMe Specification for details):
        atomic.nawun=UINT16 (default: 0)
        atomic.nawupf=UINT16 (default: 0)
        atomic.nsfeat (default off) - Set Namespace Supported Atomic Boundary &
                Power (NSABP) bit in Namespace Features (NSFEAT) in the Identify
                Namespace Data Structure

See the NVMe Specification for more information.

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
---
 hw/nvme/ctrl.c | 23 +++++++++++++++++++++++
 hw/nvme/ns.c   | 38 ++++++++++++++++++++++++++++++++++++++
 hw/nvme/nvme.h |  6 ++++++
 3 files changed, 67 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index fd935507bc02..a2dd50f3af43 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -6703,6 +6703,23 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
         } else {
             atomic->atomic_writes = 1;
         }
+        for (i = 1; i <= NVME_MAX_NAMESPACES; i++) {
+            ns = nvme_ns(n, i);
+            if (ns && ns->atomic.atomic_writes) {
+                if (n->dn) {
+                    ns->atomic.atomic_max_write_size =
+                        le16_to_cpu(ns->id_ns.nawupf) + 1;
+                } else {
+                    ns->atomic.atomic_max_write_size =
+                        le16_to_cpu(ns->id_ns.nawun) + 1;
+                }
+                if (ns->atomic.atomic_max_write_size == 1) {
+                    ns->atomic.atomic_writes = 0;
+                } else {
+                    ns->atomic.atomic_writes = 1;
+                }
+            }
+        }
         break;
     default:
         return NVME_FEAT_NOT_CHANGEABLE | NVME_DNR;
@@ -7477,6 +7494,12 @@ static int nvme_atomic_write_check(NvmeCtrl *n, NvmeCmd *cmd,
 
 static NvmeAtomic *nvme_get_atomic(NvmeCtrl *n, NvmeCmd *cmd)
 {
+    NvmeNamespace *ns = nvme_ns(n, cmd->nsid);
+
+    if (ns && ns->atomic.atomic_writes) {
+        return &ns->atomic;
+    }
+
     if (n->atomic.atomic_writes) {
         return &n->atomic;
     }
diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index 6df2e8e7c5ac..28aacb8db59a 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -724,11 +724,46 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
     BusState *s = qdev_get_parent_bus(dev);
     NvmeCtrl *n = NVME(s->parent);
     NvmeSubsystem *subsys = n->subsys;
+    NvmeIdCtrl *id = &n->id_ctrl;
+    NvmeIdNs *id_ns = &ns->id_ns;
     uint32_t nsid = ns->params.nsid;
     int i;
 
     assert(subsys);
 
+    /* Set atomic write parameters */
+    if (ns->params.atomic_nsfeat) {
+        id_ns->nsfeat |= NVME_ID_NS_NSFEAT_NSABPNS;
+        id_ns->nawun = cpu_to_le16(ns->params.atomic_nawun);
+        if (!id->awupf || (id_ns->nawun && (id_ns->nawun < id->awun))) {
+            error_report("Invalid NAWUN: %x AWUN=%x", id_ns->nawun, id->awun);
+        }
+        id_ns->nawupf = cpu_to_le16(ns->params.atomic_nawupf);
+        if (!id->awupf || (id_ns->nawupf && (id_ns->nawupf < id->awupf))) {
+            error_report("Invalid NAWUPF: %x AWUPF=%x",
+                id_ns->nawupf, id->awupf);
+        }
+        if (id_ns->nawupf > id_ns->nawun) {
+            error_report("Invalid: NAWUN=%x NAWUPF=%x",
+                id_ns->nawun, id_ns->nawupf);
+        }
+    }
+
+    if (id_ns->nawun || id_ns->nawupf) {
+        NvmeAtomic *atomic = &ns->atomic;
+
+        if (n->dn) {
+            atomic->atomic_max_write_size = cpu_to_le16(id_ns->nawupf) + 1;
+        } else {
+            atomic->atomic_max_write_size = cpu_to_le16(id_ns->nawun) + 1;
+        }
+        if (atomic->atomic_max_write_size == 1) {
+            atomic->atomic_writes = 0;
+        } else {
+            atomic->atomic_writes = 1;
+        }
+    }
+
     /* reparent to subsystem bus */
     if (!qdev_set_parent_bus(dev, &subsys->bus.parent_bus, errp)) {
         return;
@@ -804,6 +839,9 @@ static const Property nvme_ns_props[] = {
     DEFINE_PROP_BOOL("eui64-default", NvmeNamespace, params.eui64_default,
                      false),
     DEFINE_PROP_STRING("fdp.ruhs", NvmeNamespace, params.fdp.ruhs),
+    DEFINE_PROP_UINT16("atomic.nawun", NvmeNamespace, params.atomic_nawun, 0),
+    DEFINE_PROP_UINT16("atomic.nawupf", NvmeNamespace, params.atomic_nawupf, 0),
+    DEFINE_PROP_BOOL("atomic.nsfeat", NvmeNamespace, params.atomic_nsfeat, 0),
 };
 
 static void nvme_ns_class_init(ObjectClass *oc, const void *data)
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index b5c9378ea4e5..4ac9bd7e6a25 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -218,6 +218,9 @@ typedef struct NvmeNamespaceParams {
     struct {
         char *ruhs;
     } fdp;
+    uint16_t atomic_nawun;
+    uint16_t atomic_nawupf;
+    bool     atomic_nsfeat;
 } NvmeNamespaceParams;
 
 typedef struct NvmeAtomic {
@@ -280,6 +283,9 @@ typedef struct NvmeNamespace {
         /* reclaim unit handle identifiers indexed by placement handle */
         uint16_t *phs;
     } fdp;
+    uint16_t  atomic_nawun;
+    uint16_t  atomic_nawupf;
+    NvmeAtomic  atomic;
 } NvmeNamespace;
 
 static inline uint32_t nvme_nsid(NvmeNamespace *ns)
-- 
2.43.5



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

* [PATCH 2/2] hw/nvme: add atomic boundary support
  2025-06-02 23:04 [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters Alan Adamson
  2025-06-02 23:04 ` [PATCH 1/2] hw/nvme: enable ns atomic writes Alan Adamson
@ 2025-06-02 23:04 ` Alan Adamson
  2025-09-23 15:23 ` [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters Jesper Devantier
  2025-10-30  8:08 ` Klaus Jensen
  3 siblings, 0 replies; 5+ messages in thread
From: Alan Adamson @ 2025-06-02 23:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: alan.adamson, foss, kbusch, its, qemu-block

Add support for the namespace atomic boundary paramters: NABO, NABSN, and NABSPF.

Writes that cross an atomic boundary whose size is less than or equal to values
reported by AWUN/AWUPF are guaranteed to be atomic. If AWUN/AWUPF is set to zero,
writes that cross an atomic boundary are not guaranteed to be atomic.

The value reported by NABO field indicates the LBA on this namespace where the
first atomic boundary starts.

New NVMe QEMU Paramters (See NVMe Specification for details):
        atomic.nabo=UINT16 (default: 0)
        atomic.nabsn=UINT16 (default: 0)
        atomic.nabspf=UINT16 (default: 0)

See the NVMe Specification for more information.

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
---
 hw/nvme/ctrl.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/nvme/ns.c   | 36 ++++++++++++++++++++++++++++++++++
 hw/nvme/nvme.h |  8 ++++++++
 3 files changed, 97 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index a2dd50f3af43..a5a9540a21a5 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -6709,9 +6709,21 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
                 if (n->dn) {
                     ns->atomic.atomic_max_write_size =
                         le16_to_cpu(ns->id_ns.nawupf) + 1;
+                    if (ns->id_ns.nabspf) {
+                        ns->atomic.atomic_boundary =
+                            le16_to_cpu(ns->id_ns.nabspf) + 1;
+                    } else {
+                        ns->atomic.atomic_boundary = 0;
+                    }
                 } else {
                     ns->atomic.atomic_max_write_size =
                         le16_to_cpu(ns->id_ns.nawun) + 1;
+                    if (ns->id_ns.nabsn) {
+                        ns->atomic.atomic_boundary =
+                            le16_to_cpu(ns->id_ns.nabsn) + 1;
+                    } else {
+                        ns->atomic.atomic_boundary = 0;
+                    }
                 }
                 if (ns->atomic.atomic_max_write_size == 1) {
                     ns->atomic.atomic_writes = 0;
@@ -7425,6 +7437,36 @@ static void nvme_update_sq_tail(NvmeSQueue *sq)
     trace_pci_nvme_update_sq_tail(sq->sqid, sq->tail);
 }
 
+static int nvme_atomic_boundary_check(NvmeCtrl *n, NvmeCmd *cmd,
+    NvmeAtomic *atomic)
+{
+    NvmeRwCmd *rw = (NvmeRwCmd *)cmd;
+
+    if (atomic->atomic_boundary) {
+        uint64_t slba = le64_to_cpu(rw->slba);
+        uint32_t nlb = (uint32_t)le16_to_cpu(rw->nlb);
+        uint64_t elba = slba + nlb;
+        uint64_t imask;
+
+        if ((slba < atomic->atomic_nabo) || (elba < atomic->atomic_nabo)) {
+            return 0;
+        }
+
+        /* Update slba/elba based on boundary offset */
+        slba = slba - atomic->atomic_nabo;
+        elba = slba + nlb;
+
+        imask = ~(atomic->atomic_boundary - 1);
+        if ((slba & imask) != (elba & imask)) {
+            if (n->atomic.atomic_max_write_size &&
+                ((nlb + 1) <= n->atomic.atomic_max_write_size)) {
+                return 1;
+            }
+            return 0;
+        }
+    }
+    return 1;
+}
 #define NVME_ATOMIC_NO_START        0
 #define NVME_ATOMIC_START_ATOMIC    1
 #define NVME_ATOMIC_START_NONATOMIC 2
@@ -7444,6 +7486,15 @@ static int nvme_atomic_write_check(NvmeCtrl *n, NvmeCmd *cmd,
         cmd_atomic_wr = false;
     }
 
+    /*
+     * Check if a write crosses an atomic boundary.
+     */
+    if (cmd->opcode == NVME_CMD_WRITE) {
+        if (!nvme_atomic_boundary_check(n, cmd, atomic)) {
+            cmd_atomic_wr = false;
+        }
+    }
+
     /*
      * Walk the queues to see if there are any atomic conflicts.
      */
@@ -8523,6 +8574,8 @@ static void nvme_init_state(NvmeCtrl *n)
         } else {
             atomic->atomic_writes = 1;
         }
+        atomic->atomic_boundary = 0;
+        atomic->atomic_nabo = 0;
     }
 }
 
diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index 28aacb8db59a..86f5ab0a7572 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -747,6 +747,28 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
             error_report("Invalid: NAWUN=%x NAWUPF=%x",
                 id_ns->nawun, id_ns->nawupf);
         }
+        id_ns->nabsn = cpu_to_le16(ns->params.atomic_nabsn);
+        id_ns->nabspf = cpu_to_le16(ns->params.atomic_nabspf);
+        id_ns->nabo = cpu_to_le16(ns->params.atomic_nabo);
+        if (!id->awun || (id_ns->nabsn && ((id_ns->nabsn < id_ns->nawun) ||
+            (id_ns->nabsn < id->awun)))) {
+            error_report("Invalid NABSN: %x NAWUN=%x AWUN=%x",
+                id_ns->nabsn, id_ns->nawun, id->awun);
+        }
+        if (!id->awupf || (id_ns->nabspf && ((id_ns->nabspf < id_ns->nawupf) ||
+            (id_ns->nawupf < id->awupf)))) {
+            error_report("Invalid NABSPF: %x NAWUPF=%x AWUPF=%x",
+                id_ns->nabspf, id_ns->nawupf, id->awupf);
+        }
+        if (id_ns->nabo && ((id_ns->nabo > id_ns->nabsn) ||
+            (id_ns->nabo > id_ns->nabspf))) {
+            error_report("Invalid NABO: %x NABSN=%x NABSPF=%x",
+                id_ns->nabo, id_ns->nabsn, id_ns->nabspf);
+        }
+        if (id_ns->nawupf > id_ns->nawun) {
+            error_report("Invalid: NAWUN=%x NAWUPF=%x", id_ns->nawun,
+                id_ns->nawupf);
+        }
     }
 
     if (id_ns->nawun || id_ns->nawupf) {
@@ -754,14 +776,25 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
 
         if (n->dn) {
             atomic->atomic_max_write_size = cpu_to_le16(id_ns->nawupf) + 1;
+            if (id_ns->nabspf) {
+                atomic->atomic_boundary = cpu_to_le16(id_ns->nabspf) + 1;
+            } else {
+                atomic->atomic_boundary = 0;
+            }
         } else {
             atomic->atomic_max_write_size = cpu_to_le16(id_ns->nawun) + 1;
+            if (id_ns->nabsn) {
+                atomic->atomic_boundary = cpu_to_le16(id_ns->nabsn) + 1;
+            } else {
+                atomic->atomic_boundary = 0;
+            }
         }
         if (atomic->atomic_max_write_size == 1) {
             atomic->atomic_writes = 0;
         } else {
             atomic->atomic_writes = 1;
         }
+        atomic->atomic_nabo = cpu_to_le16(id_ns->nabo);
     }
 
     /* reparent to subsystem bus */
@@ -841,6 +874,9 @@ static const Property nvme_ns_props[] = {
     DEFINE_PROP_STRING("fdp.ruhs", NvmeNamespace, params.fdp.ruhs),
     DEFINE_PROP_UINT16("atomic.nawun", NvmeNamespace, params.atomic_nawun, 0),
     DEFINE_PROP_UINT16("atomic.nawupf", NvmeNamespace, params.atomic_nawupf, 0),
+    DEFINE_PROP_UINT16("atomic.nabspf", NvmeNamespace, params.atomic_nabspf, 0),
+    DEFINE_PROP_UINT16("atomic.nabsn", NvmeNamespace, params.atomic_nabsn, 0),
+    DEFINE_PROP_UINT16("atomic.nabo", NvmeNamespace, params.atomic_nabo, 0),
     DEFINE_PROP_BOOL("atomic.nsfeat", NvmeNamespace, params.atomic_nsfeat, 0),
 };
 
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 4ac9bd7e6a25..1045cbf2206e 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -220,11 +220,16 @@ typedef struct NvmeNamespaceParams {
     } fdp;
     uint16_t atomic_nawun;
     uint16_t atomic_nawupf;
+    uint16_t atomic_nabsn;
+    uint16_t atomic_nabspf;
+    uint16_t atomic_nabo;
     bool     atomic_nsfeat;
 } NvmeNamespaceParams;
 
 typedef struct NvmeAtomic {
     uint32_t    atomic_max_write_size;
+    uint64_t    atomic_boundary;
+    uint64_t    atomic_nabo;
     bool        atomic_writes;
 } NvmeAtomic;
 
@@ -285,6 +290,9 @@ typedef struct NvmeNamespace {
     } fdp;
     uint16_t  atomic_nawun;
     uint16_t  atomic_nawupf;
+    uint16_t  atomic_nabsn;
+    uint16_t  atomic_nabspf;
+    uint16_t  atomic_nabo;
     NvmeAtomic  atomic;
 } NvmeNamespace;
 
-- 
2.43.5



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

* Re: [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters
  2025-06-02 23:04 [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters Alan Adamson
  2025-06-02 23:04 ` [PATCH 1/2] hw/nvme: enable ns atomic writes Alan Adamson
  2025-06-02 23:04 ` [PATCH 2/2] hw/nvme: add atomic boundary support Alan Adamson
@ 2025-09-23 15:23 ` Jesper Devantier
  2025-10-30  8:08 ` Klaus Jensen
  3 siblings, 0 replies; 5+ messages in thread
From: Jesper Devantier @ 2025-09-23 15:23 UTC (permalink / raw)
  To: Alan Adamson, qemu-devel
  Cc: kbusch, its, qemu-block,
	qemu-devel-bounces+qemu-devel=archiver.kernel.org

On Tue Jun 3, 2025 at 1:04 AM CEST, Alan Adamson wrote:
> This patch set is a follow on to commit ebd1568fc732 ("hw/nvme: add atomic
> write support").  These patches introduces two updates to the NVMe subsystem in QEMU,
> both aimed at enhancing atomic write support for namespaces.
>
> hw/nvme: enable ns atomic writes
> --------------------------------
> This patch introduces support for namespace-specific atomic write parameters: NAWUN
> and NAWUPF, as defined by the NVMe specification. The atomic parameters are
> utilized to guarantee that writes conforming to these boundaries will be atomic,
> improving data integrity for namespaces that require atomic operations.
>
> The patch introduces new NVMe QEMU parameters:
> 	atomic.nawun (default: 0)
> 	atomic.nawupf (default: 0)
> 	atomic.nsfeat (default: off)
>
> The addition of atomic.nsfeat sets the Namespace Supported Atomic Boundary &
> Power (NSABP) bit in the Identify Namespace Data Structure, enabling namespace-specific
> atomic write features. The patch also ensures that atomic write behavior adheres to the
> NACWU and NAWUPF parameters.
>
> hw/nvme: add atomic boundary support
> ------------------------------------
> The second patch expands on the atomic write capabilities by adding support for atomic
> boundary parameters: NABO, NABSN, and NABSPF. These parameters define the atomic
> boundary size for writes and ensure that any writes crossing these boundaries are
> treated atomically, based on the AWUN and AWUPF values.
>
> The following parameters are added:
> 	atomic.nabo (default: 0)
> 	atomic.nabsn (default: 0)
> 	atomic.nabspf (default: 0)
>
> If the atomic boundary is crossed, the writes are guaranteed to be atomic only if their
> size does not exceed the values defined by AWUN and AWUPF. This ensures that larger
> writes crossing atomic boundaries are not subject to partial updates, thereby improving
> the robustness of atomic operations across boundaries.
>
> See the NVMe Specification for more information.
>
> Alan Adamson (2):
>   hw/nvme: enable ns atomic writes
>   hw/nvme: add atomic boundary support
>
>  hw/nvme/ctrl.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  hw/nvme/ns.c   | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
>  hw/nvme/nvme.h | 14 ++++++++++
>  3 files changed, 164 insertions(+)

Follows the spec far as I can see.
Read the code, seems good

Reviewed-by: Jesper Wendel Devantier <foss@defmacro.it>


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

* Re: [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters
  2025-06-02 23:04 [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters Alan Adamson
                   ` (2 preceding siblings ...)
  2025-09-23 15:23 ` [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters Jesper Devantier
@ 2025-10-30  8:08 ` Klaus Jensen
  3 siblings, 0 replies; 5+ messages in thread
From: Klaus Jensen @ 2025-10-30  8:08 UTC (permalink / raw)
  To: Alan Adamson; +Cc: qemu-devel, foss, kbusch, qemu-block

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

On Jun  2 16:04, Alan Adamson wrote:
> This patch set is a follow on to commit ebd1568fc732 ("hw/nvme: add atomic
> write support").  These patches introduces two updates to the NVMe subsystem in QEMU,
> both aimed at enhancing atomic write support for namespaces.
> 
> hw/nvme: enable ns atomic writes
> --------------------------------
> This patch introduces support for namespace-specific atomic write parameters: NAWUN
> and NAWUPF, as defined by the NVMe specification. The atomic parameters are
> utilized to guarantee that writes conforming to these boundaries will be atomic,
> improving data integrity for namespaces that require atomic operations.
> 
> The patch introduces new NVMe QEMU parameters:
> 	atomic.nawun (default: 0)
> 	atomic.nawupf (default: 0)
> 	atomic.nsfeat (default: off)
> 
> The addition of atomic.nsfeat sets the Namespace Supported Atomic Boundary &
> Power (NSABP) bit in the Identify Namespace Data Structure, enabling namespace-specific
> atomic write features. The patch also ensures that atomic write behavior adheres to the
> NACWU and NAWUPF parameters.
> 
> hw/nvme: add atomic boundary support
> ------------------------------------
> The second patch expands on the atomic write capabilities by adding support for atomic
> boundary parameters: NABO, NABSN, and NABSPF. These parameters define the atomic
> boundary size for writes and ensure that any writes crossing these boundaries are
> treated atomically, based on the AWUN and AWUPF values.
> 
> The following parameters are added:
> 	atomic.nabo (default: 0)
> 	atomic.nabsn (default: 0)
> 	atomic.nabspf (default: 0)
> 
> If the atomic boundary is crossed, the writes are guaranteed to be atomic only if their
> size does not exceed the values defined by AWUN and AWUPF. This ensures that larger
> writes crossing atomic boundaries are not subject to partial updates, thereby improving
> the robustness of atomic operations across boundaries.
> 
> See the NVMe Specification for more information.
> 
> Alan Adamson (2):
>   hw/nvme: enable ns atomic writes
>   hw/nvme: add atomic boundary support
> 
>  hw/nvme/ctrl.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  hw/nvme/ns.c   | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
>  hw/nvme/nvme.h | 14 ++++++++++
>  3 files changed, 164 insertions(+)
> 
> -- 
> 2.43.5
> 

Reviewed-by: Klaus Jensen <k.jensen@samsung.com>

Thanks Alan; merged!

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

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

end of thread, other threads:[~2025-10-30  8:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-02 23:04 [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters Alan Adamson
2025-06-02 23:04 ` [PATCH 1/2] hw/nvme: enable ns atomic writes Alan Adamson
2025-06-02 23:04 ` [PATCH 2/2] hw/nvme: add atomic boundary support Alan Adamson
2025-09-23 15:23 ` [PATCH 0/2] Add support for NVMe Namespace and Boundary Atomic Parameters Jesper Devantier
2025-10-30  8:08 ` 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).