qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: [PULL v2 09/10] block/nvme: Trace NVMe spec version supported by the controller
Date: Tue,  2 Feb 2021 17:28:33 +0100	[thread overview]
Message-ID: <20210202162834.269789-10-kwolf@redhat.com> (raw)
In-Reply-To: <20210202162834.269789-1-kwolf@redhat.com>

From: Philippe Mathieu-Daudé <philmd@redhat.com>

NVMe controllers implement different versions of the spec,
and different features of it. It is useful to gather this
information when debugging.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210127212137.3482291-3-philmd@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/nvme.c       | 6 ++++++
 block/trace-events | 1 +
 2 files changed, 7 insertions(+)

diff --git a/block/nvme.c b/block/nvme.c
index 80c4318d8f..2b5421e7aa 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -708,6 +708,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     AioContext *aio_context = bdrv_get_aio_context(bs);
     int ret;
     uint64_t cap;
+    uint32_t ver;
     uint64_t timeout_ms;
     uint64_t deadline, now;
     volatile NvmeBar *regs = NULL;
@@ -764,6 +765,11 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     bs->bl.request_alignment = s->page_size;
     timeout_ms = MIN(500 * NVME_CAP_TO(cap), 30000);
 
+    ver = le32_to_cpu(regs->vs);
+    trace_nvme_controller_spec_version(extract32(ver, 16, 16),
+                                       extract32(ver, 8, 8),
+                                       extract32(ver, 0, 8));
+
     /* Reset device to get a clean state. */
     regs->cc = cpu_to_le32(le32_to_cpu(regs->cc) & 0xFE);
     /* Wait for CSTS.RDY = 0. */
diff --git a/block/trace-events b/block/trace-events
index 8368f4acb0..ecbc32a80a 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -136,6 +136,7 @@ qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t len) "s
 # nvme.c
 nvme_controller_capability_raw(uint64_t value) "0x%08"PRIx64
 nvme_controller_capability(const char *desc, uint64_t value) "%s: %"PRIu64
+nvme_controller_spec_version(uint32_t mjr, uint32_t mnr, uint32_t ter) "Specification supported: %u.%u.%u"
 nvme_kick(void *s, unsigned q_index) "s %p q #%u"
 nvme_dma_flush_queue_wait(void *s) "s %p"
 nvme_error(int cmd_specific, int sq_head, int sqid, int cid, int status) "cmd_specific %d sq_head %d sqid %d cid %d status 0x%x"
-- 
2.29.2



  parent reply	other threads:[~2021-02-02 17:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 16:28 [PULL v2 00/10] Block layer patches Kevin Wolf
2021-02-02 16:28 ` [PULL v2 01/10] MAINTAINERS: Add Vladimir as co-maintainer for Block Jobs Kevin Wolf
2021-02-02 16:28 ` [PULL v2 02/10] block: Avoid processing BDS twice in bdrv_set_aio_context_ignore() Kevin Wolf
2021-02-02 16:28 ` [PULL v2 03/10] block: move blk_exp_close_all() to qemu_cleanup() Kevin Wolf
2021-02-02 16:28 ` [PULL v2 04/10] iotests/297: pylint: ignore too many statements Kevin Wolf
2021-02-02 16:28 ` [PULL v2 05/10] iotests: Revert emulator selection to old behaviour Kevin Wolf
2021-02-02 16:28 ` [PULL v2 06/10] iotests: check: return 1 on failure Kevin Wolf
2021-02-02 16:28 ` [PULL v2 07/10] iotests: Fix -makecheck output Kevin Wolf
2021-02-02 16:28 ` [PULL v2 08/10] block/nvme: Properly display doorbell stride length in trace event Kevin Wolf
2021-02-02 16:28 ` Kevin Wolf [this message]
2021-02-02 16:28 ` [PULL v2 10/10] block: Fix VM size column width in bdrv_snapshot_dump() Kevin Wolf
2021-02-02 17:57 ` [PULL v2 00/10] Block layer patches Peter Maydell

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=20210202162834.269789-10-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=peter.maydell@linaro.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).