All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	linux-pci@vger.kernel.org, linux-wireless@vger.kernel.org,
	zajec5@gmail.com, b43-dev@lists.infradead.org,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	linux-efi@vger.kernel.org, Andrew Worsley <amworsley@gmail.com>,
	Chris Bainbridge <chris.bainbridge@gmail.com>
Subject: Re: [PATCH] PCI: Add Broadcom 4331 reset quirk to prevent IRQ storm
Date: Sun, 24 Apr 2016 18:58:58 +0200	[thread overview]
Message-ID: <20160424165858.GA17019@wunner.de> (raw)
In-Reply-To: <20160409120055.GR2701@codeblueprint.co.uk>

Hi,

On Sat, Apr 09, 2016 at 01:00:55PM +0100, Matt Fleming wrote:
> On Wed, 06 Apr, at 11:30:29PM, Lukas Wunner wrote:
> > (2) Find out exactly which EFI boot services area is used for DMA and
> >     amend arch/x86/platform/efi/quirks.c:efi_apply_memmap_quirks() to
> >     assign that area a different type if dmi_match(DMI_SYS_VENDOR,
> >     "Apple Inc."). That way it's not freed by efi_free_boot_services().
> >     Add a late_initcall which calls free_bootmem() for that area.
>  
> If it is possible to find out which boot services region is the
> problematic one, this would be the best solution. If there's any way
> to tie it into the PCI quirk, that would be even better so we don't
> need to maintain the blacklist in two places.

I've since cooked up an experimental patch which resets the Broadcom 4331
wireless card from arch/x86/kernel/early-quirks.c, and another which does
the same from arch/x86/boot/compressed/eboot.c. Both approaches stopped
the spurious interrupts for me and should also stop the DMA'ing.

In the latter case, the machine locked up immediately after resetting the
card. Suspecting that the EFI driver doesn't digest the reset well,
I tried kicking it off the card with DisconnectController() first.
This worked, although it returns EFI_NOT_FOUND, which is strange as that
error isn't defined for DisconnectController() per the spec.

I then tested if DisconnectController() alone is already sufficient
(i.e. without resetting the card by writing to its mmio).
Guess what, it is. So the EFI driver seems to leave the card in a
sane state if it's unloaded.

I then realized that the Simple Network protocol is supported for both
the wireless card as well as the Ethernet card built into my MacBook Pro.
What I'll try next is to iterate over all handles that support that
protocol and just Stop() the interface if it's been brought up by EFI.

Perhaps OS X supports some kind of connection handover from EFI.
That would explain why they leave the card enabled.

Best regards,

Lukas

WARNING: multiple messages have this Message-ID (diff)
From: Lukas Wunner <lukas@wunner.de>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	linux-pci@vger.kernel.org, linux-wireless@vger.kernel.org,
	zajec5@gmail.com, b43-dev@lists.infradead.org,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	linux-efi@vger.kernel.org, Andrew Worsley <amworsley@gmail.com>,
	Chris Bainbridge <chris.bainbridge@gmail.com>
Subject: [PATCH] PCI: Add Broadcom 4331 reset quirk to prevent IRQ storm
Date: Sun, 24 Apr 2016 18:58:58 +0200	[thread overview]
Message-ID: <20160424165858.GA17019@wunner.de> (raw)
In-Reply-To: <20160409120055.GR2701@codeblueprint.co.uk>

Hi,

On Sat, Apr 09, 2016 at 01:00:55PM +0100, Matt Fleming wrote:
> On Wed, 06 Apr, at 11:30:29PM, Lukas Wunner wrote:
> > (2) Find out exactly which EFI boot services area is used for DMA and
> >     amend arch/x86/platform/efi/quirks.c:efi_apply_memmap_quirks() to
> >     assign that area a different type if dmi_match(DMI_SYS_VENDOR,
> >     "Apple Inc."). That way it's not freed by efi_free_boot_services().
> >     Add a late_initcall which calls free_bootmem() for that area.
>  
> If it is possible to find out which boot services region is the
> problematic one, this would be the best solution. If there's any way
> to tie it into the PCI quirk, that would be even better so we don't
> need to maintain the blacklist in two places.

I've since cooked up an experimental patch which resets the Broadcom 4331
wireless card from arch/x86/kernel/early-quirks.c, and another which does
the same from arch/x86/boot/compressed/eboot.c. Both approaches stopped
the spurious interrupts for me and should also stop the DMA'ing.

In the latter case, the machine locked up immediately after resetting the
card. Suspecting that the EFI driver doesn't digest the reset well,
I tried kicking it off the card with DisconnectController() first.
This worked, although it returns EFI_NOT_FOUND, which is strange as that
error isn't defined for DisconnectController() per the spec.

I then tested if DisconnectController() alone is already sufficient
(i.e. without resetting the card by writing to its mmio).
Guess what, it is. So the EFI driver seems to leave the card in a
sane state if it's unloaded.

I then realized that the Simple Network protocol is supported for both
the wireless card as well as the Ethernet card built into my MacBook Pro.
What I'll try next is to iterate over all handles that support that
protocol and just Stop() the interface if it's been brought up by EFI.

Perhaps OS X supports some kind of connection handover from EFI.
That would explain why they leave the card enabled.

Best regards,

Lukas

  reply	other threads:[~2016-04-24 16:56 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 18:20 [PATCH] PCI: Add Broadcom 4331 reset quirk to prevent IRQ storm Lukas Wunner
2016-03-31 18:51 ` Rafał Miłecki
2016-03-31 18:51   ` Rafał Miłecki
2016-04-05 19:40 ` Bjorn Helgaas
2016-04-05 19:40   ` Bjorn Helgaas
2016-04-05 19:49   ` Michael Büsch
2016-04-05 19:49     ` Michael Büsch
2016-04-06 13:31     ` Bjorn Helgaas
2016-04-06 13:31       ` Bjorn Helgaas
2016-04-06 15:17       ` Michael Büsch
2016-04-06 15:17         ` Michael Büsch
2016-04-06 21:36         ` Lukas Wunner
2016-04-06 21:36           ` Lukas Wunner
2016-04-05 19:59   ` Matthew Garrett
2016-04-05 19:59     ` Matthew Garrett
2016-04-06 11:28     ` Andrew Worsley
2016-04-06 11:28       ` Andrew Worsley
2016-04-06 21:30   ` Lukas Wunner
2016-04-06 21:30     ` Lukas Wunner
2016-04-06 21:30     ` Lukas Wunner
2016-04-06 22:19     ` Matthew Garrett
2016-04-06 22:19       ` Matthew Garrett
2016-04-06 22:19       ` Matthew Garrett
2016-04-09 12:00     ` Matt Fleming
2016-04-09 12:00       ` Matt Fleming
2016-04-24 16:58       ` Lukas Wunner [this message]
2016-04-24 16:58         ` Lukas Wunner
     [not found] <E1akxli-00030z-BC@bombadil.infradead.org>
2016-03-31 23:13 ` Chris Bainbridge
2016-03-31 23:13   ` Chris Bainbridge
2016-04-01  4:59   ` Michael Büsch
2016-04-01  4:59     ` Michael Büsch
2016-04-01 22:46   ` Lukas Wunner
2016-04-01 22:46     ` Lukas Wunner
2016-04-02  7:30     ` Michael Büsch
2016-04-02  7:30       ` Michael Büsch
2016-04-02 11:40 ` Andrew Worsley
2016-04-03 11:49   ` Lukas Wunner
2016-04-03 11:49     ` Lukas Wunner
2016-04-07 12:04     ` Andrew Worsley
2016-04-07 12:04       ` Andrew Worsley
2016-04-10 10:09       ` Andrew Worsley
2016-04-10 10:09         ` Andrew Worsley
2016-04-12 18:32         ` Lukas Wunner
2016-04-12 18:32           ` Lukas Wunner
2016-04-13 20:42           ` Andrew Worsley
2016-04-13 20:42             ` Andrew Worsley
2016-04-24 17:04             ` Lukas Wunner
2016-04-24 17:04               ` Lukas Wunner
2016-05-23 14:42               ` Lukas Wunner
2016-05-23 14:42                 ` Lukas Wunner
2016-05-24 23:38                 ` Chris Bainbridge
2016-05-24 23:38                   ` Chris Bainbridge
     [not found] <E1akxli-00030z-Jz@bombadil.infradead.org>
2016-03-31 19:09 ` Michael Büsch
2016-03-31 19:09   ` Michael Büsch
  -- strict thread matches above, loose matches on Subject: below --
2016-03-29 17:46 Lukas Wunner
2016-03-29 17:46 ` Lukas Wunner
2016-03-29 17:41 Lukas Wunner

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=20160424165858.GA17019@wunner.de \
    --to=lukas@wunner.de \
    --cc=amworsley@gmail.com \
    --cc=b43-dev@lists.infradead.org \
    --cc=chris.bainbridge@gmail.com \
    --cc=helgaas@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mjg59@srcf.ucam.org \
    --cc=zajec5@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.