From patchwork Tue Mar 24 15:42:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 6082191 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 00C0C9F318 for ; Tue, 24 Mar 2015 16:28:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0CDCE2024D for ; Tue, 24 Mar 2015 16:28:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED5D520173 for ; Tue, 24 Mar 2015 16:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbbCXPmm (ORCPT ); Tue, 24 Mar 2015 11:42:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46640 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752599AbbCXPml (ORCPT ); Tue, 24 Mar 2015 11:42:41 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2OFgZd4001274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 24 Mar 2015 11:42:36 -0400 Received: from redhat.com (ovpn-116-61.ams2.redhat.com [10.36.116.61]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t2OFgWml003483; Tue, 24 Mar 2015 11:42:32 -0400 Date: Tue, 24 Mar 2015 16:42:31 +0100 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org, Fam Zheng , Yinghai Lu , stable@kernel.org, "Eric W. Biederman" Subject: [PATCH v3 02/10] pci: move pci_msi_init_pci_dev to pci.c Message-ID: <1427211032-2270-3-git-send-email-mst@redhat.com> References: <1427211032-2270-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1427211032-2270-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 commit d5dea7d95c48d7bc951cee4910a7fd9c0cd26fb0 "PCI: msi: Disable msi interrupts when we initialize a pci device" fixes kexec when the booting kernel does not enable msi interupts. Unfortunately the relevant functionality is in msi.c so it isn't compiled in when CONFIG_PCI_MSI is off, which means such configurations would still get interrupt storms. Fix by moving the function to pci.c, and compiling it unconditionally. Cc: stable@kernel.org Cc: Eric W. Biederman Signed-off-by: Michael S. Tsirkin --- drivers/pci/pci.h | 2 -- drivers/pci/msi.c | 17 ----------------- drivers/pci/probe.c | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 17f213d..a964569 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -140,10 +140,8 @@ extern unsigned int pci_pm_d3_delay; #ifdef CONFIG_PCI_MSI void pci_no_msi(void); -void pci_msi_init_pci_dev(struct pci_dev *dev); #else static inline void pci_no_msi(void) { } -static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } #endif static inline void pci_msi_set_enable(struct pci_dev *dev, int enable) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 9942f68..ae3f7cc 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1038,23 +1038,6 @@ int pci_msi_enabled(void) } EXPORT_SYMBOL(pci_msi_enabled); -void pci_msi_init_pci_dev(struct pci_dev *dev) -{ - INIT_LIST_HEAD(&dev->msi_list); - - /* Disable the msi hardware to avoid screaming interrupts - * during boot. This is the power on reset default so - * usually this should be a noop. - */ - dev->msi_cap = pci_find_capability(dev, PCI_CAP_ID_MSI); - if (dev->msi_cap) - pci_msi_set_enable(dev, 0); - - dev->msix_cap = pci_find_capability(dev, PCI_CAP_ID_MSIX); - if (dev->msix_cap) - pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); -} - /** * pci_enable_msi_range - configure device's MSI capability structure * @dev: device to configure diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8d2f400..45d6d5c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1483,6 +1483,25 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) return dev; } +static void pci_msi_init_pci_dev(struct pci_dev *dev) +{ +#ifdef CONFIG_PCI_MSI + INIT_LIST_HEAD(&dev->msi_list); +#endif + + /* Disable the msi hardware to avoid screaming interrupts + * during boot. This is the power on reset default so + * usually this should be a noop. + */ + dev->msi_cap = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (dev->msi_cap) + pci_msi_set_enable(dev, 0); + + dev->msix_cap = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (dev->msix_cap) + pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); +} + static void pci_init_capabilities(struct pci_dev *dev) { /* MSI/MSI-X list */