From 5f1f90d2a3dfa42fcea93e0094b39af9d8af044a Mon Sep 17 00:00:00 2001
From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Date: Mon, 12 Oct 2020 12:54:29 +0530
Subject: [PATCH] nvme: Add quirk for Samsung NVMe 970

It appears like the regular IRQ based suspend resume is broken for
NVMe drives atleast the samsung ones causing the system not to
respond after s2idle resume.

Mostly it ends up timing out on the controller reset which never
succeeeds. As a workaround, use a SIMPLE susped/resume pattern for
the devices whose pm capabilities are broken.

[  154.173886] nvme nvme0: I/O 832 QID 1 timeout, aborting
[  154.173889] nvme nvme0: I/O 20 QID 0 timeout, reset controller
[  154.173903] nvme nvme0: I/O 833 QID 1 timeout, aborting
[  154.173909] nvme nvme0: I/O 834 QID 1 timeout, aborting
[  154.173919] nvme nvme0: I/O 835 QID 1 timeout, aborting
[  154.173924] nvme nvme0: I/O 836 QID 1 timeout, aborting
[  154.173928] nvme nvme0: I/O 837 QID 1 timeout, aborting
[  154.173933] nvme nvme0: I/O 838 QID 1 timeout, aborting
[  154.173937] nvme nvme0: I/O 839 QID 1 timeout, aborting
...
[  154.174844] nvme nvme0: Abort status: 0x371
[  154.174878] PM: dpm_run_callback(): pci_pm_resume+0x0/0x90 returns -16
[  154.175239] PM: Device 0000:03:00.0 failed to resume async: error -16

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/nvme/host/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8caf9b34734dc..9cc797ec582b5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2702,6 +2702,11 @@ static const struct nvme_core_quirk_entry core_quirks[] = {
 		.vid = 0x14a4,
 		.fr = "22301111",
 		.quirks = NVME_QUIRK_SIMPLE_SUSPEND,
+	},
+	{
+		.vid = 0x144d,
+		.fr = "3B7QCXE7",
+		.quirks = NVME_QUIRK_SIMPLE_SUSPEND,
 	}
 };
 
-- 
GitLab