linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 2/2] PCI: tegra: apply relaxed ordering fixup only on Tegra
Date: Fri, 23 Jan 2015 16:40:32 -0600	[thread overview]
Message-ID: <20150123224032.GO29776@google.com> (raw)
In-Reply-To: <1421179048-25370-2-git-send-email-l.stach@pengutronix.de>

On Tue, Jan 13, 2015 at 08:57:28PM +0100, Lucas Stach wrote:
> The fixup to enable relaxed ordering on all PCI devices was
> executed unconditionally if the Tegra PCI host driver was
> built into the kernel. This doesn't play nice with a
> multiplatform kernel executed on other platforms which
> may not need this fixup.
> 
> Make sure to only apply the fixup if the root port is
> a Tegra.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> Acked-by: Thierry Reding <treding@nvidia.com>
> ---
> v2:
> - split out PCI hierarchy walk
> - separate code from data by moving PCI IDs into own structure
> v3:
> - fixup for helper rename
> - applied Thierry's ACK
> ---
>  drivers/pci/host/pci-tegra.c | 34 +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
> index 6f9c29fa70e7..e87d79559723 100644
> --- a/drivers/pci/host/pci-tegra.c
> +++ b/drivers/pci/host/pci-tegra.c
> @@ -635,10 +635,42 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf1, tegra_pcie_fixup_class);
>  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0e1c, tegra_pcie_fixup_class);
>  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0e1d, tegra_pcie_fixup_class);
>  
> +static const struct pci_device_id tegra_rootport_ids[] = {
> +	{
> +		/* Tegra20 4 lane root port */
> +		.vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0bf0,
> +		.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
> +	}, {
> +		/* Tegra20 2 lane root port */
> +		.vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0bf1,
> +		.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
> +	}, {
> +		/* Tegra30 4 lane root port */
> +		.vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0e1c,
> +		.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
> +	}, {
> +		/* Tegra30 2 lane root port */
> +		.vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0e1d,
> +		.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
> +	}, {
> +		/* Tegra124 4 lane root port */
> +		.vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0e12,
> +		.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
> +	}, {
> +		/* Tegra124 1 lane root port */
> +		.vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0e13,
> +		.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
> +	}, {
> +		/* sentinel */
> +	}

The table is OK and I'll apply it after we resolve the pci_find_root_port()
thing, but it's unfortunate that we're signing up to the ongoing
maintenance a table like this requires.  I'm sure you've already tried
other possibilities and resigned yourself to this one, though.

> +};
> +
>  /* Tegra PCIE requires relaxed ordering */
>  static void tegra_pcie_relax_enable(struct pci_dev *dev)
>  {
> -	pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN);
> +	if (pci_match_id(tegra_rootport_ids, pci_find_root_port(dev)))
> +		pcie_capability_set_word(dev, PCI_EXP_DEVCTL,
> +					 PCI_EXP_DEVCTL_RELAX_EN);
>  }
>  DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tegra_pcie_relax_enable);
>  
> -- 
> 2.1.4
> 

  reply	other threads:[~2015-01-23 22:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 19:57 [PATCH v3 1/2] PCI: add helper function to find root port for device Lucas Stach
2015-01-13 19:57 ` [PATCH v3 2/2] PCI: tegra: apply relaxed ordering fixup only on Tegra Lucas Stach
2015-01-23 22:40   ` Bjorn Helgaas [this message]
2015-01-23 22:34 ` [PATCH v3 1/2] PCI: add helper function to find root port for device Bjorn Helgaas
2015-03-30 10:36   ` Lucas Stach

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=20150123224032.GO29776@google.com \
    --to=bhelgaas@google.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).