From: gjoyce@linux.ibm.com
To: linux-nvme@lists.infradead.org
Cc: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me,
hare@suse.de, dwagner@suse.de, msuchanek@suse.de,
jonathan.derrick@linux.dev, okozina@redhat.com,
nilay@linux.ibm.com, gjoyce@linux.ibm.com
Subject: [PATCH 0/1] nvme: add retry for media not ready error
Date: Mon, 30 Sep 2024 11:48:42 -0500 [thread overview]
Message-ID: <20240930164845.8406-1-gjoyce@linux.ibm.com> (raw)
From: Greg Joyce <gjoyce@linux.ibm.com>
The NVMe host driver sets the config NVME_CC_CRIME if the capablities
NVME_CAP_CRMS_CRWMS and NVME_CAP_CRMS_CRIMS are both set. This config is
written to the controller before NVME_CC_ENABLE is asserted.
The function nvme_wait_ready() then waits for the controller to indicate
CSTS.RDY. Subsequently, SED Opal init code issues a TCG level 0 discovery
command to determine if the NVMe drive is SED capable. However, there is a
period of time between CSTS.RDY and when the commands listed in Figure 103
may not be successfully executed. If the controller is not ready to process
these commands it may return a status code of Admin Command Media Not Ready.
This code is returned for the level 0 discovery and the NVMe driver marks
the drive as not being SED capable even if it is capable. Subsequent calls
to sed_ioctl() all result in failure and a CLI is unable to manage the drive.
The patch proposed here retries security read/write commands if they fail
with NVME_SC_ADMIN_COMMAND_MEDIA_NOT_READY. The maximum retry period is
capped by the value provided by the controller value NVME_CRTO_CRIMT.
------------ relevant NVMe Base Specification version 2.0 passages-----------
Controller Ready Independent of Media Enable (CRIME):
This field controls the controller ready mode. The controller ready
mode is determined by the state of this bit at the time the controller
is enabled by transitioning the CC.EN bit from ‘0’ to ‘1’.
Figure 36: Controller Capabilities
Controllers that support the CRTO register (refer to Figure 62) are
able to indicate larger timeouts for enabling the controller. Host
software should use the value in CRTO.CRWMT or CRTO.CRIMT depending
on the controller ready mode indicated by CC.CRIME to determine the
worst-case timeout for CSTS.RDY to transition from ‘0’ to ‘1’ after
CC.EN transitions from ‘0’ to ‘1’.
Figure 94: Status Code – Generic Command Status Values
Admin Command Media Not Ready: (24h)
The Admin command requires access to media and the media is not ready.
The Do Not Retry bit indicates whether re-issuing the command at a
later time may succeed. This status code shall only be returned:
a) or Admin commands; and
b) if the controller is in Controller Ready Independent of
Media mode (CC.CRIME is bit is set to ‘1’).
Figure 103: Admin Commands Permitted to Return a Status Code of Admin Command
Media Not Ready
Includes Security Send and Security Receive that are used by
TCG Level 0 Discovery.
Greg Joyce (1):
nvme: retry security commands if media not ready
drivers/nvme/host/core.c | 82 ++++++++++++++++++++++++++--------------
1 file changed, 54 insertions(+), 28 deletions(-)
--
gjoyce@linux.ibm.com
next reply other threads:[~2024-09-30 16:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 16:48 gjoyce [this message]
2024-09-30 16:48 ` [PATCH 1/1] nvme: retry security commands if media not ready gjoyce
2024-10-02 8:16 ` Christoph Hellwig
2024-10-02 16:51 ` Greg Joyce
2024-10-03 12:43 ` Christoph Hellwig
2024-10-03 13:30 ` Greg Joyce
2024-10-03 14:41 ` Christoph Hellwig
2024-10-03 23:35 ` Greg Joyce
2024-10-04 5:41 ` Christoph Hellwig
2024-10-04 7:22 ` Nilay Shroff
2024-10-04 12:24 ` Christoph Hellwig
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=20240930164845.8406-1-gjoyce@linux.ibm.com \
--to=gjoyce@linux.ibm.com \
--cc=axboe@fb.com \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jonathan.derrick@linux.dev \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=msuchanek@suse.de \
--cc=nilay@linux.ibm.com \
--cc=okozina@redhat.com \
--cc=sagi@grimberg.me \
/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