From patchwork Tue Mar 17 07:37:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 6027691 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 0B70ABF90F for ; Tue, 17 Mar 2015 07:35:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36BE420458 for ; Tue, 17 Mar 2015 07:34:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55C8E203FB for ; Tue, 17 Mar 2015 07:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752430AbbCQHem (ORCPT ); Tue, 17 Mar 2015 03:34:42 -0400 Received: from mga03.intel.com ([134.134.136.65]:63819 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751387AbbCQHel (ORCPT ); Tue, 17 Mar 2015 03:34:41 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 17 Mar 2015 00:31:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,415,1422950400"; d="scan'208";a="681182869" Received: from gerry-dev.bj.intel.com ([10.238.158.72]) by fmsmga001.fm.intel.com with ESMTP; 17 Mar 2015 00:34:37 -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 , Thomas Hellstrom , "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: Tue, 17 Mar 2015 15:37:12 +0800 Message-Id: <1426577832-23164-1-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 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. Please aslo refer to: https://bugzilla.kernel.org/show_bug.cgi?id=94721 Signed-off-by: Jiang Liu Reported-by: Alex Williamson Reported-by: Thomas Hellstrom Reviewed-by: Rafael J. Wysocki --- Hi Rafael, I have assumed an Reviewed-by from you, is that OK? Thanks! Gerry --- 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;