lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 11 Mar 2014 13:52:02 +0100
From:	Andreas Noever <andreas.noever@...il.com>
To:	Bjorn Helgaas <bhelgaas@...gle.com>
Cc:	Yinghai Lu <yinghai@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	Rajat Jain <rajatxjain@...il.com>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>
Subject: Re: [Bug] PCI: Enable INTx if BIOS left them disabled - triggers
 during rescan

On Tue, Mar 11, 2014 at 1:10 AM, Bjorn Helgaas <bhelgaas@...gle.com> wrote:
> 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@...gle.com> wrote:
>> > On Sat, Mar 8, 2014 at 2:55 AM, Andreas Noever <andreas.noever@...il.com> wrote:
>> >> On Sat, Mar 8, 2014 at 2:04 AM, Bjorn Helgaas <bhelgaas@...gle.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@...gle.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@...gle.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);

That fixes it.

Thanks,
Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ