diff options
author | damige | 2016-12-12 01:39:29 +0100 |
---|---|---|
committer | damige | 2016-12-12 01:39:29 +0100 |
commit | a29d08476dfc9a20552f3493f9ea052326501395 (patch) | |
tree | 7982b3db7ef0807cee0a29c4d70cc54103bb1b64 /nvme.patch | |
parent | 304ec462a578d7048cd028afc8b6ce8c67377a24 (diff) | |
download | aur-a29d08476dfc9a20552f3493f9ea052326501395.tar.gz |
4.9
Diffstat (limited to 'nvme.patch')
-rw-r--r-- | nvme.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/nvme.patch b/nvme.patch new file mode 100644 index 000000000000..caf48e43a425 --- /dev/null +++ b/nvme.patch @@ -0,0 +1,62 @@ +From c28126550f46f20aec1f069a4a8d10d802332dda Mon Sep 17 00:00:00 2001 +From: Andy Lutomirski <luto@kernel.org> +Date: Tue, 15 Nov 2016 13:49:18 -0800 +Subject: nvme/pci: Log PCI_STATUS when the controller dies + +When debugging nvme controller crashes, it's nice to know whether +the controller died cleanly so that the failure is just reflected in +CSTS, it died and put an error in PCI_STATUS, or whether it died so +badly that it stopped responding to PCI configuration space reads. + +I've seen a failure that gives 0xffff in PCI_STATUS on a Samsung +"SM951 NVMe SAMSUNG 256GB" with firmware "BXW75D0Q". + +Reviewed-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Andy Lutomirski <luto@kernel.org> +--- + drivers/nvme/host/pci.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index 5e52034..628dc91 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -1281,6 +1281,24 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts) + return true; + } + ++static void nvme_warn_reset(struct nvme_dev *dev, u32 csts) ++{ ++ /* Read a config register to help see what died. */ ++ u16 pci_status; ++ int result; ++ ++ result = pci_read_config_word(to_pci_dev(dev->dev), PCI_STATUS, ++ &pci_status); ++ if (result == PCIBIOS_SUCCESSFUL) ++ dev_warn(dev->dev, ++ "controller is down; will reset: CSTS=0x%x, PCI_STATUS=0x%hx\n", ++ csts, pci_status); ++ else ++ dev_warn(dev->dev, ++ "controller is down; will reset: CSTS=0x%x, PCI_STATUS read failed (%d)\n", ++ csts, result); ++} ++ + static void nvme_watchdog_timer(unsigned long data) + { + struct nvme_dev *dev = (struct nvme_dev *)data; +@@ -1289,9 +1307,7 @@ static void nvme_watchdog_timer(unsigned long data) + /* Skip controllers under certain specific conditions. */ + if (nvme_should_reset(dev, csts)) { + if (!nvme_reset(dev)) +- dev_warn(dev->dev, +- "Failed status: 0x%x, reset controller.\n", +- csts); ++ nvme_warn_reset(dev, csts); + return; + } + +-- +cgit v0.12 + |