Skip to content

Instantly share code, notes, and snippets.

@lattice0
Created June 16, 2018 03:30
Show Gist options
  • Save lattice0/6759cf2bff4576f2b36e94ebe3ece040 to your computer and use it in GitHub Desktop.
Save lattice0/6759cf2bff4576f2b36e94ebe3ece040 to your computer and use it in GitHub Desktop.
---
drivers/nvme/host/nvme.h | 5 +++++
drivers/nvme/host/pci.c | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 8e4550fa08f8..e970423b7944 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -83,6 +83,11 @@ enum nvme_quirks {
* Supports the LighNVM command set if indicated in vs[1].
*/
NVME_QUIRK_LIGHTNVM = (1 << 6),
+
+ /*
+ * The controller needs to do a PCI reset after resume.
+ */
+ NVME_QUIRK_PCI_RESET_RESUME = (1 << 7),
};
/*
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 6fe7af00a1f4..e96dc301a4e7 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2084,6 +2084,9 @@ static int nvme_pci_enable(struct nvme_dev *dev)
int result = -ENOMEM;
struct pci_dev *pdev = to_pci_dev(dev->dev);
+ if (dev->ctrl.quirks & NVME_QUIRK_PCI_RESET_RESUME)
+ pci_reset_function(pdev);
+
if (pci_enable_device_mem(pdev))
return result;
@@ -2455,6 +2458,13 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
if (dmi_match(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC.") &&
dmi_match(DMI_BOARD_NAME, "PRIME B350M-A"))
return NVME_QUIRK_NO_APST;
+ /*
+ * Samsung SSD 960 EVO and SM961/PM961 drop off the PCIe bus
+ * after system suspend on Razer Blade Stealth.
+ */
+ else if (dmi_match(DMI_SYS_VENDOR, "Razer") &&
+ dmi_match(DMI_PRODUCT_NAME, "Blade Stealth"))
+ return NVME_QUIRK_PCI_RESET_RESUME;
}
return 0;
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment