diff options
author | Keith Busch <keith.busch@intel.com> | 2014-05-02 12:40:43 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-05-27 13:12:29 -0400 |
commit | f0d54a541751af2c6a16d0c081788cc2aef922a5 (patch) | |
tree | c9c739c284d31169f2823c60f13d4ad74a7fcaca | |
parent | 3ebe7f9f7e4a4fd1f6461ecd01ff2961317a483a (diff) |
NVMe: Implement PCIe reset notification callback
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>
-rw-r--r-- | drivers/block/nvme-core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 7c64fa756cce..a842c71dcc21 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -2775,6 +2775,16 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2775 | return result; | 2775 | return result; |
2776 | } | 2776 | } |
2777 | 2777 | ||
2778 | static void nvme_reset_notify(struct pci_dev *pdev, bool prepare) | ||
2779 | { | ||
2780 | struct nvme_dev *dev = pci_get_drvdata(pdev); | ||
2781 | |||
2782 | if (prepare) | ||
2783 | nvme_dev_shutdown(dev); | ||
2784 | else | ||
2785 | nvme_dev_resume(dev); | ||
2786 | } | ||
2787 | |||
2778 | static void nvme_shutdown(struct pci_dev *pdev) | 2788 | static void nvme_shutdown(struct pci_dev *pdev) |
2779 | { | 2789 | { |
2780 | struct nvme_dev *dev = pci_get_drvdata(pdev); | 2790 | struct nvme_dev *dev = pci_get_drvdata(pdev); |
@@ -2839,6 +2849,7 @@ static const struct pci_error_handlers nvme_err_handler = { | |||
2839 | .link_reset = nvme_link_reset, | 2849 | .link_reset = nvme_link_reset, |
2840 | .slot_reset = nvme_slot_reset, | 2850 | .slot_reset = nvme_slot_reset, |
2841 | .resume = nvme_error_resume, | 2851 | .resume = nvme_error_resume, |
2852 | .reset_notify = nvme_reset_notify, | ||
2842 | }; | 2853 | }; |
2843 | 2854 | ||
2844 | /* Move to pci_ids.h later */ | 2855 | /* Move to pci_ids.h later */ |