[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: |
Maxim Levitsky |
Subject: |
Re: [PATCH v6 12/42] nvme: add support for the get log page command |
Date: |
Tue, 31 Mar 2020 12:45:55 +0300 |
On Tue, 2020-03-31 at 07:41 +0200, Klaus Birkelund Jensen wrote:
> 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.
True that! I'll would rename it to NvmeErrorLogEntry to be honest
(in that patch that added many nvme spec changes) but I don't mind
keeping it as is as well.
>
> >
> > > +
> > > + 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
> >
>
>
Best regards,
Maxim Levitsky
- Re: [PATCH v6 14/42] nvme: add missing mandatory features, (continued)
[PATCH v6 17/42] nvme: add log specific field to trace events, Klaus Jensen, 2020/03/16
[PATCH v6 15/42] nvme: additional tracing, 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 18/42] nvme: support identify namespace descriptor list, Klaus Jensen, 2020/03/16
[PATCH v6 13/42] nvme: add support for the asynchronous event request command, Klaus Jensen, 2020/03/16
[PATCH v6 20/42] nvme: provide the mandatory subnqn field, Klaus Jensen, 2020/03/16
[PATCH v6 19/42] nvme: enforce valid queue creation sequence, Klaus Jensen, 2020/03/16