Skip to contentSkip to conversation

nvme: put some AMD PCIE downstream NVME device to simple suspend/resume path

PATCH Superseded Prike Liang 2 participants 3 messages Mar 30, 2021 – Mar 31, 2021 NVMe

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: put some AMD PCIE downstream NVME device to simple suspend/resume path

The NVME device pluged in some AMD PCIE root port will resume timeout from s2idle which caused by NVME power CFG lost in the SMU FW restore.This issue can be workaround by using PCIe power set with simple suspend/resume process path. In the onwards ASIC will try do the NVME shutdown save and restore in the SMU FW instead of PCIe power set in the driver.

---
 drivers/nvme/host/pci.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/nvme/host/pci.c +17 -0
index 6bad4d4..33c48ee 100644
@@ -42,6 +42,8 @@
 #define NVME_MAX_KB_SZ	4096
 #define NVME_MAX_SEGS	127
 
+#define AMD_PCIE_ID_CZN 0x1634
+#define AMD_PCIE_ID_RN AMD_PCIE_ID_CZN
 static int use_threaded_interrupts;
 module_param(use_threaded_interrupts, int, 0);
 
@@ -70,6 +72,12 @@ static unsigned int io_queue_depth = 1024;
 module_param_cb(io_queue_depth, &io_queue_depth_ops, &io_queue_depth, 0644);
 MODULE_PARM_DESC(io_queue_depth, "set io queue depth, should >= 2");
 
+static const struct pci_device_id pcie_rp_ids[] = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_PCIE_ID_RN) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_PCIE_ID_CZN) },
+	{ }
+};
+
 static int io_queue_count_set(const char *val, const struct kernel_param *kp)
 {
 	unsigned int n;
@@ -2786,6 +2794,9 @@ static int nvme_dev_map(struct nvme_dev *dev)
 
 static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
 {
+	struct pci_dev *root;
+	root = pcie_find_root_port(pdev);
+
 	if (pdev->vendor == 0x144d && pdev->device == 0xa802) {
 		/*
 		 * Several Samsung devices seem to drop off the PCIe bus
@@ -2822,6 +2833,12 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
 		if ((dmi_match(DMI_BOARD_VENDOR, "LENOVO")) &&
 		     dmi_match(DMI_BOARD_NAME, "LNVNB161216"))
 			return NVME_QUIRK_SIMPLE_SUSPEND;
+	} else if (root && pci_match_id(pcie_rp_ids, root)) {
+			/* Detect NVME device which pluged in the Renoir PCIE root port
+			 * then force use quick suspend/resume path for workaround the resume
+			 * timeout for s0ix.
+			 */
+			return NVME_QUIRK_SIMPLE_SUSPEND;
 	}
 
 	return 0;
Signature · 7 lines
2.7.4


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#1 lore raw
Quoted 7 lines · Prike Liang

The NVME device pluged in some AMD PCIE root port will resume timeout from s2idle which caused by NVME power CFG lost in the SMU FW restore.This issue can be workaround by using PCIe power set with simple suspend/resume process path. In the onwards ASIC will try do the NVME shutdown save and restore in the SMU FW instead of PCIe power set in the driver.

---

Did you get a chance to run checkpatch.pl on this patch ?

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#2 lore raw

[AMD Public Use]

Thanks reminder and will update the patch v2.

Quoted 15 lines

-----Original Message-----
From: Chaitanya Kulkarni <[email protected]>
Sent: Wednesday, March 31, 2021 7:32 AM
To: Liang, Prike <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>; S-k, Shyam-sundar <[email protected]>
Subject: Re: [PATCH] nvme: put some AMD PCIE downstream NVME device to simple suspend/resume path

Quoted 4 lines · Prike Liang

The NVME device pluged in some AMD PCIE root port will resume timeout from s2idle which caused by NVME power CFG lost in the SMU FW restore.This issue can be workaround by using PCIe power set with simple suspend/resume process path. In the onwards ASIC will try do the

Quoted 7 lines

NVME shutdown save and restore in the SMU FW instead of PCIe power set in the driver.

Quoted 3 lines

---

Did you get a chance to run checkpatch.pl on this patch ?

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme