Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] nvme: disable CC.CRIME (NVME_CC_CRIME)
@ 2024-10-07 14:59 gjoyce
  2024-10-07 14:59 ` [PATCH 1/1] " gjoyce
  0 siblings, 1 reply; 3+ messages in thread
From: gjoyce @ 2024-10-07 14:59 UTC (permalink / raw)
  To: linux-nvme
  Cc: kbusch, axboe, hch, sagi, hare, dwagner, msuchanek,
	jonathan.derrick, okozina, nilay, gjoyce

From: Greg Joyce <gjoyce@linux.ibm.com>

NVMe 2.0 introduced a configuration setting CC.CRIME that allows the 
controller to set CSTS.RDY before the media is fully enabled. In this
case commands listed in Figure 103 may return the status
NVME_SC_ADMIN_COMMAND_MEDIA_NOT_READY. The NVMe driver is not coded
to handle these failures so initialization errors occur.

Since the current driver does not:
	1) retry media not ready errors
	2) utilize any parallel initialization that CRIME may provide

setting NVME_CC_CRIME provides no value.

The NVMe 2.0 spec says this about CC.CRIME:
	"If the CAP.CRMS field is set to 11b, then both controller
	 ready modes are supported, and the host may select the
	 controller ready mode by modifying the value of the
	 CC.CRIME bit."

This the CC.CRIME feature is optional and this patch removes it.


Greg Joyce (1):
  nvme: disable CC.CRIME (NVME_CC_CRIME)

 drivers/nvme/host/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
gjoyce@linux.ibm.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] nvme: disable CC.CRIME (NVME_CC_CRIME)
  2024-10-07 14:59 [PATCH 0/1] nvme: disable CC.CRIME (NVME_CC_CRIME) gjoyce
@ 2024-10-07 14:59 ` gjoyce
  2024-10-07 15:05   ` Keith Busch
  0 siblings, 1 reply; 3+ messages in thread
From: gjoyce @ 2024-10-07 14:59 UTC (permalink / raw)
  To: linux-nvme
  Cc: kbusch, axboe, hch, sagi, hare, dwagner, msuchanek,
	jonathan.derrick, okozina, nilay, gjoyce

From: Greg Joyce <gjoyce@linux.ibm.com>

Disable NVME_CC_CRIME so that CSTS.RDY indicates that the media
is ready and able to handle commands without returning
NVME_SC_ADMIN_COMMAND_MEDIA_NOT_READY.

Signed-off-by: Greg Joyce <gjoyce@linux.ibm.com>
---
 drivers/nvme/host/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ba6508455e18..6b313524143a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2458,8 +2458,13 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)
 	else
 		ctrl->ctrl_config = NVME_CC_CSS_NVM;
 
-	if (ctrl->cap & NVME_CAP_CRMS_CRWMS && ctrl->cap & NVME_CAP_CRMS_CRIMS)
-		ctrl->ctrl_config |= NVME_CC_CRIME;
+	/*
+	 * Setting CRIME results in CSTS.RDY before the media is ready. This
+	 * make it possible for media related commands to return the error
+	 * NVME_SC_ADMIN_COMMAND_MEDIA_NOT_READY. Until the driver is
+	 * structured to handle retries, disable CC.CRIME.
+	 */
+	ctrl->ctrl_config &= ~NVME_CC_CRIME;
 
 	ctrl->ctrl_config |= (NVME_CTRL_PAGE_SHIFT - 12) << NVME_CC_MPS_SHIFT;
 	ctrl->ctrl_config |= NVME_CC_AMS_RR | NVME_CC_SHN_NONE;
-- 
gjoyce@linux.ibm.com



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] nvme: disable CC.CRIME (NVME_CC_CRIME)
  2024-10-07 14:59 ` [PATCH 1/1] " gjoyce
@ 2024-10-07 15:05   ` Keith Busch
  0 siblings, 0 replies; 3+ messages in thread
From: Keith Busch @ 2024-10-07 15:05 UTC (permalink / raw)
  To: gjoyce
  Cc: linux-nvme, axboe, hch, sagi, hare, dwagner, msuchanek,
	jonathan.derrick, okozina, nilay

On Mon, Oct 07, 2024 at 09:59:58AM -0500, gjoyce@linux.ibm.com wrote:
> @@ -2458,8 +2458,13 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)
>  	else
>  		ctrl->ctrl_config = NVME_CC_CSS_NVM;
>  
> -	if (ctrl->cap & NVME_CAP_CRMS_CRWMS && ctrl->cap & NVME_CAP_CRMS_CRIMS)
> -		ctrl->ctrl_config |= NVME_CC_CRIME;
> +	/*
> +	 * Setting CRIME results in CSTS.RDY before the media is ready. This
> +	 * make it possible for media related commands to return the error
> +	 * NVME_SC_ADMIN_COMMAND_MEDIA_NOT_READY. Until the driver is
> +	 * structured to handle retries, disable CC.CRIME.
> +	 */
> +	ctrl->ctrl_config &= ~NVME_CC_CRIME;

A little further down in this function, there's a check from CC_CRIME to
know which ready timeout value to use. You can remove that check with
this change.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-07 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 14:59 [PATCH 0/1] nvme: disable CC.CRIME (NVME_CC_CRIME) gjoyce
2024-10-07 14:59 ` [PATCH 1/1] " gjoyce
2024-10-07 15:05   ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox