From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [Bugfix] x86/PCI: Release PCI IRQ resource only if PCI device is disabled when unbinding Date: Fri, 13 Mar 2015 22:45:18 +0100 Message-ID: <1959219.oI9I2JEVpa@vostro.rjw.lan> References: <1426092450.3643.7.camel@redhat.com> <1426212403-16234-1-git-send-email-jiang.liu@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7Bit Return-path: Received: from v094114.home.net.pl ([79.96.170.134]:54547 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751306AbbCMVVb (ORCPT ); Fri, 13 Mar 2015 17:21:31 -0400 In-Reply-To: <1426212403-16234-1-git-send-email-jiang.liu@linux.intel.com> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Jiang Liu , Bjorn Helgaas Cc: Alex Williamson , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, "bp @ alien8 . de" , Lv Zheng , "yinghai @ kernel . org" , "lenb @ kernel . org" , LKML , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org On Friday, March 13, 2015 10:06:43 AM Jiang Liu wrote: > 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 OK, I can agree with that. Bjorn, what do you think? > --- > 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; > -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.