All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org,
	linux-samsung-soc@vger.kernel.org, Joerg Roedel <joro@8bytes.org>,
	Inki Dae <inki.dae@samsung.com>, Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Mark Brown <broonie@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Kevin Hilman <khilman@kernel.org>,
	Tobias Jakobi <tjakobi@math.uni-bielefeld.de>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH v5 7/7] iommu/exynos: Use device dependency links to control runtime pm
Date: Sat, 19 Nov 2016 12:11:57 +0100	[thread overview]
Message-ID: <20161119111157.GA364@wunner.de> (raw)
In-Reply-To: <4bc652ce-6cf9-f4df-4793-e126cf81079d@samsung.com>

On Tue, Nov 08, 2016 at 08:27:12AM +0100, Marek Szyprowski wrote:
> On 2016-11-07 22:47, Luis R. Rodriguez wrote:
> > If so
> > why? If this issue is present also on systems that only use ACPI is
> > this possibly due to an ACPI firmware bug  or the lack of some semantics
> > in ACPI to express ordering in a better way? If the issue is device
> > tree related only is this due to the lack of semantics in device tree
> > to express some more complex dependency ?
> 
> The main feature of device links that is used in this patch is enabling
> runtime pm dependency between Exynos SYSMMU controller (called it client
> device) and the device, for which it implements DMA address translation
> (called master device). The assumptions are following:
> 1. master device driver is completely unaware of the Exynos SYSMMU presence,
>    IOMMU is transparently hooked up and managed by DMA-mapping framework
> 2. SYSMMU belongs to the same power domain as it's master device
> 3. SYSMMU is optional, master device can fully operate without it, with
>    simple DMA address translation (DMA address == physical address)
> 4. Master device implements runtime pm, what in turn causes respective
>    power domain to be turned on/off
> 5. DMA-mapping and IOMMU frameworks provides no calls to notify SYSMMU
>    when its master device is performing DMA operations, so SYSMMU has
>    to be runtime active
> 6. Currently SYSMMU always sets its runtime pm status to active after
>    attaching to its master device to ensure proper hardware state. This
>    prevents power domain to be turned off, even when master device sets
>    its runtime pm status to suspended.
> 7. Exynos SYSMMU has to be runtime active at the same time when its
>    master device is runtime active to it to perform DMA operations and
>    allow the power domain to be turned off, when master device is
>    runtime suspended.
> 8. The terms of device links, Exynos SYSMMU is a 'consumer' and master
>    device is a 'supplier'.

You seem to have mixed up the consumer and supplier in point 8 above.
Your code is such that the SYSMMU is the supplier and the master device
is the consumer:

	device_link_add(dev, data->sysmmu, DL_FLAG_PM_RUNTIME);

Prototype of device_link_add:

	struct device_link *device_link_add(struct device *consumer,
				            struct device *supplier,
					    u32 flags);

Your code is correct, only point 8 above is wrong.

Best regards,

Lukas

WARNING: multiple messages have this Message-ID (diff)
From: Lukas Wunner <lukas@wunner.de>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org,
	linux-samsung-soc@vger.kernel.org, Joerg Roedel <joro@8bytes.org>,
	Inki Dae <inki.dae@samsung.com>, Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Mark Brown <broonie@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Kevin Hilman <khilman@kernel.org>,
	Tobias Jakobi <tjakobi@math.uni-bielefeld.de>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH v5 7/7] iommu/exynos: Use device dependency links to control runtime pm
Date: Sat, 19 Nov 2016 12:11:57 +0100	[thread overview]
Message-ID: <20161119111157.GA364@wunner.de> (raw)
In-Reply-To: <4bc652ce-6cf9-f4df-4793-e126cf81079d@samsung.com>

On Tue, Nov 08, 2016 at 08:27:12AM +0100, Marek Szyprowski wrote:
> On 2016-11-07 22:47, Luis R. Rodriguez wrote:
> > If so
> > why? If this issue is present also on systems that only use ACPI is
> > this possibly due to an ACPI firmware bug  or the lack of some semantics
> > in ACPI to express ordering in a better way? If the issue is device
> > tree related only is this due to the lack of semantics in device tree
> > to express some more complex dependency ?
> 
> The main feature of device links that is used in this patch is enabling
> runtime pm dependency between Exynos SYSMMU controller (called it client
> device) and the device, for which it implements DMA address translation
> (called master device). The assumptions are following:
> 1. master device driver is completely unaware of the Exynos SYSMMU presence,
>    IOMMU is transparently hooked up and managed by DMA-mapping framework
> 2. SYSMMU belongs to the same power domain as it's master device
> 3. SYSMMU is optional, master device can fully operate without it, with
>    simple DMA address translation (DMA address == physical address)
> 4. Master device implements runtime pm, what in turn causes respective
>    power domain to be turned on/off
> 5. DMA-mapping and IOMMU frameworks provides no calls to notify SYSMMU
>    when its master device is performing DMA operations, so SYSMMU has
>    to be runtime active
> 6. Currently SYSMMU always sets its runtime pm status to active after
>    attaching to its master device to ensure proper hardware state. This
>    prevents power domain to be turned off, even when master device sets
>    its runtime pm status to suspended.
> 7. Exynos SYSMMU has to be runtime active at the same time when its
>    master device is runtime active to it to perform DMA operations and
>    allow the power domain to be turned off, when master device is
>    runtime suspended.
> 8. The terms of device links, Exynos SYSMMU is a 'consumer' and master
>    device is a 'supplier'.

You seem to have mixed up the consumer and supplier in point 8 above.
Your code is such that the SYSMMU is the supplier and the master device
is the consumer:

	device_link_add(dev, data->sysmmu, DL_FLAG_PM_RUNTIME);

Prototype of device_link_add:

	struct device_link *device_link_add(struct device *consumer,
				            struct device *supplier,
					    u32 flags);

Your code is correct, only point 8 above is wrong.

Best regards,

Lukas

  parent reply	other threads:[~2016-11-19 11:10 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161020072330eucas1p2b09ad8d091171edbac9449815fdc0fb7@eucas1p2.samsung.com>
2016-10-20  7:22 ` [PATCH v5 0/7] Exynos IOMMU: proper runtime PM support (use device dependencies) Marek Szyprowski
2016-10-20  7:22   ` Marek Szyprowski
     [not found]   ` <CGME20161020072331eucas1p1af7dc7270b0b19168b949f3416eda474@eucas1p1.samsung.com>
2016-10-20  7:22     ` [PATCH v5 1/7] iommu/exynos: Remove excessive, useless debug Marek Szyprowski
2016-10-20  7:22       ` Marek Szyprowski
     [not found]   ` <CGME20161020072332eucas1p1d980c1659979bd5bc2918bfc9d40a415@eucas1p1.samsung.com>
2016-10-20  7:22     ` [PATCH v5 2/7] iommu/exynos: Remove dead code Marek Szyprowski
2016-10-20  7:22       ` Marek Szyprowski
     [not found]   ` <CGME20161020072332eucas1p26960035de3007724498d59057329683d@eucas1p2.samsung.com>
2016-10-20  7:22     ` [PATCH v5 3/7] iommu/exynos: Simplify internal enable/disable functions Marek Szyprowski
2016-10-20  7:22       ` Marek Szyprowski
     [not found]   ` <CGME20161020072333eucas1p25b638379091939f10b3c9eb5d89a031e@eucas1p2.samsung.com>
2016-10-20  7:22     ` [PATCH v5 4/7] iommu/exynos: Set master device once on boot Marek Szyprowski
     [not found]   ` <CGME20161020072334eucas1p2a159a25a2875611eff208381ebdb2e84@eucas1p2.samsung.com>
2016-10-20  7:22     ` [PATCH v5 5/7] iommu/exynos: Rework and fix internal locking Marek Szyprowski
2016-10-20  7:22       ` Marek Szyprowski
     [not found]   ` <CGME20161020072335eucas1p209675d6fbf39e5045281e8023fa9d234@eucas1p2.samsung.com>
2016-10-20  7:22     ` [PATCH v5 6/7] iommu/exynos: Add runtime pm support Marek Szyprowski
2016-10-20  7:22       ` Marek Szyprowski
2016-10-22  5:50       ` Sricharan
2016-10-22  5:50         ` Sricharan
2016-10-24  5:19         ` Marek Szyprowski
2016-10-24 12:15           ` Sricharan
2016-10-24 12:15             ` Sricharan
     [not found]   ` <CGME20161020072336eucas1p24a2b020f69b6ae1f55e1760e6e0e94f9@eucas1p2.samsung.com>
2016-10-20  7:22     ` [PATCH v5 7/7] iommu/exynos: Use device dependency links to control runtime pm Marek Szyprowski
2016-10-23  9:49       ` Sricharan
2016-10-23  9:49         ` Sricharan
2016-10-24  5:30         ` Marek Szyprowski
2016-10-24  5:30           ` Marek Szyprowski
2016-10-24 12:29           ` Sricharan
2016-10-24 12:29             ` Sricharan
2016-10-24 12:39             ` Marek Szyprowski
2016-10-25  6:53               ` Sricharan
2016-10-25  6:53                 ` Sricharan
2016-11-07 21:47       ` Luis R. Rodriguez
2016-11-07 21:47         ` Luis R. Rodriguez
2016-11-08  7:27         ` Marek Szyprowski
2016-11-08  7:27           ` Marek Szyprowski
2016-11-08 15:30           ` Lukas Wunner
2016-11-08 15:30             ` Lukas Wunner
2016-11-09 23:55             ` Luis R. Rodriguez
2016-11-09 23:55               ` Luis R. Rodriguez
2016-11-10  0:05               ` Rafael J. Wysocki
2016-11-10  0:05                 ` Rafael J. Wysocki
2016-11-10  0:12                 ` Luis R. Rodriguez
2016-11-10  0:12                   ` Luis R. Rodriguez
2016-11-10  0:20                   ` Rafael J. Wysocki
2016-11-10  0:20                     ` Rafael J. Wysocki
2016-11-09 23:56             ` Rafael J. Wysocki
2016-11-09 23:56               ` Rafael J. Wysocki
2016-11-16  9:30               ` Lukas Wunner
2016-11-16  9:30                 ` Lukas Wunner
2016-11-19 11:11           ` Lukas Wunner [this message]
2016-11-19 11:11             ` Lukas Wunner
2016-11-21 13:11             ` Marek Szyprowski
2016-11-21 13:11               ` Marek Szyprowski

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=20161119111157.GA364@wunner.de \
    --to=lukas@wunner.de \
    --cc=a.hajda@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=broonie@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@linuxfoundation.org \
    --cc=inki.dae@samsung.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kgene@kernel.org \
    --cc=khilman@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lars@metafoo.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mcgrof@kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=rjw@rjwysocki.net \
    --cc=tjakobi@math.uni-bielefeld.de \
    --cc=tomasz.figa@gmail.com \
    --cc=tomeu.vizoso@collabora.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.