All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: "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>,
	lukas@wunner.de, "Linus Torvalds" <torvalds@linux-foundation.org>,
	"Matthew Garrett" <mjg59@srcf.ucam.org>,
	m@bues.ch
Cc: "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: Wed, 8 Jun 2016 11:56:14 -0700	[thread overview]
Message-ID: <CAE9FiQVapnZ8akNWLo-c8sD4enA1qGcW50vmv7_-9g78Hsm4sg@mail.gmail.com> (raw)
In-Reply-To: <tip-625a99d9bfd038ea492f57308555bf4e607ce591@git.kernel.org>

On Wed, Jun 8, 2016 at 7:23 AM, tip-bot for Lukas Wunner
<tipbot@zytor.com> wrote:
> Commit-ID:  625a99d9bfd038ea492f57308555bf4e607ce591
> Gitweb:     http://git.kernel.org/tip/625a99d9bfd038ea492f57308555bf4e607ce591
> Author:     Lukas Wunner <lukas@wunner.de>
> AuthorDate: Sun, 29 May 2016 01:35:28 +0200
...
> ---
>  arch/x86/kernel/early-quirks.c | 95 ++++++++++++++++++++++++++++++++++++------
>  drivers/bcma/bcma_private.h    |  2 -
>  include/linux/bcma/bcma.h      |  1 +
>  3 files changed, 83 insertions(+), 15 deletions(-)
>
> diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
> index bca14c8..4e4e499 100644
> --- a/arch/x86/kernel/early-quirks.c
> +++ b/arch/x86/kernel/early-quirks.c
...

Extend bus scan range part should be in separated patch?

and put apple_airport_reset() related in second patch.

> -/*
> - * Only works for devices on the root bus. If you add any devices
> - * not on bus 0 readd another loop level in early_quirks(). But
> - * be careful because at least the Nvidia quirk here relies on
> - * only matching on bus 0.
> - */
>  static struct chipset early_qrk[] __initdata = {
>         { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
>           PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs },
> @@ -638,9 +692,13 @@ static struct chipset early_qrk[] __initdata = {
>          */
>         { PCI_VENDOR_ID_INTEL, 0x0f00,
>                 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet},
> +       { PCI_VENDOR_ID_BROADCOM, 0x4331,
> +         PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, 0, apple_airport_reset},
>         {}
>  };
>
> +static void __init early_pci_scan_bus(int bus);
> +
>  /**
>   * check_dev_quirk - apply early quirks to a given PCI device
>   * @num: bus number
> @@ -649,7 +707,7 @@ static struct chipset early_qrk[] __initdata = {
>   *
>   * Check the vendor & device ID against the early quirks table.
>   *
> - * If the device is single function, let early_quirks() know so we don't
> + * If the device is single function, let early_pci_scan_bus() know so we don't
>   * poke at this device again.
>   */
>  static int __init check_dev_quirk(int num, int slot, int func)
> @@ -658,6 +716,7 @@ static int __init check_dev_quirk(int num, int slot, int func)
>         u16 vendor;
>         u16 device;
>         u8 type;
> +       u8 sec;
>         int i;
>
>         class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE);
> @@ -685,25 +744,35 @@ static int __init check_dev_quirk(int num, int slot, int func)
>
>         type = read_pci_config_byte(num, slot, func,
>                                     PCI_HEADER_TYPE);
> +
> +       if ((type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) {
> +               sec = read_pci_config_byte(num, slot, func, PCI_SECONDARY_BUS);
> +               early_pci_scan_bus(sec);

How do you know that sec is valid ?

How about on the system that have one bridge that still have sec num register 0?

it will be get into dead loop.

> +       }
> +
>         if (!(type & 0x80))
>                 return -1;
>
>         return 0;
>  }
>
> -void __init early_quirks(void)
> +static void __init early_pci_scan_bus(int bus)
>  {
>         int slot, func;
>
> -       if (!early_pci_allowed())
> -               return;
> -
>         /* Poor man's PCI discovery */
> -       /* Only scan the root bus */
>         for (slot = 0; slot < 32; slot++)
>                 for (func = 0; func < 8; func++) {
>                         /* Only probe function 0 on single fn devices */
> -                       if (check_dev_quirk(0, slot, func))
> +                       if (check_dev_quirk(bus, slot, func))
>                                 break;
>                 }
>  }
> +
> +void __init early_quirks(void)
> +{
> +       if (!early_pci_allowed())
> +               return;
> +
> +       early_pci_scan_bus(0);
> +}

Would just revert to scan domain 0, bus 0 to 255.

Thanks

Yinghai

  reply	other threads:[~2016-06-08 18:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-28 23:35 [PATCH] x86: Add early quirk to reset Apple AirPort card 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 [this message]
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
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=CAE9FiQVapnZ8akNWLo-c8sD4enA1qGcW50vmv7_-9g78Hsm4sg@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 \
    /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.