From: Lukas Wunner <lukas@wunner.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
DRI mailing list <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v2 1/5] PCI: Recognize Thunderbolt devices
Date: Sat, 11 Mar 2017 09:22:38 +0100 [thread overview]
Message-ID: <20170311082238.GA4958@wunner.de> (raw)
In-Reply-To: <CAErSpo4nYs9+Od4PWORysDC_wa63GtJmuNLRjsi-odR7Zkk5+A@mail.gmail.com>
On Fri, Mar 10, 2017 at 02:47:04PM -0600, Bjorn Helgaas wrote:
> On Fri, Mar 10, 2017 at 2:23 PM, Lukas Wunner <lukas@wunner.de> wrote:
> > +/**
> > + * pci_is_thunderbolt_attached - whether device is on a Thunderbolt daisy chain
> > + * @pdev: PCI device to check
> > + *
> > + * Walk upwards from @pdev and check for each encountered bridge if it's part
> > + * of a Thunderbolt controller. Reaching the host bridge means @pdev is not
> > + * Thunderbolt-attached. (But rather soldered to the mainboard usually.)
>
> The "soldered to the mainboard" comment is misleading. We'll reach
> the host bridge and return "false" for any non-Thunderbolt-attached
> device, including all plug-in PCI and PCIe devices.
It does say "usually". :-) Seriously though, for someone coming from one
of the callers of pci_is_thunderbolt_attached() and trying to understand
its meaning, it may not be helpful if I had left it at "Reaching the host
bridge means @pdev is not Thunderbolt-attached."
What is the *consequence* of that? Most Thunderbolt-equipped products
have no other PCI expansion options, so indeed if the device is not on
a Thunderbolt daisy chain it must be soldered to the mainboard. If one
wants to be pedantic, one could add that it may alternatively be
soldered to a *daughter*board. (Which is the case on the MacPro6,1,
the black trashcan.) I was just trying to strike a balance between
technical correctness, didactic quality and brevity.
Best regards,
Lukas
>
> > + */
> > +static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
> > +{
> > + struct pci_dev *parent = pdev;
> > +
> > + if (pdev->is_thunderbolt)
> > + return true;
> > +
> > + while ((parent = pci_upstream_bridge(parent)))
> > + if (parent->is_thunderbolt)
> > + return true;
> > +
> > + return false;
> > +}
> > +
> > /* provide the legacy pci_dma_* API */
> > #include <linux/pci-dma-compat.h>
> >
> > --
> > 2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-03-11 8:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 20:23 [PATCH v2 0/5] Thunderbolt GPU fixes Lukas Wunner
2017-03-10 20:23 ` [PATCH v2 1/5] PCI: Recognize Thunderbolt devices Lukas Wunner
2017-03-10 20:47 ` Bjorn Helgaas
2017-03-11 8:22 ` Lukas Wunner [this message]
2017-03-10 20:23 ` [PATCH v2 4/5] drm/nouveau: Don't register Thunderbolt eGPU with vga_switcheroo Lukas Wunner
2017-03-10 20:23 ` [PATCH v2 5/5] apple-gmux: Don't switch external DP port on 2011+ MacBook Pros Lukas Wunner
2017-03-10 20:23 ` [PATCH v2 2/5] drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo Lukas Wunner
2017-03-10 20:23 ` [PATCH v2 3/5] drm/amdgpu: " Lukas Wunner
2017-03-18 7:39 ` [PATCH v2 0/5] Thunderbolt GPU fixes Lukas Wunner
2017-03-25 8:05 ` Lukas Wunner
2017-03-25 21:06 ` Daniel Vetter
2017-03-26 15:25 ` Lukas Wunner
2017-03-31 10:11 ` Lukas Wunner
2017-03-31 13:30 ` Bjorn Helgaas
2017-04-05 8:29 ` 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=20170311082238.GA4958@wunner.de \
--to=lukas@wunner.de \
--cc=bhelgaas@google.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
/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