From patchwork Tue Jun 21 22:27:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 9191507 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C5CD6075A for ; Tue, 21 Jun 2016 22:35:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D40428329 for ; Tue, 21 Jun 2016 22:35:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81ABA28358; Tue, 21 Jun 2016 22:35:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0313827F85 for ; Tue, 21 Jun 2016 22:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752076AbcFUWfK (ORCPT ); Tue, 21 Jun 2016 18:35:10 -0400 Received: from mail.kernel.org ([198.145.29.136]:36208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573AbcFUWfJ (ORCPT ); Tue, 21 Jun 2016 18:35:09 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC6CE20148; Tue, 21 Jun 2016 22:27:21 +0000 (UTC) Received: from localhost (unknown [69.71.1.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9A7F320145; Tue, 21 Jun 2016 22:27:20 +0000 (UTC) Date: Tue, 21 Jun 2016 17:27:18 -0500 From: Bjorn Helgaas To: Johannes Thumshirn Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Keith Busch , Jens Axboe , linux-nvme@lists.infradead.org Subject: Re: [PATCH v3 2/6] NVMe: Use pci_(request|release)_mem_regions Message-ID: <20160621222718.GE7603@localhost> References: <5c9932602e6d43ef8ad77856c686765f9e63aa9c.1465200424.git.jthumshirn@suse.de> <20160617112716.74e4hgy5bhkkgmi6@c203.arch.suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160617112716.74e4hgy5bhkkgmi6@c203.arch.suse.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jun 17, 2016 at 01:27:16PM +0200, Johannes Thumshirn wrote: > On Tue, Jun 07, 2016 at 09:44:02AM +0200, Johannes Thumshirn wrote: > > Now that we do have pci_request_mem_regions() and pci_release_mem_regions() at > > hand, use it in the NVMe driver. > > > > Suggested-by: Christoph Hellwig > > Signed-off-by: Johannes Thumshirn > > Reviewed-by: Christoph Hellwig > > Cc: Christoph Hellwig > > Cc: Keith Busch > > Cc: Jens Axboe > > Cc: linux-nvme@lists.infradead.org > > Bjorn, > > Jens merged a band aid here which conflicts with the patch. Shall I send you > this patch re-based or the entire series? I see the conflict with the patch below. I don't know how Jens manages his tree, but the conflict should be pretty trivial to resolve, so I won't worry about it too much. commit edb50a5403d2 Author: Johannes Thumshirn Date: Tue May 10 15:14:28 2016 +0200 NVMe: Only release requested regions The NVMe driver only requests the PCIe device's memory regions but releases all possible regions (including eventual I/O regions). This leads to a stale warning entry in dmesg about freeing non existent resources. Signed-off-by: Johannes Thumshirn Signed-off-by: Jens Axboe --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 78dca31..befac5b 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1679,9 +1679,14 @@ static int nvme_pci_enable(struct nvme_dev *dev) static void nvme_dev_unmap(struct nvme_dev *dev) { + struct pci_dev *pdev = to_pci_dev(dev->dev); + int bars; + if (dev->bar) iounmap(dev->bar); - pci_release_regions(to_pci_dev(dev->dev)); + + bars = pci_select_bars(pdev, IORESOURCE_MEM); + pci_release_selected_regions(pdev, bars); } static void nvme_pci_disable(struct nvme_dev *dev) @@ -1924,7 +1929,7 @@ static int nvme_dev_map(struct nvme_dev *dev) return 0; release: - pci_release_regions(pdev); + pci_release_selected_regions(pdev, bars); return -ENODEV; }