Commit 0ce96a67 authored by Greg Joyce's avatar Greg Joyce Committed by Keith Busch
Browse files

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: default avatarGreg Joyce <gjoyce@linux.ibm.com>
Reviewed-by: default avatarNilay Shroff <nilay@linux.ibm.com>
Tested-by: default avatarNilay Shroff <nilay@linux.ibm.com>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent 9c7072df
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -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
	 * makes it possible for media related commands to return the error
	 * NVME_SC_ADMIN_COMMAND_MEDIA_NOT_READY. Until the driver is
	 * restructured 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;
@@ -2489,9 +2494,6 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)
		 * devices are known to get this wrong. Use the larger of the
		 * two values.
		 */
		if (ctrl->ctrl_config & NVME_CC_CRIME)
			ready_timeout = NVME_CRTO_CRIMT(crto);
		else
		ready_timeout = NVME_CRTO_CRWMT(crto);

		if (ready_timeout < timeout)