diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2021-01-27 22:21:37 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2021-02-02 17:05:38 +0100 |
commit | fcc8672aca2902055c03ef79e4c9fcfad0227b70 (patch) | |
tree | db53b2316eb777181d62caa4f2d739019d1927d7 /block/nvme.c | |
parent | 97b709f32ed10a6cd63c3a41755245ec323eedbd (diff) |
block/nvme: Trace NVMe spec version supported by the controller
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>
Diffstat (limited to 'block/nvme.c')
-rw-r--r-- | block/nvme.c | 6 |
1 files changed, 6 insertions, 0 deletions
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. */ |