From patchwork Fri Mar 13 02:06:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 6001181 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8648ABF90F for ; Fri, 13 Mar 2015 02:04:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2D8C20251 for ; Fri, 13 Mar 2015 02:04:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26B3220304 for ; Fri, 13 Mar 2015 02:04:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753969AbbCMCEd (ORCPT ); Thu, 12 Mar 2015 22:04:33 -0400 Received: from mga03.intel.com ([134.134.136.65]:20209 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753603AbbCMCEc (ORCPT ); Thu, 12 Mar 2015 22:04:32 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 12 Mar 2015 19:01:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,391,1422950400"; d="scan'208";a="691408597" Received: from gerry-dev.bj.intel.com ([10.238.158.72]) by fmsmga002.fm.intel.com with ESMTP; 12 Mar 2015 19:04:06 -0700 From: Jiang Liu To: Alex Williamson , "Rafael J . Wysocki" , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org Cc: Jiang Liu , "bp @ alien8 . de" , Lv Zheng , "yinghai @ kernel . org" , "lenb @ kernel . org" , LKML , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [Bugfix] x86/PCI: Release PCI IRQ resource only if PCI device is disabled when unbinding Date: Fri, 13 Mar 2015 10:06:43 +0800 Message-Id: <1426212403-16234-1-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1426092450.3643.7.camel@redhat.com> References: <1426092450.3643.7.camel@redhat.com> 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 To support IOAPIC hot-removal, we need to release PCI interrupt resource when unbinding PCI device driver. But due to historical reason, /* * We would love to complain here if pci_dev->is_enabled is set, that * the driver should have called pci_disable_device(), but the * unfortunate fact is there are too many odd BIOS and bridge setups * that don't like drivers doing that all of the time. * Oh well, we can dream of sane hardware when we sleep, no matter how * horrible the crap we have to deal with is when we are awake... */ some drivers don't call pci_disable_device() when unloading, which prevents us from reallocating PCI interrupt resource on reloading PCI driver and causes regressions. So release PCI interrupt resource only if PCI device is disabled when unbinding. By this way, we could support IOAPIC hot-removal on latest platforms and avoid regressions on old platforms. Signed-off-by: Jiang Liu --- arch/x86/pci/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 3d2612b68694..8d792142cb2a 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c @@ -527,7 +527,7 @@ static int pci_irq_notifier(struct notifier_block *nb, unsigned long action, if (action != BUS_NOTIFY_UNBOUND_DRIVER) return NOTIFY_DONE; - if (pcibios_disable_irq) + if (!pci_is_enabled(dev) && pcibios_disable_irq) pcibios_disable_irq(dev); return NOTIFY_OK;