linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org,
	bhelgaas@google.com
Cc: Keith Busch <keith.busch@intel.com>
Subject: [PATCH 2/2] NVMe: Implement PCI-e reset notification callback
Date: Tue,  8 Apr 2014 17:42:21 -0600	[thread overview]
Message-ID: <1397000541-1085-2-git-send-email-keith.busch@intel.com> (raw)
In-Reply-To: <1397000541-1085-1-git-send-email-keith.busch@intel.com>

Disable and shutdown the device prior to reset, and restart the device
after.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 drivers/block/nvme-core.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 625259d..273ff12 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2605,6 +2605,16 @@ static void nvme_reset_failed_dev(struct work_struct *ws)
 	nvme_dev_reset(dev);
 }
 
+static void nvme_reset_notify(struct pci_dev *pdev, int prepare)
+{
+	struct nvme_dev *dev = pci_get_drvdata(pdev);
+
+	if (prepare)
+		nvme_dev_shutdown(dev);
+	else
+		nvme_dev_resume(dev);
+}
+
 static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	int result = -ENOMEM;
@@ -2744,6 +2754,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 */
-- 
1.7.10.4


  reply	other threads:[~2014-04-08 23:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 23:42 [PATCH 1/2] PCI: Device driver function reset notification Keith Busch
2014-04-08 23:42 ` Keith Busch [this message]
2014-04-22  1:34   ` [PATCH 2/2] NVMe: Implement PCI-e reset notification callback Learner Study
2014-04-22  1:57     ` Keith Busch
2014-04-22  2:45       ` Learner
2014-04-22  3:34         ` Learner Study
2014-04-22  5:02           ` Mayes, Barrett N
2014-04-22 10:07             ` Learner Study
     [not found]               ` <7174f4a8.23ad7.14589360cb2.Coremail.liaohengquan1986@163.com>
2014-04-22 15:57                 ` Wheather the NVMe driver has been tried on the IBM or Lenovo server? Bjorn Helgaas
2014-04-22 16:08                   ` Learner Study
2014-04-22 14:22             ` [PATCH 2/2] NVMe: Implement PCI-e reset notification callback Keith Busch
2014-04-22 15:00               ` Learner Study
2014-04-30 22:46 ` [PATCH 1/2] PCI: Device driver function reset notification Bjorn Helgaas
2014-05-01 19:57   ` Keith Busch
2014-05-01 20:10     ` Bjorn Helgaas
2014-05-01 20:20       ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397000541-1085-2-git-send-email-keith.busch@intel.com \
    --to=keith.busch@intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).