From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 457BCC433FF for ; Wed, 14 Aug 2019 16:06:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 153CC2083B for ; Wed, 14 Aug 2019 16:06:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=dell.com header.i=@dell.com header.b="Kg7xatec" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728211AbfHNQGE (ORCPT ); Wed, 14 Aug 2019 12:06:04 -0400 Received: from mx0b-00154904.pphosted.com ([148.163.137.20]:9936 "EHLO mx0b-00154904.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfHNQGD (ORCPT ); Wed, 14 Aug 2019 12:06:03 -0400 Received: from pps.filterd (m0170398.ppops.net [127.0.0.1]) by mx0b-00154904.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7EG0ShR006688 for ; Wed, 14 Aug 2019 12:06:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dell.com; h=from : to : cc : subject : date : message-id; s=smtpout1; bh=H42DR47df8ElRFvzxdqBTjD/Mndv2GKa5zPkZ4jEeOE=; b=Kg7xatecRmVWoyvgv6t64Wtg+XTPXrTY7Hh4e2kuYLhbqxwnBfd9Xb82mGRe8vynDrFj Mq6kaqn+lGGTvTCslcHLWQL1V4WI+cx7YuLj0H+hCx3rLjvFc6sAkoyv5fYRt5yWjAz3 +/vlGV/X9ZNc3/0G0jtQL/g0CtC+VU++zoo5HJZeqrJ4wxgkkNrcZ/OeAi+2Fy3EhluJ vxnAA8v53/FP/Rqcx3eEBUjmpVDdYDRa59KgbLI9Zzs5QwEL1cwgUeFhW/XjOvWz68kN caDI42dA7Y6b9SIy9cQEO61UBsrgbeaPykkPOeQhCicJgcAG7goQO28goAGZUxi/zIQP 4g== Received: from mx0b-00154901.pphosted.com (mx0b-00154901.pphosted.com [67.231.157.37]) by mx0b-00154904.pphosted.com with ESMTP id 2uc0y7w94j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 14 Aug 2019 12:06:02 -0400 Received: from pps.filterd (m0144104.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7EFvdnc185530 for ; Wed, 14 Aug 2019 12:06:01 -0400 Received: from ausxipps301.us.dell.com (ausxipps301.us.dell.com [143.166.148.223]) by mx0b-00154901.pphosted.com with ESMTP id 2ucjb3bqp7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 14 Aug 2019 12:06:01 -0400 X-LoopCount0: from 10.173.37.27 X-PREM-Routing: D-Outbound X-IronPort-AV: E=Sophos;i="5.60,349,1549951200"; d="scan'208";a="382587204" From: Mario Limonciello To: Keith Busch Cc: Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, LKML , Ryan Hong , Crag Wang , sjg@google.com, Charles Hyde , Jared Dominguez , Mario Limonciello Subject: [PATCH] nvme: Add quirk for LiteON CL1 devices running FW 22301111 Date: Wed, 14 Aug 2019 11:05:49 -0500 Message-Id: <1565798749-15672-1-git-send-email-mario.limonciello@dell.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-14_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=915 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908140155 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908140155 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org One of the components in LiteON CL1 device has limitations that can be encountered based upon boundary race conditions using the nvme bus specific suspend to idle flow. When this situation occurs the drive doesn't resume properly from suspend-to-idle. LiteON has confirmed this problem and fixed in the next firmware version. As this firmware is already in the field, avoid running nvme specific suspend to idle flow. Fixes: d916b1be94b6 ("nvme-pci: use host managed power state for suspend") Link: http://lists.infradead.org/pipermail/linux-nvme/2019-July/thread.html Signed-off-by: Mario Limonciello Signed-off-by: Charles Hyde --- drivers/nvme/host/core.c | 23 +++++++++++++++++++++++ drivers/nvme/host/nvme.h | 5 +++++ drivers/nvme/host/pci.c | 4 +++- 3 files changed, 31 insertions(+), 1 deletion(-) This patch is the spiritual successor to the previously submitted patch "[PATCH] drivers/nvme: save/restore HMB on suspend/resume". After discussion with LiteON, they agreed to resolve the issue in their next firwmare release. diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8f3fbe5..47c7754 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2251,6 +2251,29 @@ static const struct nvme_core_quirk_entry core_quirks[] = { .vid = 0x1179, .mn = "THNSF5256GPUK TOSHIBA", .quirks = NVME_QUIRK_NO_APST, + }, + /* + * This LiteON CL1 firmware version has a race condition associated with + * actions related to suspend to idle. LiteON has resolved the problem + * in future firmware. + */ + { + .vid = 0x14a4, + .mn = "CL1-3D128-Q11 NVMe LITEON 128GB", + .fr = "22301111", + .quirks = NVME_QUIRK_SIMPLE_SUSPEND, + }, + { + .vid = 0x14a4, + .mn = "CL1-3D256-Q11 NVMe LITEON 256GB", + .fr = "22301111", + .quirks = NVME_QUIRK_SIMPLE_SUSPEND, + }, + { + .vid = 0x14a4, + .mn = "CL1-3D512-Q11 NVMe LITEON 512GB", + .fr = "22301111", + .quirks = NVME_QUIRK_SIMPLE_SUSPEND, } }; diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 26b563f..fe1ca0d 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -92,6 +92,11 @@ enum nvme_quirks { * Broken Write Zeroes. */ NVME_QUIRK_DISABLE_WRITE_ZEROES = (1 << 9), + + /* + * Force simple suspend/resume path. + */ + NVME_QUIRK_SIMPLE_SUSPEND = (1 << 10), }; /* diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 108e109..55effb5 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2847,6 +2847,7 @@ static int nvme_resume(struct device *dev) struct nvme_ctrl *ctrl = &ndev->ctrl; if (ndev->last_ps == U32_MAX || + (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND) || nvme_set_power_state(ctrl, ndev->last_ps) != 0) nvme_reset_ctrl(ctrl); return 0; @@ -2875,7 +2876,8 @@ static int nvme_suspend(struct device *dev) * state (which may not be possible if the link is up). */ if (pm_suspend_via_firmware() || !ctrl->npss || - !pcie_aspm_enabled(pdev)) { + !pcie_aspm_enabled(pdev) || + (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) { nvme_dev_disable(ndev, true); return 0; } -- 2.7.4