From patchwork Fri May 2 16:40:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 4104701 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1AADABFF02 for ; Fri, 2 May 2014 16:41:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 350842037B for ; Fri, 2 May 2014 16:41:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 297D320265 for ; Fri, 2 May 2014 16:41:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752841AbaEBQky (ORCPT ); Fri, 2 May 2014 12:40:54 -0400 Received: from mga03.intel.com ([143.182.124.21]:54206 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752757AbaEBQkx (ORCPT ); Fri, 2 May 2014 12:40:53 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 02 May 2014 09:40:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,973,1389772800"; d="scan'208";a="426862119" Received: from dcgshare.lm.intel.com ([10.232.118.254]) by azsmga001.ch.intel.com with ESMTP; 02 May 2014 09:40:45 -0700 Received: by dcgshare.lm.intel.com (Postfix, from userid 1017) id D7F04E00EB; Fri, 2 May 2014 10:40:44 -0600 (MDT) From: Keith Busch To: linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, bhelgaas@google.com Cc: Keith Busch Subject: [PATCHv2 2/2] NVMe: Implement PCI-e reset notification callback Date: Fri, 2 May 2014 10:40:43 -0600 Message-Id: <1399048843-9376-2-git-send-email-keith.busch@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1399048843-9376-1-git-send-email-keith.busch@intel.com> References: <1399048843-9376-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.5 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 Quiesce and shutdown the device prior to reset, then restart the device and resume IO after. Signed-off-by: Keith Busch --- v1 -> v2: fixed compile warning for wrong data type in function (int -> bool). 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 7c64fa7..a842c71 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) 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 */