public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Andreas Noever <andreas.noever@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Rajat Jain <rajatxjain@gmail.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [Bug] PCI: Enable INTx if BIOS left them disabled - triggers during rescan
Date: Mon, 10 Mar 2014 18:10:03 -0600	[thread overview]
Message-ID: <20140311001003.GA14367@google.com> (raw)
In-Reply-To: <CAMxnaaWr0z1zbpFQPX6UvYbnxhfA+3aj4ffhCBpp1i4ZLsGTPg@mail.gmail.com>

On Tue, Mar 11, 2014 at 12:10:02AM +0100, Andreas Noever wrote:
> On Mon, Mar 10, 2014 at 9:43 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> > On Sat, Mar 8, 2014 at 2:55 AM, Andreas Noever <andreas.noever@gmail.com> wrote:
> >> On Sat, Mar 8, 2014 at 2:04 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> >
> >>> If we did that, INTX_DISABLE would be cleared by the first
> >>> pci_enable_device() and pci_reenable_device() wouldn't do anything,
> >>> leaving it cleared.  The resulting state (cleared) would be the same,
> >>> but the transitions would be gone, and maybe those are important.
> >> Just a quick note: With pci_intx_for_msi removed no hotplug events are
> >> ever delivered. Everything else still works though. So it is either a
> >> problem specific to Thunderbolt bridges or maybe it just affects
> >> hotplug (and PME?) interrupts.
> >
> > Interesting.  This is on a MacBook, isn't it?  If you have Mac OS on
> > it, is there a way you can do the equivalent of lspci on it?  I'm
> > curious about whether it sets INTx_DISABLE when it enables MSI.
> 
> lspci -vv and lspci -vv -xxxx attached (yes, someone made a port).
> 
> It looks like Mac OS sets DisINTx for all devices that have MSI
> enabled. The only exception is the Thunderbolt controller (no
> idea...). But the hotplug bridges all have DisINTx+.

OK, thanks.  I don't know what to make of that.

Here's a possible patch; can you try it out?


PCI: Do not enable INTx in pci_reenable_device()

From: Bjorn Helgaas <bhelgaas@google.com>

Previously we cleared the Interrupt Disable bit in do_pci_enable_device(),
which is used by both pci_enable_device() and pci_reenable_device().  But
we use pci_reenable_device() after the driver may have enabled MSI or
MSI-X, and we *set* Interrupt Disable as part of enabling MSI/MSI-X.

The pciehp hot-plug path uses pci_reenable_device() on the hotplug bridge,
and clearing its Interrupt Disable bit makes its hotplug event-reporting
MSI stop working.

Fixes: 1f42db786b14 PCI: Enable INTx if BIOS left them disabled
Link: https://bugzilla.kernel.org/show_bug.cgi?id=71691
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8dc3e701ec57..79fc89c6c3f3 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1192,6 +1192,9 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars)
 		return err;
 	pci_fixup_device(pci_fixup_enable, dev);
 
+	if (dev->msi_enabled || dev->msix_enabled)
+		return 0;
+
 	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
 	if (pin) {
 		pci_read_config_word(dev, PCI_COMMAND, &cmd);

  parent reply	other threads:[~2014-03-11  0:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 14:33 [Bug] PCI: Enable INTx if BIOS left them disabled - triggers during rescan Andreas Noever
2014-03-07 16:45 ` Bjorn Helgaas
2014-03-07 19:39   ` Yinghai Lu
2014-03-08  1:04     ` Bjorn Helgaas
2014-03-08  9:55       ` Andreas Noever
2014-03-10 20:43         ` Bjorn Helgaas
     [not found]           ` <CAMxnaaWr0z1zbpFQPX6UvYbnxhfA+3aj4ffhCBpp1i4ZLsGTPg@mail.gmail.com>
2014-03-11  0:10             ` Bjorn Helgaas [this message]
2014-03-11 12:52               ` Andreas Noever
2014-03-17 16:36                 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140311001003.GA14367@google.com \
    --to=bhelgaas@google.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rajatxjain@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox