From patchwork Thu Mar 19 18:57:52 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: 6051881 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 79C799F2A9 for ; Thu, 19 Mar 2015 18:58:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8532A2051C for ; Thu, 19 Mar 2015 18:58:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 926B920528 for ; Thu, 19 Mar 2015 18:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750950AbbCSS6J (ORCPT ); Thu, 19 Mar 2015 14:58:09 -0400 Received: from mail.kernel.org ([198.145.29.136]:53818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750932AbbCSS6H (ORCPT ); Thu, 19 Mar 2015 14:58:07 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2BDE52051C; Thu, 19 Mar 2015 18:58:06 +0000 (UTC) Received: from redhat.com (bzq-109-65-174-5.red.bezeqint.net [109.65.174.5]) (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CBA5E2050E; Thu, 19 Mar 2015 18:58:02 +0000 (UTC) Date: Thu, 19 Mar 2015 19:57:52 +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 , Ulrich Obergfell , Rusty Russell Subject: [PATCH v2 1/4] pci: disable msi/msix at probe time Message-ID: <1426786724-22241-2-git-send-email-mst@redhat.com> References: <1426786724-22241-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1426786724-22241-1-git-send-email-mst@redhat.com> X-Mailer: git-send-email 2.0.0.545.gd9cabeb X-Mutt-Fcc: =sent X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 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 commit d52877c7b1afb8c37ebe17e2005040b79cb618b0 pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2 attempted to address the problem of kexec getting started after linux enabled msi/msix for a device, and drivers being confused by msi being enabled, by disabling msi at shutdown. But arguably, it's better to disable msi/msix when kexec starts - for example, kexec might run after a crash (kdump) and shutdown callbacks are not always invoked in that case. Cc: Yinghai Lu Cc: Ulrich Obergfell Cc: Fam Zheng Cc: Rusty Russell Signed-off-by: Michael S. Tsirkin --- drivers/pci/pci-driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 3cb2210..2ebd2a8 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -305,6 +305,12 @@ static long local_pci_probe(void *_ddi) */ pm_runtime_get_sync(dev); pci_dev->driver = pci_drv; + /* + * When using kexec, msi might be left enabled by the previous kernel, + * this breaks things as some drivers assume msi/msi-x is off at boot. + * Fix this by forcing msi off at startup. + */ + pci_msi_off(pci_dev); rc = pci_drv->probe(pci_dev, ddi->id); if (!rc) return rc;