Re: [tip:x86/urgent] x86/quirks: Add early quirk to reset Apple AirPort card

From: Lukas Wunner
Date: Thu Jun 09 2016 - 16:16:53 EST


On Thu, Jun 09, 2016 at 09:37:53AM -0700, Yinghai Lu wrote:
> On Thu, Jun 9, 2016 at 4:04 AM, Lukas Wunner <lukas@xxxxxxxxx> wrote:
> > --- a/arch/x86/kernel/early-quirks.c
> > +++ b/arch/x86/kernel/early-quirks.c
> > @@ -747,7 +747,8 @@ static int __init check_dev_quirk(int num, int slot, int func)
> >
> > if ((type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) {
> > sec = read_pci_config_byte(num, slot, func, PCI_SECONDARY_BUS);
> > - early_pci_scan_bus(sec);
> > + if (sec > num)
> > + early_pci_scan_bus(sec);
> > }
> >
> > if (!(type & 0x80))
>
> If two bridges have sec, then early_pci_scan_bus still could be called
> two times.
>
> Maybe we can add one static array to recorded scanned bus.
> static unsigned char scanned_bus[256];
> and in early_pci_scan_bus check and set that before scanning.

Well, the PCI core would also scan such a bus twice AFAICS.
And the performance penalty of scanning it twice seems negligible.
Early quirks can prevent double execution by setting QFLAG_APPLY_ONCE.
(Three quirks have set that flag already.)

So I think this shouldn't be a concern.

Thanks,

Lukas