Skip to content

Commit

Permalink
NVMe: Implement PCIe reset notification callback
Browse files Browse the repository at this point in the history
Quiesce and shutdown the device prior to reset, then restart the device and
resume IO after.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Keith Busch authored and Bjorn Helgaas committed May 27, 2014
1 parent 3ebe7f9 commit f0d54a5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/block/nvme-core.c
Original file line number Diff line number Diff line change
@@ -2775,6 +2775,16 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return result;
}

static void nvme_reset_notify(struct pci_dev *pdev, bool prepare)
{
struct nvme_dev *dev = pci_get_drvdata(pdev);

if (prepare)
nvme_dev_shutdown(dev);
else
nvme_dev_resume(dev);
}

static void nvme_shutdown(struct pci_dev *pdev)
{
struct nvme_dev *dev = pci_get_drvdata(pdev);
@@ -2839,6 +2849,7 @@ static const struct pci_error_handlers nvme_err_handler = {
.link_reset = nvme_link_reset,
.slot_reset = nvme_slot_reset,
.resume = nvme_error_resume,
.reset_notify = nvme_reset_notify,
};

/* Move to pci_ids.h later */

0 comments on commit f0d54a5

Please sign in to comment.