From patchwork Tue Apr 8 23:42:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 3951721 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2D7739F370 for ; Tue, 8 Apr 2014 23:42:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4AB13204B5 for ; Tue, 8 Apr 2014 23:42:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6A36204D2 for ; Tue, 8 Apr 2014 23:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756235AbaDHXm0 (ORCPT ); Tue, 8 Apr 2014 19:42:26 -0400 Received: from mga02.intel.com ([134.134.136.20]:55443 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756739AbaDHXm0 (ORCPT ); Tue, 8 Apr 2014 19:42:26 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 08 Apr 2014 16:42:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,821,1389772800"; d="scan'208";a="517193007" Received: from dcgshare.lm.intel.com ([10.232.118.254]) by orsmga002.jf.intel.com with ESMTP; 08 Apr 2014 16:42:22 -0700 Received: by dcgshare.lm.intel.com (Postfix, from userid 1017) id 4F56DE00EA; Tue, 8 Apr 2014 17:42:22 -0600 (MDT) From: Keith Busch To: linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org, bhelgaas@google.com Cc: Keith Busch Subject: [PATCH 2/2] NVMe: Implement PCI-e reset notification callback Date: Tue, 8 Apr 2014 17:42:21 -0600 Message-Id: <1397000541-1085-2-git-send-email-keith.busch@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1397000541-1085-1-git-send-email-keith.busch@intel.com> References: <1397000541-1085-1-git-send-email-keith.busch@intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Disable and shutdown the device prior to reset, and restart the device after. Signed-off-by: Keith Busch --- 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 */