From patchwork Mon Mar 16 17:20:28 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: 6023291 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 B33169F2A9 for ; Mon, 16 Mar 2015 17:22:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BACFA2044C for ; Mon, 16 Mar 2015 17:22:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8E5F20439 for ; Mon, 16 Mar 2015 17:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933512AbbCPRUk (ORCPT ); Mon, 16 Mar 2015 13:20:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53823 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933075AbbCPRUi (ORCPT ); Mon, 16 Mar 2015 13:20:38 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2GHKW2G024471 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Mar 2015 13:20:32 -0400 Received: from redhat.com (ovpn-116-45.ams2.redhat.com [10.36.116.45]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t2GHKSNS021146; Mon, 16 Mar 2015 13:20:29 -0400 Date: Mon, 16 Mar 2015 18:20:28 +0100 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, Fam Zheng , Yinghai Lu , Ulrich Obergfell , Rusty Russell Subject: [PATCH RFC 1/4] pci: disable msi/msix at probe time Message-ID: <1426526415-13299-2-git-send-email-mst@redhat.com> References: <1426526415-13299-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1426526415-13299-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 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 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..dac6d47 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(dev); rc = pci_drv->probe(pci_dev, ddi->id); if (!rc) return rc;