qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alan Adamson <alan.adamson@oracle.com>
To: qemu-devel@nongnu.org
Cc: alan.adamson@oracle.com, foss@defmacro.it, kbusch@kernel.org,
	its@irrelevant.dk, qemu-block@nongnu.org
Subject: [PATCH 1/1] hw/nvme: create parameter to enable/disable cmic on subsystem
Date: Tue,  8 Apr 2025 15:56:44 -0700	[thread overview]
Message-ID: <20250408225644.814616-2-alan.adamson@oracle.com> (raw)
In-Reply-To: <20250408225644.814616-1-alan.adamson@oracle.com>

Allow the value of CMIC to to be set via a new subsystem specific parameter.
This removes the requirement that all subsystems must have the CMIC bit enabled.

New NVMe Subsystem QEMU Parameter (See NVMe Specification for details):
        <subsystem>,cmic=BOOLEAN (default: off)

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
---
 hw/nvme/ctrl.c   | 5 ++++-
 hw/nvme/nvme.h   | 1 +
 hw/nvme/subsys.c | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 518d02dc6670..ddd3ec15d131 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -8876,7 +8876,10 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
     id->psd[0].enlat = cpu_to_le32(0x10);
     id->psd[0].exlat = cpu_to_le32(0x4);
 
-    id->cmic |= NVME_CMIC_MULTI_CTRL;
+    if (n->subsys->params.cmic) {
+        id->cmic |= NVME_CMIC_MULTI_CTRL;
+    }
+
     ctratt |= NVME_CTRATT_ENDGRPS;
 
     id->endgidmax = cpu_to_le16(0x1);
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 6f782ba18826..437b3e64fcfb 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -116,6 +116,7 @@ typedef struct NvmeSubsystem {
             uint16_t nruh;
             uint32_t nrg;
         } fdp;
+        bool         cmic;
     } params;
 } NvmeSubsystem;
 
diff --git a/hw/nvme/subsys.c b/hw/nvme/subsys.c
index 2ae56f12a596..ea6687c7ee6c 100644
--- a/hw/nvme/subsys.c
+++ b/hw/nvme/subsys.c
@@ -223,6 +223,7 @@ static const Property nvme_subsystem_props[] = {
                      NVME_DEFAULT_RU_SIZE),
     DEFINE_PROP_UINT32("fdp.nrg", NvmeSubsystem, params.fdp.nrg, 1),
     DEFINE_PROP_UINT16("fdp.nruh", NvmeSubsystem, params.fdp.nruh, 0),
+    DEFINE_PROP_BOOL("cmic", NvmeSubsystem, params.cmic, false),
 };
 
 static void nvme_subsys_class_init(ObjectClass *oc, void *data)
-- 
2.43.5



  reply	other threads:[~2025-04-08 22:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 22:56 [PATCH 0/1] hw/nvme: create parameter to enable/disable cmic on subsystem Alan Adamson
2025-04-08 22:56 ` Alan Adamson [this message]
2025-04-09  6:47 ` Klaus Jensen
2025-04-09 23:37   ` alan.adamson

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=20250408225644.814616-2-alan.adamson@oracle.com \
    --to=alan.adamson@oracle.com \
    --cc=foss@defmacro.it \
    --cc=its@irrelevant.dk \
    --cc=kbusch@kernel.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).