Skip to content

Commit 0ce96a6

Browse files
gjoyce-ibmkeithbusch
authored andcommitted
nvme: disable CC.CRIME (NVME_CC_CRIME)
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 <[email protected]> Reviewed-by: Nilay Shroff <[email protected]> Tested-by: Nilay Shroff <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 9c7072d commit 0ce96a6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/nvme/host/core.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,8 +2458,13 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)
24582458
else
24592459
ctrl->ctrl_config = NVME_CC_CSS_NVM;
24602460

2461-
if (ctrl->cap & NVME_CAP_CRMS_CRWMS && ctrl->cap & NVME_CAP_CRMS_CRIMS)
2462-
ctrl->ctrl_config |= NVME_CC_CRIME;
2461+
/*
2462+
* Setting CRIME results in CSTS.RDY before the media is ready. This
2463+
* makes it possible for media related commands to return the error
2464+
* NVME_SC_ADMIN_COMMAND_MEDIA_NOT_READY. Until the driver is
2465+
* restructured to handle retries, disable CC.CRIME.
2466+
*/
2467+
ctrl->ctrl_config &= ~NVME_CC_CRIME;
24632468

24642469
ctrl->ctrl_config |= (NVME_CTRL_PAGE_SHIFT - 12) << NVME_CC_MPS_SHIFT;
24652470
ctrl->ctrl_config |= NVME_CC_AMS_RR | NVME_CC_SHN_NONE;
@@ -2489,10 +2494,7 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)
24892494
* devices are known to get this wrong. Use the larger of the
24902495
* two values.
24912496
*/
2492-
if (ctrl->ctrl_config & NVME_CC_CRIME)
2493-
ready_timeout = NVME_CRTO_CRIMT(crto);
2494-
else
2495-
ready_timeout = NVME_CRTO_CRWMT(crto);
2497+
ready_timeout = NVME_CRTO_CRWMT(crto);
24962498

24972499
if (ready_timeout < timeout)
24982500
dev_warn_once(ctrl->device, "bad crto:%x cap:%llx\n",

0 commit comments

Comments
 (0)