All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	cmilsted@redhat.com, "Rafa?? Mi??ecki" <zajec5@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	m@bues.ch,
	"linux-tip-commits@vger.kernel.org" 
	<linux-tip-commits@vger.kernel.org>
Subject: Re: [tip:x86/urgent] x86/quirks: Add early quirk to reset Apple AirPort card
Date: Thu, 9 Jun 2016 09:37:53 -0700	[thread overview]
Message-ID: <CAE9FiQVN25PC_jMG1cDqwrDc_X2gMFwVMnLcgyiMST6_868Aaw@mail.gmail.com> (raw)
In-Reply-To: <20160609110424.GA19470@wunner.de>

On Thu, Jun 9, 2016 at 4:04 AM, Lukas Wunner <lukas@wunner.de> wrote:
> Subject: [PATCH] x86/quirks: Validate secondary bus number
>
> We used to brute-force scan buses 0 to 31 until commit 8659c406ade3
> ("x86: only scan the root bus in early PCI quirks") constrained the scan
> to the root bus, in part to shorten boot time.
>
> Commit 625a99d9bfd0 ("x86/quirks: Add early quirk to reset Apple AirPort
> card") reintroduced scanning of secondary buses, but used a recursive
> strategy to scan only buses that are actually present.
>
> However the secondary bus number read from a bridge's config space may
> be invalid, in particular a value of 0 causes an infinite loop. The PCI
> core goes beyond that and recurses to a child bus only if its bus number
> is greater than the parent bus number (see pci_scan_bridge()). Since the
> root bus is numbered 0, this implies that secondary buses may not be 0.
> Do the same on early scanning.
>
> Suggested-by: Yinghai Lu <yinghai@kernel.org>
> Fixes: 625a99d9bfd0 ("x86/quirks: Add early quirk to reset Apple AirPort card")
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
>  arch/x86/kernel/early-quirks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
> index 4e4e499..c24070e 100644
> --- 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.

Thanks

Yinghai

  reply	other threads:[~2016-06-09 16:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-28 23:35 [PATCH] x86: " Lukas Wunner
2016-05-28 23:35 ` Lukas Wunner
2016-06-02  9:48 ` Matt Fleming
2016-06-02  9:48   ` Matt Fleming
2016-06-08 14:23 ` [tip:x86/urgent] x86/quirks: " tip-bot for Lukas Wunner
2016-06-08 18:56   ` Yinghai Lu
2016-06-08 20:09     ` Lukas Wunner
2016-06-09  6:48       ` Ingo Molnar
2016-06-09 11:04         ` Lukas Wunner
2016-06-09 16:37           ` Yinghai Lu [this message]
2016-06-09 20:20             ` Lukas Wunner
2016-06-10  0:04               ` Yinghai Lu
2016-06-10 11:58                 ` Ingo Molnar
2016-06-10 12:16                   ` Lukas Wunner
2016-06-10 12:59                     ` Ingo Molnar
2016-06-10 13:59                       ` Lukas Wunner
2016-06-10 20:08                         ` Bjorn Helgaas
2016-06-12 11:13                           ` Lukas Wunner
2016-06-09 22:57 ` [PATCH] x86: " Bjorn Helgaas
2016-06-09 22:57   ` Bjorn Helgaas
2016-06-12 10:31 [PATCH v2 3/3] x86/quirks: " Lukas Wunner
2016-07-10 19:01 ` [tip:x86/urgent] " tip-bot for 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=CAE9FiQVN25PC_jMG1cDqwrDc_X2gMFwVMnLcgyiMST6_868Aaw@mail.gmail.com \
    --to=yinghai@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=cmilsted@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=m@bues.ch \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=zajec5@gmail.com \
    --subject='Re: [tip:x86/urgent] x86/quirks: Add early quirk to reset Apple AirPort card' \
    /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

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.