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: 345179 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E630714007B for ; Sat, 3 May 2014 02:41:09 +1000 (EST) 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 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 */