iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
To: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>
Cc: Krzysztof Kozlowski
	<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Bartlomiej Zolnierkiewicz
	<b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Inki Dae <inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	"open list:AMD IOMMU (AMD-VI)"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	Kukjin Kim <kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andreas Noever
	<andreas.noever-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v2 02/10] driver core: Functional dependencies tracking support
Date: Wed, 20 Jul 2016 08:24:50 +0200	[thread overview]
Message-ID: <20160720062450.GA8066@wunner.de> (raw)
In-Reply-To: <1975118.iO8UCAENoH-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>

On Wed, Jul 20, 2016 at 02:33:18AM +0200, Rafael J. Wysocki wrote:
> On Friday, June 17, 2016 04:07:38 PM Lukas Wunner wrote:
> > On Fri, Jun 17, 2016 at 02:54:56PM +0200, Rafael J. Wysocki wrote:
> > > On Fri, Jun 17, 2016 at 12:36 PM, Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> wrote:
> > > > On Fri, Jun 17, 2016 at 08:26:52AM +0200, Marek Szyprowski wrote:
> > > > > From: "Rafael J. Wysocki" <rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > > We also have such a functional dependency for Thunderbolt on Macs:
> > > > On resume from system sleep, the PCIe hotplug ports may not resume
> > > > before the thunderbolt driver has reestablished the PCI tunnels.
> > > > Currently this is enforced by quirk_apple_wait_for_thunderbolt()
> > > > in drivers/pci/quirks.c. It would be good if we could represent
> > > > this dependency using something like Rafael's approach instead of
> > > > open coding it, however one detail in Rafael's patches is problematic:
> > > >
> > > > > New links are added by calling device_link_add() which may happen
> > > > > either before the consumer device is probed or when probing it, in
> > > > > which case the caller needs to ensure that the driver of the
> > > > > supplier device is present and functional and the DEVICE_LINK_PROBE_TIME
> > > > > flag should be passed to device_link_add() to reflect that.
> > > >
> > > > The thunderbolt driver cannot call device_link_add() before the
> > > > PCIe hotplug ports are bound to a driver unless we amend portdrv
> > > > to return -EPROBE_DEFER for Thunderbolt hotplug ports on Macs
> > > > if the thunderbolt driver isn't loaded.
> > > >
> > > > It would therefore be beneficial if device_link_add() can be
> > > > called even *after* the consumer is bound.
> > > 
> > > I don't quite follow.
> > > 
> > > Who's the provider and who's the consumer here?
> > 
> > thunderbolt.ko is the supplier.
> 
> But it binds to the children of the ports that are supposed to be its
> consumers?
> 
> Why is that even expected to work?

No, the consumers are aunts (or uncles) of the supplier, if you will. :-)

The consumers are the hotplug ports (named "Downstream Bridge 1 / 2" in
the drawing below). The supplier is the NHI:

      (Root Port) ---- Upstream Bridge --+-- Downstream Bridge 0 ---- NHI
                                         +-- Downstream Bridge 1 --
                                         +-- Downstream Bridge 2 --
                                         ...

We're calling pci_power_up() and pci_restore_state() from
pci_pm_resume_noirq(). And that will fail for devices below
the hotplug ports if the PCI tunnels haven't been re-established
yet by the NHI.

Currently we achieve that via quirk_apple_wait_for_thunderbolt() in
drivers/pci/quirks.c. It would be more elegant if we could make this
relationship explicit with "device links" and let the core handle it.

Or am I mistaken and this particular use case is not what "device links"
are intended for?

Thanks,

Lukas

  parent reply	other threads:[~2016-07-20  6:24 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17  6:26 [PATCH v2 00/10] Exynos IOMMU: proper runtime PM support (use device dependencies) Marek Szyprowski
     [not found] ` <1466144820-6286-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-06-17  6:26   ` [PATCH v2 01/10] driver core: Add a wrapper around __device_release_driver() Marek Szyprowski
2016-06-17  6:26   ` [PATCH v2 02/10] driver core: Functional dependencies tracking support Marek Szyprowski
2016-06-17 10:36     ` Lukas Wunner
     [not found]       ` <20160617103620.GA1626-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-06-17 12:54         ` Rafael J. Wysocki
2016-06-17 14:07           ` Lukas Wunner
2016-07-20  0:33             ` Rafael J. Wysocki
     [not found]               ` <1975118.iO8UCAENoH-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2016-07-20  6:24                 ` Lukas Wunner [this message]
2016-07-20 12:52                   ` Rafael J. Wysocki
2016-07-20 15:23                     ` Lukas Wunner
2016-07-20 22:51                       ` Rafael J. Wysocki
2016-07-20 23:25                         ` Lukas Wunner
2016-07-21  0:25                           ` Rafael J. Wysocki
2016-07-24 22:48                             ` Lukas Wunner
2016-07-28  0:30                               ` Rafael J. Wysocki
2016-07-28 15:28                                 ` Lukas Wunner
     [not found]                                   ` <20160728152831.GA1929-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-09-06 23:57                                     ` Rafael J. Wysocki
2016-06-17  6:26   ` [PATCH v2 03/10] PM core: Make async suspend/resume of devices use device links Marek Szyprowski
2016-06-17  6:26   ` [PATCH v2 04/10] PM core: Make runtime PM " Marek Szyprowski
2016-06-17  6:26   ` [PATCH v2 05/10] PM core: Optimize the use of device links for runtime PM Marek Szyprowski
2016-06-17  6:26   ` [PATCH v2 06/10] driver core: Avoid endless recursion if device has more than one link Marek Szyprowski
     [not found]     ` <1466144820-6286-7-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-09-06 23:09       ` Rafael J. Wysocki
2016-06-17  6:26   ` [PATCH v2 07/10] driver core: Add support for links to already probed drivers Marek Szyprowski
2016-09-06 23:13     ` Rafael J. Wysocki
2016-06-17  6:26   ` [PATCH v2 08/10] PM core: Fix restoring devices with links during system PM transition Marek Szyprowski
2016-09-06 23:24     ` Rafael J. Wysocki
2016-06-17  6:26   ` [PATCH v2 09/10] iommu/exynos: Remove excessive, useless debug Marek Szyprowski
2016-06-17  6:27   ` [PATCH v2 10/10] iommu/exynos: Add proper runtime pm support Marek Szyprowski
2016-07-14 15:41 ` [PATCH v2 00/10] Exynos IOMMU: proper runtime PM support (use device dependencies) Tobias Jakobi
     [not found]   ` <5787B2B0.9020809-o02PS0xoJP9W0yFyLvAVXMxlOr/tl8fh@public.gmane.org>
2016-07-15 13:21     ` Tobias Jakobi
2016-07-18 10:32       ` Marek Szyprowski
2016-07-18 11:00         ` Tobias Jakobi
     [not found]           ` <578CB6DB.90608-o02PS0xoJP9W0yFyLvAVXMxlOr/tl8fh@public.gmane.org>
2016-07-18 13:50             ` Marek Szyprowski
     [not found]               ` <6939949e-4c8e-cba0-9858-b37d1ba01869-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-07-18 16:43                 ` Tobias Jakobi
     [not found]                   ` <578D0716.6060106-o02PS0xoJP9W0yFyLvAVXMxlOr/tl8fh@public.gmane.org>
2016-07-19  6:26                     ` Marek Szyprowski
     [not found]                       ` <7c770ff5-2b22-adf6-b8d0-e94d1d7d7550-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-07-24 18:02                         ` Tobias Jakobi

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=20160720062450.GA8066@wunner.de \
    --to=lukas-jfq808j9c/izqb+pc5nmwq@public.gmane.org \
    --cc=andreas.noever-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org \
    --cc=ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).