NVMe: Implement PCIe reset notification callback
authorKeith Busch <keith.busch@intel.com>
Fri, 2 May 2014 16:40:43 +0000 (10:40 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 27 May 2014 17:12:29 +0000 (11:12 -0600)
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>
drivers/block/nvme-core.c

index 7c64fa756cced628807e70fb873b532964ea39d9..a842c71dcc211b8f036de693633345492f9a21e6 100644 (file)
@@ -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 */