From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70B951CEAD6; Wed, 23 Oct 2024 14:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729693835; cv=none; b=GrOPneexHQEy6MJIl/ZQGRj6Fet9TQrO1GshFf/B5+cR530JqIdo6gMSs+61t+lAaJ8JAxcxomR7QxC1bIurLX9I9cGZYbu3SZ7DaaT6B7+qz/zHPxUA9rKUj6Tit5fKlL61Oxna94vNy6oH93jn+cVUFpJ7kPqzcV1sR/uAwic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729693835; c=relaxed/simple; bh=g6Cs6W9HJz/dCbEjwEF4R3Gsl0mEw2W7dz7h9ToIdxk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lmIhy1GmuMZxlwo+3m7rW0dm6On7yvUiQjp2+I2H24jopAI2WqjR522sNTf5rodX48QcrufSzJIpy6ReCCtLn6cWFH57p3CiI+2lMrcg1F1Taz9+nU6rv+sX1sE/odEoh3L/uO3Wl+AB2A7tvt/eiOH+CHJ5ZEuyIz8VUER4ZkI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KVS69G4n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KVS69G4n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07A33C4CEC6; Wed, 23 Oct 2024 14:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729693833; bh=g6Cs6W9HJz/dCbEjwEF4R3Gsl0mEw2W7dz7h9ToIdxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KVS69G4neGiehlgeWRsdhe0JAfFNt/Iqd+A43DKXpJ1WMNejulqYh+vcFWu4OlHUv sWjD/DnJOSe4SU5VBtugA2VL6T12G+79ALwL8G2xTtKvwQLjPYaq8EANT1sB2KEuQW A8bbQ0QNdXuUoS9EI8LRfGQdWT7BmeTBbE8rCL4MWQqcf4NS1NrxmKCPfAPLLCLlV9 rgYo7fqzzcDzkm2zDTuvw7gRP1DYU2NqoSVL/jE6E+i3XdB6XR+euNp+hea2LlaD5N 8woVFtcaXALtzsZ0QpIDcaZvC6R3JY4RH5cez6IS8ec00qw8eXNA6Y2Jqt210C9h1J tWoUqVUS5T0dQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Joyce , Nilay Shroff , Keith Busch , Sasha Levin , sagi@grimberg.me, linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 6.11 13/30] nvme: disable CC.CRIME (NVME_CC_CRIME) Date: Wed, 23 Oct 2024 10:29:38 -0400 Message-ID: <20241023143012.2980728-13-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023143012.2980728-1-sashal@kernel.org> References: <20241023143012.2980728-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.11.5 Content-Transfer-Encoding: 8bit From: Greg Joyce [ Upstream commit 0ce96a6708f34280a536263ee5c67e20c433dcce ] 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 Reviewed-by: Nilay Shroff Tested-by: Nilay Shroff Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index a6fb1359a7e14..cc2fabe598d85 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2457,8 +2457,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; @@ -2493,10 +2498,7 @@ 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); + ready_timeout = NVME_CRTO_CRWMT(crto); if (ready_timeout < timeout) dev_warn_once(ctrl->device, "bad crto:%x cap:%llx\n", -- 2.43.0