From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751035AbcFIUQu (ORCPT ); Thu, 9 Jun 2016 16:16:50 -0400 Received: from mailout3.hostsharing.net ([176.9.242.54]:58304 "EHLO mailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbcFIUQt (ORCPT ); Thu, 9 Jun 2016 16:16:49 -0400 Date: Thu, 9 Jun 2016 22:20:36 +0200 From: Lukas Wunner To: Yinghai Lu Cc: Ingo Molnar , Thomas Gleixner , cmilsted@redhat.com, Rafa?? Mi??ecki , Bjorn Helgaas , "H. Peter Anvin" , Matt Fleming , Peter Zijlstra , Linux Kernel Mailing List , Linus Torvalds , Matthew Garrett , m@bues.ch, "linux-tip-commits@vger.kernel.org" Subject: Re: [tip:x86/urgent] x86/quirks: Add early quirk to reset Apple AirPort card Message-ID: <20160609202036.GA19638@wunner.de> References: <82c2548dffc6cfbc484b9111b1073f407c946061.1464477483.git.lukas@wunner.de> <20160608200929.GA18981@wunner.de> <20160609064803.GA10996@gmail.com> <20160609110424.GA19470@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 09, 2016 at 09:37:53AM -0700, Yinghai Lu wrote: > On Thu, Jun 9, 2016 at 4:04 AM, Lukas Wunner 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