[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 12/42] nvme: add support for the get log page command
From: |
Klaus Birkelund Jensen |
Subject: |
Re: [PATCH v6 12/42] nvme: add support for the get log page command |
Date: |
Tue, 31 Mar 2020 07:41:09 +0200 |
On Mar 25 12:40, Maxim Levitsky wrote:
> On Mon, 2020-03-16 at 07:28 -0700, Klaus Jensen wrote:
> > From: Klaus Jensen <address@hidden>
> >
> > Add support for the Get Log Page command and basic implementations of
> > the mandatory Error Information, SMART / Health Information and Firmware
> > Slot Information log pages.
> >
> > In violation of the specification, the SMART / Health Information log
> > page does not persist information over the lifetime of the controller
> > because the device has no place to store such persistent state.
> >
> > Note that the LPA field in the Identify Controller data structure
> > intentionally has bit 0 cleared because there is no namespace specific
> > information in the SMART / Health information log page.
> >
> > Required for compliance with NVMe revision 1.2.1. See NVM Express 1.2.1,
> > Section 5.10 ("Get Log Page command").
> >
> > Signed-off-by: Klaus Jensen <address@hidden>
> > Acked-by: Keith Busch <address@hidden>
> > ---
> > hw/block/nvme.c | 138 +++++++++++++++++++++++++++++++++++++++++-
> > hw/block/nvme.h | 10 +++
> > hw/block/trace-events | 2 +
> > 3 files changed, 149 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> > index 64c42101df5c..83ff3fbfb463 100644
> >
> > +static uint16_t nvme_error_info(NvmeCtrl *n, NvmeCmd *cmd, uint32_t
> > buf_len,
> > + uint64_t off, NvmeRequest *req)
> > +{
> > + uint32_t trans_len;
> > + uint64_t prp1 = le64_to_cpu(cmd->dptr.prp1);
> > + uint64_t prp2 = le64_to_cpu(cmd->dptr.prp2);
> > + uint8_t errlog[64];
> I'll would replace this with sizeof(NvmeErrorLogEntry)
> (and add NvmeErrorLogEntry to the nvme.h), just for the sake of consistency,
> and in case we end up reporting some errors to the log in the future.
>
NvmeErrorLog is already in nvme.h; Fixed to actually use it.
>
> > +
> > + if (off > sizeof(errlog)) {
> > + return NVME_INVALID_FIELD | NVME_DNR;
> > + }
> > +
> > + memset(errlog, 0x0, sizeof(errlog));
> > +
> > + trans_len = MIN(sizeof(errlog) - off, buf_len);
> > +
> > + return nvme_dma_read_prp(n, errlog, trans_len, prp1, prp2);
> > +}
> Besides this, looks good now.
>
>
> Best regards,
> Maxim Levitsky
>
- Re: [PATCH v6 11/42] nvme: add temperature threshold feature, (continued)
[PATCH v6 16/42] nvme: make sure ncqr and nsqr is valid, Klaus Jensen, 2020/03/16
[PATCH v6 18/42] nvme: support identify namespace descriptor list, Klaus Jensen, 2020/03/16
[PATCH v6 17/42] nvme: add log specific field to trace events, Klaus Jensen, 2020/03/16
[PATCH v6 12/42] nvme: add support for the get log page command, Klaus Jensen, 2020/03/16
[PATCH v6 15/42] nvme: additional tracing, Klaus Jensen, 2020/03/16
[PATCH v6 14/42] nvme: add missing mandatory features, Klaus Jensen, 2020/03/16
[PATCH v6 13/42] nvme: add support for the asynchronous event request command, Klaus Jensen, 2020/03/16