ACPI / LPSS: fix system hangup on BYT/BSW/CHT
Subsystems (5)
Andy Shevchenko
reviewerv2 cover ACPI / LPSS: fix system hangup on BYT/BSW/CHT
Here is a next generation (previous one is [1]) of the long standing power issue fix regarding to LPSS on Intel Baytrail and Braswell SoCs, in particularly ASuS T100TA. There are few bugs already opened on kernel.org's and RedHat's bugzilla sites.
The series depends on the patch submitted earlier [2].
The patch 1 brings a new notification to handle the case when ->probe() of the driver fails. It allows to avoid a potential resource leak. I've noticed couple of drivers that are using that in assumption that ->probe() never fails.
The patch 2 is needed to fix an I2C issue which Jarkko is currently investigating.
It seems the best way to push it through linux-pm tree. Thus, it would be good to get ACKs from the rest of maintainers.
Rafael, it would be nice to have an immutable branch or tag for this sice I have more patches coming for dw_dmac driver which are based on top of this series.
The patches have been tested on ASuS T100TA, Intel Cherrytrail, and Intel Braswell SoCs.
[1] http://www.spinics.net/lists/linux-acpi/msg53963.html
[2] http://www.spinics.net/lists/kernel/msg2119229.html
Andy Shevchenko (7):
device core: add BUS_NOTIFY_BIND_DRIVER_ERROR notification ACPI / LPSS: allow to use specific PM domain during ->probe() ACPI / LPSS: do delay for all LPSS devices when D3->D0 ACPI / LPSS: override power state for LPSS DMA device
dmaengine: dw: platform: power on device on shutdown
dmaengine: dw: return immediately from IRQ when DMA isn't in use Revert "dmaengine: dw: platform: provide platform data for Intel"
arch/x86/Kconfig | 3 +- arch/x86/include/asm/iosf_mbi.h | 2 + drivers/acpi/acpi_lpss.c | 184 ++++++++++++++++++++++++++++++++++++---- drivers/base/dd.c | 8 +- drivers/dma/dw/core.c | 9 +- drivers/dma/dw/platform.c | 29 +++---- include/linux/device.h | 1 + 7 files changed, 198 insertions(+), 38 deletions(-)
Signature · 1 line
2.6.2
Andy Shevchenko
reviewerPATCH v2 1/7 device core: add BUS_NOTIFY_BIND_DRIVER_ERROR notification
In case ->probe() fails the notifier does not inform a subscriber about this. In the result it might happend that some resources that had been allocated will stay allocated and therefore lead to resource leak.
Introduce a new notification to inform the subscriber that ->probe() failed.
--- drivers/base/dd.c | 8 ++++++-- include/linux/device.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/base/dd.c +6 -2
@@ -290,7 +290,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)/* If using pinctrl, bind pins now before probing */ ret =pinctrl_bind_pins (dev);if (ret) - goto probe_failed; + goto pinctrl_bind_failed;if (driver_sysfs_add (dev)) { printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
@@ -334,6 +334,11 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto done; probe_failed: +if (dev->bus) +blocking_notifier_call_chain (&dev->bus->p->bus_notifier, +BUS_NOTIFY_BIND_DRIVER_ERROR , + dev); +pinctrl_bind_failed:devres_release_all (dev);driver_sysfs_remove (dev); dev->driver =NULL ;
@@ -701,7 +706,6 @@ static void __device_release_driver(struct device *dev)blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_UNBOUND_DRIVER , dev); - } }
include/linux/device.h +1 -0
@@ -191,6 +191,7 @@ extern int bus_unregister_notifier(struct bus_type *bus,unbound */ #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007/* driver is unbound from the device */ +#define BUS_NOTIFY_BIND_DRIVER_ERROR 0x80000004/* driver fails to be bound */ extern struct kset *bus_get_kset (struct bus_type *bus);extern struct klist *bus_get_device_klist (struct bus_type *bus);
Signature · 1 line
2.6.2
Re: [PATCH v2 1/7] device core: add BUS_NOTIFY_BIND_DRIVER_ERROR notification
Quoted 7 lines · Andy Shevchenko
In case ->probe() fails the notifier does not inform a subscriber about this. In the result it might happend that some resources that had been allocated will stay allocated and therefore lead to resource leak.
Introduce a new notification to inform the subscriber that ->probe() failed.
Signed-off-by Andy Shevchenko <[email protected]>
I'd rather say the problem is that the users of BUS_NOTIFY_BIND_DRIVER have no chance to do any cleanup in case of a probe failure (there may be problems even if resources aren't leaked).
Quoted 19 lines
--- drivers/base/dd.c | 8 ++++++-- include/linux/device.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)drivers/base/dd.c +1
-1@@ -290,7 +290,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)/* If using pinctrl, bind pins now before probing */ ret =pinctrl_bind_pins (dev);if (ret) - goto probe_failed; + goto pinctrl_bind_failed;if (driver_sysfs_add (dev)) { printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
drivers/base/dd.c static int really_probe(struct device *dev, struct device_driver *drv) · line 340
Quoted 7 lines
drivers/base/dd.c +4
-0@@ -334,6 +334,11 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto done; probe_failed: +if (dev->bus) +blocking_notifier_call_chain (&dev->bus->p->bus_notifier, +BUS_NOTIFY_BIND_DRIVER_ERROR , + dev);
Well, if we do that, device_bind_driver() needs to send that notification too in case it doesn't call driver_bound().
Quoted 17 lines
drivers/base/dd.c +1
-1+pinctrl_bind_failed:devres_release_all (dev);driver_sysfs_remove (dev); dev->driver =NULL ;@@ -701,7 +706,6 @@ static void __device_release_driver(struct device *dev)blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_UNBOUND_DRIVER , dev); - } }include/linux/device.h +0
-0
include/linux/device.h extern int bus_unregister_notifier(struct bus_type *bus, · line 194
Quoted 4 lines
include/linux/device.h +1
-0@@ -191,6 +191,7 @@ extern int bus_unregister_notifier(struct bus_type *bus,unbound */ #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007/* driver is unbound from the device */ +#define BUS_NOTIFY_BIND_DRIVER_ERROR 0x80000004/* driver fails to be bound */
I'd call it BUS_NOTIFY_DRIVER_NOT_BOUND.
include/linux/device.h extern int bus_unregister_notifier(struct bus_type *bus,
Quoted 4 lines
include/linux/device.h +0
-0extern struct kset *bus_get_kset (struct bus_type *bus);extern struct klist *bus_get_device_klist (struct bus_type *bus);
Thanks,
Rafael
Andy Shevchenko
reviewerRe: [PATCH v2 1/7] device core: add BUS_NOTIFY_BIND_DRIVER_ERROR notification
Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Andy Shevchenko
In case ->probe() fails the notifier does not inform a subscriber about this.
In the result it might happend that some resources that had been allocated will
stay allocated and therefore lead to resource leak.Introduce a new notification to inform the subscriber that ->probe() failed.
Quoted 7 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>I'd rather say the problem is that the users of
BUS_NOTIFY_BIND_DRIVERhave no
chance to do any cleanup in case of a probe failure (there may be problems even
if resources aren't leaked).
Thanks, Rafael, all of your comments sound reasonable for me. Will be taken into consideration in next version.
Quoted 76 lines
Quoted 31 lines
---
drivers/base/dd.c | 8 ++++++--
include/linux/device.h | 1 +2 files changed, 7 insertions(+), 2 deletions(-)drivers/base/dd.c +1
-1@@ -290,7 +290,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) /* If using pinctrl, bind pins now before probing */ ret = pinctrl_bind_pins(dev); if (ret) - goto probe_failed; + goto pinctrl_bind_failed;
if (driver_sysfs_add(dev)) { printk(KERN_ERR "%s:driver_sysfs_add(%s)failed\n",drivers/base/dd.c +0
-0@@ -334,6 +334,11 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto done;
probe_failed:drivers/base/dd.c +2
-0+if (dev->bus) + blocking_notifier_call_chain(&dev->bus->p-Quoted 1 line
bus_notifier,drivers/base/dd.c +1
-0+ BUS_NOTIFY_BIND_DRIVE
R_ERROR,drivers/base/dd.c static int really_probe(struct device *dev, struct device_driver *drv) · line 340
Quoted 1 line
drivers/base/dd.c +1
-0+ dev);Well, if we do that,
device_bind_driver()needs to send that notification too
in case it doesn't calldriver_bound().Quoted 21 lines
+pinctrl_bind_failed:
devres_release_all(dev);
driver_sysfs_remove(dev);
dev->driver= NULL;drivers/base/dd.c +0
-0@@ -701,7 +706,6 @@ static void __device_release_driver(struct device *dev)blocking_notifier_call_chain(&dev->bus->p-
Quoted 1 line
bus_notifier,BUS_NOTIFY_UN
BOUND_DRIVER,
dev); -
}
}include/linux/device.h +0
-0@@ -191,6 +191,7 @@ extern int bus_unregister_notifier(struct bus_type *bus,Quoted 7 lines
unbound */
#defineBUS_NOTIFY_UNBOUND_DRIVER0x00000007/* driver is
unbound
from the device */
+#defineBUS_NOTIFY_BIND_DRIVER_ERROR0x80000004/* driver
fails to be bound */I'd call it
BUS_NOTIFY_DRIVER_NOT_BOUND.Quoted 4 lines
extern struct kset *bus_get_kset(structbus_type*bus); extern struct klist *bus_get_device_klist(structbus_type*bus);Thanks,
Rafael
Signature · 7 lines
Andy Shevchenko <[email protected]> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Andy Shevchenko
reviewerPATCH v2 2/7 ACPI / LPSS: allow to use specific PM domain during ->probe()
In reply to Andy ShevchenkoThis is an amendment to previously pushed commit 01ac170ba29a (ACPI / LPSS:
allow to use specific PM domain during ->probe()). We can't assign anything to the platform device on ADD_DEVICE stage since it might be changed during unbound / bind cycle.
--- drivers/acpi/acpi_lpss.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/acpi/acpi_lpss.c +7 -2
@@ -705,8 +705,14 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, }switch (action) { -case BUS_NOTIFY_ADD_DEVICE : +case BUS_NOTIFY_BIND_DRIVER : pdev->dev.pm_domain = &acpi_lpss_pm_domain; +break ; +case BUS_NOTIFY_BIND_DRIVER_ERROR : +case BUS_NOTIFY_UNBOUND_DRIVER : + pdev->dev.pm_domain =NULL ; +break ; +case BUS_NOTIFY_ADD_DEVICE :if (pdata->dev_desc->flags &LPSS_LTR )return sysfs_create_group (&pdev->dev.kobj, &lpss_attr_group);
@@ -714,7 +720,6 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb,case BUS_NOTIFY_DEL_DEVICE :if (pdata->dev_desc->flags &LPSS_LTR )sysfs_remove_group (&pdev->dev.kobj, &lpss_attr_group); - pdev->dev.pm_domain =NULL ;break ;default :break ;
Signature · 1 line
2.6.2
Re: [PATCH v2 2/7] ACPI / LPSS: allow to use specific PM domain during ->probe()
Quoted 17 lines · Andy Shevchenko
This is an amendment to previously pushed commit
01ac170ba29a(ACPI / LPSS:
allow to use specific PM domain during ->probe()). We can't assign anything to the platform device onADD_DEVICEstage since it might be changed during unbound / bind cycle.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/acpi/acpi_lpss.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/acpi/acpi_lpss.c +0
-0@@ -705,8 +705,14 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, }
drivers/acpi/acpi_lpss.c static int acpi_lpss_platform_notify(struct notifier_block *nb, · line 715
Quoted 10 lines
drivers/acpi/acpi_lpss.c +7
-1switch (action) { -case BUS_NOTIFY_ADD_DEVICE : +case BUS_NOTIFY_BIND_DRIVER : pdev->dev.pm_domain = &acpi_lpss_pm_domain; +break ; +case BUS_NOTIFY_BIND_DRIVER_ERROR : +case BUS_NOTIFY_UNBOUND_DRIVER : + pdev->dev.pm_domain =NULL ; +break ; +case BUS_NOTIFY_ADD_DEVICE :
This won't fix like revert of original commit does. Primary problem here is that there is no explicit power on at all during LPSS device probe because dev->pm_domain is set before probing.
driver_probe_device
platform_drv_prove
dev_pm_domain_attach
acpi_dev_pm_attach
returns instantly because of dev->pm_domain is setProblem got unnoticed because devices are on during boot but rmmod/modprobe cycle will hit it.
With this patch situation remains the same but works if you assign the domain after probing when BUS_NOTIFY_BOUND_DRIVER notification comes (s/BUS_NOTIFY_BIND_DRIVER/BUS_NOTIFY_BOUND_DRIVER/ above).
Signature · 1 line
Jarkko
Andy Shevchenko
reviewerRe: [PATCH v2 2/7] ACPI / LPSS: allow to use specific PM domain during ->probe()
Quoted 22 lines · Jarkko Nikula
Quoted 21 lines · Andy Shevchenko
This is an amendment to previously pushed commit
01ac170ba29a(ACPI / LPSS:
allow to use specific PM domain during ->probe()). We can't assign anything to
the platform device onADD_DEVICEstage since it might be changed during
unbound / bind cycle.Signed-off-by Andy Shevchenko <[email protected]>---
drivers/acpi/acpi_lpss.c| 9 +++++++--1 file changed, 7 insertions(+), 2 deletions(-)drivers/acpi/acpi_lpss.c +0
-0@@ -705,8 +705,14 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, }
Quoted 15 lines
drivers/acpi/acpi_lpss.c static int acpi_lpss_platform_notify(struct notifier_block *nb, · line 715
Quoted 10 lines
drivers/acpi/acpi_lpss.c +7
-1switch (action) { -case BUS_NOTIFY_ADD_DEVICE : +case BUS_NOTIFY_BIND_DRIVER : pdev->dev.pm_domain = &acpi_lpss_pm_domain; +break ; +case BUS_NOTIFY_BIND_DRIVER_ERROR : +case BUS_NOTIFY_UNBOUND_DRIVER : + pdev->dev.pm_domain =NULL ; +break ; +case BUS_NOTIFY_ADD_DEVICE :This won't fix like revert of original commit does. Primary problem here
is that there is no explicit power on at all during LPSS device probe becausedev->pm_domainis set before probing.
And we can't do this as in very original code of acpi_lpss.c since DMA has to be sure it's powered on while probing. We could guarantee this only in case when PM domain is assigned already and we do our quirk for it.
From my point of view we have to fix hang first since it's most painful case for users and their experience. Though I'm open to any better solution if you have any in mind.
Quoted 15 lines
driver_probe_device
platform_drv_prove
dev_pm_domain_attach
acpi_dev_pm_attach
returns instantly because ofdev->pm_domainis setProblem got unnoticed because devices are on during boot but rmmod/modprobe cycle will hit it.
With this patch situation remains the same but works if you assign the
domain after probing whenBUS_NOTIFY_BOUND_DRIVERnotification comes (s/BUS_NOTIFY_BIND_DRIVER/BUS_NOTIFY_BOUND_DRIVER/ above).
Signature · 7 lines
Andy Shevchenko <[email protected]> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/7] ACPI / LPSS: allow to use specific PM domain during ->probe()
Quoted 23 lines · Andy Shevchenko
Quoted 22 lines · Jarkko Nikula
Quoted 21 lines · Andy Shevchenko
This is an amendment to previously pushed commit
01ac170ba29a(ACPI / LPSS:
allow to use specific PM domain during ->probe()). We can't assign anything to
the platform device onADD_DEVICEstage since it might be changed during
unbound / bind cycle.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/acpi/acpi_lpss.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/acpi/acpi_lpss.c +0
-0@@ -705,8 +705,14 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, }
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
drivers/acpi/acpi_lpss.c +1
-1switch (action) { -case BUS_NOTIFY_ADD_DEVICE : +case BUS_NOTIFY_BIND_DRIVER : pdev->dev.pm_domain = &acpi_lpss_pm_domain;Quoted 8 lines
drivers/acpi/acpi_lpss.c static int acpi_lpss_platform_notify(struct notifier_block *nb, · line 715
Quoted 6 lines
drivers/acpi/acpi_lpss.c +6
-0+break ; +case BUS_NOTIFY_BIND_DRIVER_ERROR : +case BUS_NOTIFY_UNBOUND_DRIVER : + pdev->dev.pm_domain =NULL ; +break ; +case BUS_NOTIFY_ADD_DEVICE :This won't fix like revert of original commit does.
Which commit exactly are you talking about, for reference?
Quoted 4 lines
Quoted 3 lines
Primary problem here
is that there is no explicit power on at all during LPSS device probe becausedev->pm_domainis set before probing.
Quoted 15 lines
And we can't do this as in very original code of
acpi_lpss.csince DMA has to be sure it's powered on while probing. We could guarantee this only in case when PM domain is assigned already and we do our quirk for it.From my point of view we have to fix hang first since it's most painful case for users and their experience. Though I'm open to any better solution if you have any in mind.
Quoted 6 lines
driver_probe_device
platform_drv_provedev_pm_domain_attach acpi_dev_pm_attach returns instantly because of dev->pm_domain is set
This looks like a candidate for the new PM domain callbacks, ->activate and ->dismiss.
->activate() is called before the probe, so it may power up things.
->dismiss() in turn is called in the failed probe case, so it can do the cleanup.
Have you considered using these?
Thanks,
Rafael
Andy Shevchenko
reviewerRe: [PATCH v2 2/7] ACPI / LPSS: allow to use specific PM domain during ->probe()
Quoted 43 lines · Rafael J. Wysocki
Quoted 29 lines · Andy Shevchenko
Quoted 28 lines · Jarkko Nikula
Quoted 27 lines · Andy Shevchenko
This is an amendment to previously pushed commit
01ac170ba29a(ACPI
/ LPSS:
allow to use specific PM domain during ->probe()). We can't assign
anything to
the platform device onADD_DEVICEstage since it might be changed
during
unbound / bind cycle.Signed-off-by Andy Shevchenko <[email protected]om>
---
drivers/acpi/acpi_lpss.c| 9 +++++++--1 file changed, 7 insertions(+), 2 deletions(-)drivers/acpi/acpi_lpss.c +0
-0@@ -705,8 +705,14 @@ static intacpi_lpss_platform_notify(struct
notifier_block*nb,
}Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
switch (action) {
drivers/acpi/acpi_lpss.c +1
-1-case BUS_NOTIFY_ADD_DEVICE : +case BUS_NOTIFY_BIND_DRIVER :
pdev->dev.pm_domain=&acpi_lpss_pm_domain;Quoted 8 lines
drivers/acpi/acpi_lpss.c static int acpi_lpss_platform_notify(struct notifier_block *nb, · line 715
Quoted 6 lines
drivers/acpi/acpi_lpss.c +6
-0+break ; +case BUS_NOTIFY_BIND_DRIVER_ERROR : +case BUS_NOTIFY_UNBOUND_DRIVER : + pdev->dev.pm_domain =NULL ; +break ; +case BUS_NOTIFY_ADD_DEVICE :This won't fix like revert of original commit does.
Quoted 1 line
Which commit exactly are you talking about, for reference?
commit 01ac170ba29a9903ee590e1ef2d8e6b27b49a16c
Author: Andy Shevchenko <[email protected]> Date: Wed Nov 5 18:34:46 2014 +0200
ACPI / LPSS: allow to use specific PM domain during ->probe()
Quoted 29 lines
Quoted 13 lines
Quoted 4 lines
Primary problem here
is that there is no explicit power on at all during LPSS device probe
becausedev->pm_domainis set before probing.And we can't do this as in very original code of
acpi_lpss.csince DMA
has to be sure it's powered on while probing. We could guarantee this
only in case when PM domain is assigned already and we do our quirk for
it.Quoted 11 lines
From my point of view we have to fix hang first since it's most painful
case for users and their experience. Though I'm open to any better solution if you have any in mind.Quoted 6 lines
driver_probe_device
platform_drv_prove
dev_pm_domain_attach
acpi_dev_pm_attach
returns instantly because ofdev->pm_domainis setThis looks like a candidate for the new PM domain callbacks, ->activate and
->dismiss.
Quoted 7 lines
->activate() is called before the probe, so it may power up things.
->dismiss() in turn is called in the failed probe case, so it can do the
cleanup.Have you considered using these?
Thanks for the hint. We will check this.
Signature · 7 lines
Andy Shevchenko <[email protected]> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/7] ACPI / LPSS: allow to use specific PM domain during ->probe()
Quoted 6 lines · Andy Shevchenko
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Jarkko Nikula
On 11/26/2015 05:19 PM, Andy Shevchenko wrote:
This won't fix like revert of original commit does.
Jarkko, I will split this one to the revert (with Fixes tag) and new patch to target DMA issue.
Quoted 34 lines
Quoted 34 lines
Quoted 15 lines
Quoted 4 lines
Primary problem here
is that there is no explicit power on at all during LPSS device probe
becausedev->pm_domainis set before probing.And we can't do this as in very original code of
acpi_lpss.csince
DMA
has to be sure it's powered on while probing. We could guarantee this
only in case when PM domain is assigned already and we do our quirk
for
it.Quoted 12 lines
From my point of view we have to fix hang first since it's most painful
case for users and their experience. Though I'm open to any better
solution if you have any in mind.Quoted 6 lines
driver_probe_device
platform_drv_prove
dev_pm_domain_attach
acpi_dev_pm_attach
returns instantly because ofdev->pm_domainis setThis looks like a candidate for the new PM domain callbacks, ->activate and
->dismiss.->activate() is called before the probe, so it may power up things.
Quoted 8 lines
Quoted 6 lines
->dismiss() in turn is called in the failed probe case, so it can do
the
cleanup.Have you considered using these?
Thanks for the hint. We will check this.
I briefly checked this for DMA issue. It will not help anyhow, so we *have to* move a power domain assignment to the BIND stage.
For I2C and rest LPSS devices this might help (though didn't look deeply). My understanding that we assign those callbacks in the LPSS custom PM domain and call them explicitly in acpi_lpss.c.
The code will be the same as we are using now to bring device from runtime suspend resume. This means whenever we call probe for e.g. I2C we end up in a sequence similar to:
pm_runtime_resume(I2C);
->probe(I2C);
pm_runtime_suspend(I2C);
I will try to mock up this and check if it will work, though have no idea what to do if I2C during probe calls pm_runtime_forbid().
Jarkko, what do you think?
Signature · 12 lines
Andy Shevchenko <[email protected]> Intel Finland Oy --------------------------------------------------------------------- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Re: [PATCH v2 2/7] ACPI / LPSS: allow to use specific PM domain during ->probe()
Quoted 14 lines · Andriy
I briefly checked this for DMA issue. It will not help anyhow, so we *have to* move a power domain assignment to the BIND stage.
For I2C and rest LPSS devices this might help (though didn't look deeply). My understanding that we assign those callbacks in the LPSS custom PM domain and call them explicitly in
acpi_lpss.c.The code will be the same as we are using now to bring device from runtime suspend resume. This means whenever we call probe for e.g. I2C we end up in a sequence similar to:
pm_runtime_resume(I2C);
->probe(I2C);
pm_runtime_suspend(I2C);
Quoted 5 lines
I will try to mock up this and check if it will work, though have no idea what to do if I2C during probe calls
pm_runtime_forbid().Jarkko, what do you think?
I suppose device core will handle it. If the runtime PM is forbidden or not initialized at all the device shouldn't idle.
Signature · 1 line
Jarkko
Re: [PATCH v2 2/7] ACPI / LPSS: allow to use specific PM domain during ->probe()
In reply to Andy ShevchenkoQuoted 39 lines · Andy Shevchenko
Quoted 22 lines · Jarkko Nikula
Quoted 21 lines · Andy Shevchenko
This is an amendment to previously pushed commit
01ac170ba29a(ACPI / LPSS:
allow to use specific PM domain during ->probe()). We can't assign anything to
the platform device onADD_DEVICEstage since it might be changed during
unbound / bind cycle.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/acpi/acpi_lpss.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/acpi/acpi_lpss.c +0
-0@@ -705,8 +705,14 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, }Quoted 15 lines
drivers/acpi/acpi_lpss.c static int acpi_lpss_platform_notify(struct notifier_block *nb, · line 715
Quoted 10 lines
drivers/acpi/acpi_lpss.c +7
-1switch (action) { -case BUS_NOTIFY_ADD_DEVICE : +case BUS_NOTIFY_BIND_DRIVER : pdev->dev.pm_domain = &acpi_lpss_pm_domain; +break ; +case BUS_NOTIFY_BIND_DRIVER_ERROR : +case BUS_NOTIFY_UNBOUND_DRIVER : + pdev->dev.pm_domain =NULL ; +break ; +case BUS_NOTIFY_ADD_DEVICE :This won't fix like revert of original commit does. Primary problem here
is that there is no explicit power on at all during LPSS device probe becausedev->pm_domainis set before probing.
Quoted 5 lines
And we can't do this as in very original code of
acpi_lpss.csince DMA has to be sure it's powered on while probing. We could guarantee this only in case when PM domain is assigned already and we do our quirk for it.
I'm not sure do I follow here. Is the power on chain different for LPSS DMA because setting the domain at BIND stage prevents the call to acpi_dev_pm_full_power() before driver probe? See below.
driver_probe_device
really_probe
driver_sysfs_add -> BUS_NOTIFY_BIND_DRIVER
-> platform_drv_prove
dev_pm_domain_attach
acpi_dev_pm_attach
if (dev->pm_domain) return -EEXIST;
...
if (power_on) { acpi_dev_pm_full_power(adev);... }
-> probe driver_bound -> BUS_NOTIFY_BOUND_DRIVER
Quoted 4 lines
From my point of view we have to fix hang first since it's most painful
case for users and their experience. Though I'm open to any better solution if you have any in mind.
Sure.
Signature · 1 line
Jarkko
Andy Shevchenko
reviewerRe: [PATCH v2 2/7] ACPI / LPSS: allow to use specific PM domain during ->probe()
Quoted 61 lines · Jarkko Nikula
Quoted 47 lines · Andy Shevchenko
Quoted 37 lines · Jarkko Nikula
Quoted 36 lines · Andy Shevchenko
This is an amendment to previously pushed commit
01ac170ba29a(ACPI
/ LPSS:
allow to use specific PM domain during ->probe()). We can't assign
anything to
the platform device onADD_DEVICEstage since it might be changed
during
unbound / bind cycle.Signed-off-by Andy Shevchenko <[email protected]om>
---
drivers/acpi/acpi_lpss.c | 9 +++++++--1 file changed, 7 insertions(+), 2 deletions(-)drivers/acpi/acpi_lpss.c +0
-0@@ -705,8 +705,14 @@ static intacpi_lpss_platform_notify(struct
notifier_block*nb,
}switch (action) {
drivers/acpi/acpi_lpss.c +1
-1-case BUS_NOTIFY_ADD_DEVICE : +case BUS_NOTIFY_BIND_DRIVER :
pdev->dev.pm_domain=&acpi_lpss_pm_domain;drivers/acpi/acpi_lpss.c +5
-0+break ; +case BUS_NOTIFY_BIND_DRIVER_ERROR : +case BUS_NOTIFY_UNBOUND_DRIVER : + pdev->dev.pm_domain =NULL ; +break ;Quoted 8 lines
drivers/acpi/acpi_lpss.c static int acpi_lpss_platform_notify(struct notifier_block *nb, · line 715
Quoted 1 line
drivers/acpi/acpi_lpss.c +1
-0+case BUS_NOTIFY_ADD_DEVICE :This won't fix like revert of original commit does. Primary problem
here
is that there is no explicit power on at all during LPSS device probe
becausedev->pm_domainis set before probing.Quoted 8 lines
And we can't do this as in very original code of
acpi_lpss.csince DMA
has to be sure it's powered on while probing. We could guarantee this
only in case when PM domain is assigned already and we do our quirk for
it.I'm not sure do I follow here. Is the power on chain different for LPSS
DMA because setting the domain at BIND stage prevents the call toacpi_dev_pm_full_power()before driver probe? See below.
Quoted 9 lines
driver_probe_device
really_probe
driver_sysfs_add ->BUS_NOTIFY_BIND_DRIVER
->platform_drv_prove
dev_pm_domain_attach
acpi_dev_pm_attach
if (dev->pm_domain) return-EEXIST;
...
if (power_on) {acpi_dev_pm_full_power(adev);... }
And how exactly does it enable a power on DMA controller that doesn't have _PS0 / _PS3 / _PSC methods?
Maybe I missed something obvious.
Quoted 2 lines
-> probe
driver_bound ->BUS_NOTIFY_BOUND_DRIVER
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Andy Shevchenko
reviewerPATCH v2 3/7 ACPI / LPSS: do delay for all LPSS devices when D3->D0
In reply to Andy ShevchenkoThe LPSS DMA device has no context to save, though it requires the same delay like the rest of LPSS devices when power state is changed from D3 to D0.
Do delay for the DMA device as well.
--- drivers/acpi/acpi_lpss.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/acpi/acpi_lpss.c +15 -8
@@ -574,6 +574,17 @@ static void acpi_lpss_restore_ctx(struct device *dev, {unsigned int i; +for (i =0 ; i <LPSS_PRV_REG_COUNT ; i++) { +unsigned long offset = i *sizeof (u32); + +__lpss_reg_write (pdata->prv_reg_ctx[i], pdata, offset); +dev_dbg (dev,"restoring 0x%08x to LPSS reg at offset 0x%02lx\n" , + pdata->prv_reg_ctx[i], offset); + } +} + +static void acpi_lpss_d3_to_d0_delay (struct lpss_private_data *pdata) +{/* * The following delay is needed or the subsequent write operations may * fail. The LPSS devices are actually PCI devices and the PCI spec
@@ -586,14 +597,6 @@ static void acpi_lpss_restore_ctx(struct device *dev, delay =0 ;msleep (delay); - -for (i =0 ; i <LPSS_PRV_REG_COUNT ; i++) { -unsigned long offset = i *sizeof (u32); - -__lpss_reg_write (pdata->prv_reg_ctx[i], pdata, offset); -dev_dbg (dev,"restoring 0x%08x to LPSS reg at offset 0x%02lx\n" , - pdata->prv_reg_ctx[i], offset); - } }#ifdef CONFIG_PM_SLEEP
@@ -621,6 +624,8 @@ static int acpi_lpss_resume_early(struct device *dev)if (ret)return ret; +acpi_lpss_d3_to_d0_delay (pdata); +if (pdata->dev_desc->flags &LPSS_SAVE_CTX )acpi_lpss_restore_ctx (dev, pdata);
@@ -652,6 +657,8 @@ static int acpi_lpss_runtime_resume(struct device *dev)if (ret)return ret; +acpi_lpss_d3_to_d0_delay (pdata); +if (pdata->dev_desc->flags &LPSS_SAVE_CTX )acpi_lpss_restore_ctx (dev, pdata);
Signature · 1 line
2.6.2
Andy Shevchenko
reviewerPATCH v2 4/7 ACPI / LPSS: override power state for LPSS DMA device
In reply to Andy ShevchenkoThis is a third approach to workaround long standing issue with LPSS on BayTrail. First one [1] was reverted since it didn't resolve the issue comprehensively. Second one [2] was rejected by internal review.
The LPSS DMA controller does not have neither _PS0 nor _PS3 method. Moreover it can be powered off automatically whenever the last LPSS device goes down. In case of no power any access to the DMA controller will hang the system. The behaviour is reproduced on some HP laptops based on Intel BayTrail [3,4] as well as on ASuS T100TA transformer.
Power on the LPSS island through the registers accessible in a specific way.
[1] http://www.spinics.net/lists/linux-acpi/msg53963.html
[2] https://bugzilla.redhat.com/attachment.cgi?id=1066779&action=diff
[3] https://bugzilla.redhat.com/show_bug.cgi?id=1184273
[4] http://www.spinics.net/lists/dmaengine/msg01514.html
--- arch/x86/Kconfig | 3 +- arch/x86/include/asm/iosf_mbi.h | 2 + drivers/acpi/acpi_lpss.c | 152 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 149 insertions(+), 8 deletions(-)
arch/x86/Kconfig +2 -1
@@ -535,9 +535,10 @@ config X86_INTEL_QUARK config X86_INTEL_LPSS bool "Intel Low Power Subsystem Support" - depends on ACPI + depends on X86 && ACPI select COMMON_CLK select PINCTRL + select IOSF_MBI ---help--- Select to build support for Intel Low Power Subsystem such as found on Intel Lynxpoint PCH. Selecting this option enables
arch/x86/include/asm/iosf_mbi.h +2 -0
@@ -19,6 +19,8 @@/* IOSF SB read/write opcodes */ #define MBI_MMIO_READ 0x00#define MBI_MMIO_WRITE 0x01 +#define MBI_CFG_READ 0x04 +#define MBI_CFG_WRITE 0x05#define MBI_CR_READ 0x06#define MBI_CR_WRITE 0x07#define MBI_REG_READ 0x10
drivers/acpi/acpi_lpss.c +145 -7
205 lines not on this page · raw message
Signature · 1 line
2.6.2
Andy Shevchenko
reviewerPATCH v2 5/7 dmaengine: dw: platform: power on device on shutdown
In reply to Andy ShevchenkoWe have to call dw_dma_disable() to stop any ongoing transfer. On some platforms we can't do that since DMA device is powered off. Moreover we have no possibility at that point to check if the platform is affected or not. That's why we call pm_runtime_get_sync() / pm_runtime_put() unconditionally. On the other hand we can't use pm_runtime_suspended() because runtime PM framework is not fully used by the driver.
--- drivers/dma/dw/platform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/dma/dw/platform.c +12 -0
@@ -239,7 +239,19 @@ static void dw_shutdown(struct platform_device *pdev) {struct dw_dma_chip *chip =platform_get_drvdata (pdev); +/* +* We have to call dw_dma_disable() to stop any ongoing transfer. On +* some platforms we can't do that since DMA device is powered off. +* Moreover we have no possibility to check if the platform is affected +* or not. That's why we call pm_runtime_get_sync() / pm_runtime_put() +* unconditionally. On the other hand we can't use +* pm_runtime_suspended() because runtime PM framework is not fully +* used by the driver. +*/ +pm_runtime_get_sync (chip->dev);dw_dma_disable (chip); +pm_runtime_put_sync_suspend (chip->dev); +clk_disable_unprepare (chip->clk); }
Signature · 1 line
2.6.2
Re: [PATCH v2 5/7] dmaengine: dw: platform: power on device on shutdown
Quoted 1 line · Andy Shevchenko
We have to call
dw_dma_disable()to stop any ongoing transfer.
Ok
Quoted 1 line
On some platforms we can't do that since DMA device is powered off.
Umm, you said we have ongoing transfer which means DMA should be on..!!
Quoted 5 lines
Moreover we have no
possibility at that point to check if the platform is affected or not. That's why we callpm_runtime_get_sync()/pm_runtime_put()unconditionally. On the other hand we can't usepm_runtime_suspended()because runtime PM framework is not fully used by the driver.
Shouldn't that be fixed?
Quoted 33 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/dma/dw/platform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/dma/dw/platform.c +12
-0@@ -239,7 +239,19 @@ static void dw_shutdown(struct platform_device *pdev) {struct dw_dma_chip *chip =platform_get_drvdata (pdev); +/* +* We have to call dw_dma_disable() to stop any ongoing transfer. On +* some platforms we can't do that since DMA device is powered off. +* Moreover we have no possibility to check if the platform is affected +* or not. That's why we call pm_runtime_get_sync() / pm_runtime_put() +* unconditionally. On the other hand we can't use +* pm_runtime_suspended() because runtime PM framework is not fully +* used by the driver. +*/ +pm_runtime_get_sync (chip->dev);dw_dma_disable (chip); +pm_runtime_put_sync_suspend (chip->dev); +clk_disable_unprepare (chip->clk); }Signature · 1 line
2.6.2
Signature · 1 line
~Vinod
Andy Shevchenko
reviewerRe: [PATCH v2 5/7] dmaengine: dw: platform: power on device on shutdown
Quoted 9 lines · Vinod Koul
Quoted 1 line · Andy Shevchenko
We have to call
dw_dma_disable()to stop any ongoing transfer.Ok
Quoted 1 line
On some platforms we can't do that since DMA device is powered off.
Umm, you said we have ongoing transfer which means DMA should be on..!!
Yes, that's true for HSW/BDW and non-affected BYT/CHT.
Like I mentioned here is no possibility to know which platform we run on.
Would you like to test this on a real device? We can provide you a login.
Quoted 11 lines
Quoted 9 lines
Moreover we have no
possibility at that point to check if the platform is affected or not. That's
why we callpm_runtime_get_sync()/pm_runtime_put()unconditionally. On the
other hand we can't usepm_runtime_suspended()because runtime PM framework is
not fully used by the driver.Shouldn't that be fixed?
Do you have any solution how?
Rough approach is to turn on it on channel allocation and turn off on freeing resources. The obvious downside of this solution is power consumption of idling device.
In any case it might be done in the future and it's not a scope of this series.
Quoted 41 lines
Quoted 40 lines
Signed-off-by Andy Shevchenko <[email protected]>---
drivers/dma/dw/platform.c | 12 ++++++++++++1 file changed, 12 insertions(+)drivers/dma/dw/platform.c +0
-0@@ -239,7 +239,19 @@ static void dw_shutdown(struct platform_device *pdev) { struct dw_dma_chip *chip = platform_get_drvdata(pdev);drivers/dma/dw/platform.c +2
-0+/* +* We have to call dw_dma_disable() to stop any ongoing transfer. On
drivers/dma/dw/platform.c +1
-0+ * some platforms we can't do that since DMA device ispowered off.
drivers/dma/dw/platform.c +1
-0+ * Moreover we have no possibility to check if theplatform is affected
drivers/dma/dw/platform.c +1
-0+ * or not. That's why we call pm_runtime_get_sync() /
pm_runtime_put()drivers/dma/dw/platform.c +2
-0+ * unconditionally. On the other hand we can't use + * pm_runtime_suspended() because runtime PM framework isnot fully
drivers/dma/dw/platform.c +3
-0+* used by the driver. +*/ +pm_runtime_get_sync (chip->dev);
dw_dma_disable(chip);drivers/dma/dw/platform.c +2
-0+pm_runtime_put_sync_suspend (chip->dev); +
clk_disable_unprepare(chip->clk);
}Signature · 1 line
2.6.2
Signature · 7 lines
Andy Shevchenko <[email protected]> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 5/7] dmaengine: dw: platform: power on device on shutdown
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Vinod Koul
Quoted 1 line · Andy Shevchenko
We have to call
dw_dma_disable()to stop any ongoing transfer.
Quoted 8 lines
Quoted 6 lines
Ok
Quoted 1 line
On some platforms we can't do that since DMA device is powered off.
Umm, you said we have ongoing transfer which means DMA should be on..!!
Yes, that's true for HSW/BDW and non-affected BYT/CHT.
Can you please explain even when DMA is in use how can device be powered off? That does not sound right to me. Is this on GP DMA on BYT/CHT or something else?
Quoted 17 lines
Like I mentioned here is no possibility to know which platform we run on.
Would you like to test this on a real device? We can provide you a login.
Quoted 10 lines
Quoted 9 lines
Moreover we have no
possibility at that point to check if the platform is affected or not. That's
why we callpm_runtime_get_sync()/pm_runtime_put()unconditionally. On the
other hand we can't usepm_runtime_suspended()because runtime PM framework is
not fully used by the driver.
Quoted 7 lines
Quoted 1 line
Shouldn't that be fixed?
Do you have any solution how?
Rough approach is to turn on it on channel allocation and turn off on freeing resources. The obvious downside of this solution is power consumption of idling device.
But in that case, the clients should not hold ref of dma chan when idle and allocate only when required which is a resonable expectation
Quoted 3 lines
In any case it might be done in the future and it's not a scope of this series.
Sounds fine to me
Quoted 47 lines
Quoted 42 lines
Quoted 41 lines
Signed-off-by Andy Shevchenko <[email protected]>---
drivers/dma/dw/platform.c | 12 ++++++++++++1 file changed, 12 insertions(+)drivers/dma/dw/platform.c +0
-0@@ -239,7 +239,19 @@ static void dw_shutdown(struct platform_device *pdev) { struct dw_dma_chip *chip = platform_get_drvdata(pdev);drivers/dma/dw/platform.c +2
-0+/* +* We have to call dw_dma_disable() to stop any ongoing transfer. On
drivers/dma/dw/platform.c +1
-0+ * some platforms we can't do that since DMA device ispowered off.
drivers/dma/dw/platform.c +1
-0+ * Moreover we have no possibility to check if theplatform is affected
drivers/dma/dw/platform.c +1
-0+ * or not. That's why we call pm_runtime_get_sync() /
pm_runtime_put()drivers/dma/dw/platform.c +2
-0+ * unconditionally. On the other hand we can't use + * pm_runtime_suspended() because runtime PM framework isnot fully
drivers/dma/dw/platform.c +3
-0+* used by the driver. +*/ +pm_runtime_get_sync (chip->dev);
dw_dma_disable(chip);drivers/dma/dw/platform.c +2
-0+pm_runtime_put_sync_suspend (chip->dev); +
clk_disable_unprepare(chip->clk);
}Signature · 1 line
2.6.2Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Signature · 5 lines
~Vinod -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Andy Shevchenko
reviewerRe: [PATCH v2 5/7] dmaengine: dw: platform: power on device on shutdown
Quoted 10 lines · Vinod Koul
Quoted 9 lines · Andy Shevchenko
Quoted 8 lines · Vinod Koul
Quoted 1 line · Andy Shevchenko
We have to call
dw_dma_disable()to stop any ongoing transfer.Ok
Quoted 2 lines
On some platforms we can't do that since DMA device is powered off.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Umm, you said we have ongoing transfer which means DMA should be on..!!
Yes, that's true for HSW/BDW and non-affected BYT/CHT.
Can you please explain even when DMA is in use how can device be powered
off? That does not sound right to me.
It can't, but the problem is we can't distinguish that in this routine! We simple do *not* know the actual power state of DMA.
These calls *ensures* that DMA is powered on. Yes, the call to dw_dma_off() when it used to be powered off sounds silly, I agree, though I see no upstreamable (non-hackish) solution for that.
Previously I proposed to remove .shutdown hook completely, you were objecting.
Quoted 2 lines
Is this on GP DMA on BYT/CHT or
something else?
Correct. Affected platforms are BYT-T and some or all of BSW/CHT depending on firmware in use.
Quoted 24 lines
Quoted 23 lines
Like I mentioned here is no possibility to know which platform we run
on.Would you like to test this on a real device? We can provide you a login.
Quoted 12 lines
Quoted 11 lines
Moreover we have no
possibility at that point to check if the platform is affected or
not. That's
why we callpm_runtime_get_sync()/pm_runtime_put()unconditionally. On the
other hand we can't usepm_runtime_suspended()because runtime PM
framework is
not fully used by the driver.Quoted 1 line
Shouldn't that be fixed?
Do you have any solution how?
Quoted 8 lines
Quoted 4 lines
Rough approach is to turn on it on channel allocation and turn off on
freeing resources. The obvious downside of this solution is power consumption of idling device.But in that case, the clients should not hold ref of dma chan when idle and
allocate only when required which is a resonable expectation
There is not the case for few drivers. At least for us it's spi-pxa2xx one. It requires channels on its ->probe() stage. Jarkko is Cc'ed here, you may ask him as he is our maintainer for the SPI.
Signature · 7 lines
Andy Shevchenko <[email protected]> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 5/7] dmaengine: dw: platform: power on device on shutdown
Quoted 28 lines · Andy Shevchenko
Quoted 17 lines · Vinod Koul
Quoted 16 lines · Andy Shevchenko
Quoted 14 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
We have to call
dw_dma_disable()to stop any ongoing transfer.Ok
Quoted 3 lines
On some platforms we can't do that since DMA device is powered
off.Umm, you said we have ongoing transfer which means DMA should be
on..!!Quoted 5 lines
Quoted 1 line
Yes, that's true for HSW/BDW and non-affected BYT/CHT.
Can you please explain even when DMA is in use how can device be powered
off? That does not sound right to me.It can't, but the problem is we can't distinguish that in this routine!
We simple do *not* know the actual power state of DMA.
Quoted 6 lines
These calls *ensures* that DMA is powered on. Yes, the call to
dw_dma_off()when it used to be powered off sounds silly, I agree, though I see no upstreamable (non-hackish) solution for that.Previously I proposed to remove .shutdown hook completely, you were objecting.
And second approach with PMC involved was also rejected by you since it was too hackish, which I completely agree with.
Quoted 50 lines
Quoted 3 lines
Is this on GP DMA on BYT/CHT or
something else?Correct. Affected platforms are BYT-T and some or all of BSW/CHT depending on firmware in use.
Quoted 33 lines
Quoted 24 lines
Like I mentioned here is no possibility to know which platform we run
on.Would you like to test this on a real device? We can provide you a
login.Quoted 14 lines
Quoted 13 lines
Moreover we have no
possibility at that point to check if the platform is affected
or
not. That's
why we callpm_runtime_get_sync()/pm_runtime_put()unconditionally. On the
other hand we can't usepm_runtime_suspended()because runtime
PM
framework is
not fully used by the driver.Quoted 1 line
Shouldn't that be fixed?
Quoted 7 lines
Do you have any solution how?
Rough approach is to turn on it on channel allocation and turn off
on
freeing resources. The obvious downside of this solution is power consumption of idling device.Quoted 3 lines
But in that case, the clients should not hold ref of dma chan when idle and
allocate only when required which is a resonable expectationThere is not the case for few drivers. At least for us it's spi- pxa2xx
one. It requires channels on its ->probe() stage. Jarkko is Cc'ed here,
you may ask him as he is our maintainer for the SPI.
Signature · 12 lines
Andy Shevchenko <[email protected]> Intel Finland Oy --------------------------------------------------------------------- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Andy Shevchenko
reviewerPATCH v2 6/7 dmaengine: dw: return immediately from IRQ when DMA isn't in use
In reply to Andy ShevchenkoThere is no need to bother the hardware when all channels are idle. We have not to get any interrupts.
--- drivers/dma/dw/core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/dma/dw/core.c +7 -2
@@ -622,12 +622,17 @@ static void dw_dma_tasklet(unsigned long data)static irqreturn_t dw_dma_interrupt (int irq,void *dev_id) {struct dw_dma *dw = dev_id; -u32 status =dma_readl (dw,STATUS_INT ); +u32 status; +/* Check if we have any interrupt from the DMAC which is not in use */ +if (!dw->in_use) +return IRQ_NONE ; + + status =dma_readl (dw,STATUS_INT );dev_vdbg (dw->dma.dev,"%s: status=0x%x\n" , __func__, status);/* Check if we have any interrupt from the DMAC */ -if (!status || !dw->in_use) +if (!status)return IRQ_NONE ;/*
Signature · 1 line
2.6.2
Andy Shevchenko
reviewerPATCH v2 7/7 Revert "dmaengine: dw: platform: provide platform data for Intel"
In reply to Andy ShevchenkoSince we have a work around to prevent a system hangup we don't need to provide a platform data explicitly anymore.
This reverts commit 175267b389f781748e2bbb6c737e76b5c9bc4c88.
--- drivers/dma/dw/platform.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/dma/dw/platform.c +1 -16
@@ -155,7 +155,6 @@ static int dw_probe(struct platform_device *pdev)struct dw_dma_chip *chip;struct device *dev = &pdev->dev;struct resource *mem; -const struct acpi_device_id *id;struct dw_dma_platform_data *pdata;int err;
@@ -179,11 +178,6 @@ static int dw_probe(struct platform_device *pdev) pdata =dev_get_platdata (dev);if (!pdata) pdata =dw_dma_parse_dt (pdev); -if (!pdata &&has_acpi_companion (dev)) { - id =acpi_match_device (dev->driver->acpi_match_table, dev); -if (id) - pdata = (struct dw_dma_platform_data *)id->driver_data; - } chip->dev = dev;
@@ -264,17 +258,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_of_id_table);#endif #ifdef CONFIG_ACPI -static struct dw_dma_platform_data dw_dma_acpi_pdata = { - .nr_channels =8 , - .is_private = true, - .chan_allocation_order =CHAN_ALLOCATION_ASCENDING , - .chan_priority =CHAN_PRIORITY_ASCENDING , - .block_size =4095 , - .nr_masters =2 , -}; -static const struct acpi_device_id dw_dma_acpi_id_table[] = { - {"INTL9C60" , (kernel_ulong_t)&dw_dma_acpi_pdata }, + {"INTL9C60" ,0 }, { } };MODULE_DEVICE_TABLE (acpi, dw_dma_acpi_id_table);
Signature · 1 line
2.6.2