[PATCH 0/9] driver core / pmdomain: Add support for fined grained sync_state

Ulf Hansson posted 9 patches 1 month, 1 week ago
drivers/base/core.c                       |   7 +-
drivers/pmdomain/core.c                   | 208 ++++++++++++++++++----
drivers/pmdomain/renesas/rcar-gen4-sysc.c |   1 -
drivers/pmdomain/renesas/rcar-sysc.c      |   1 -
drivers/pmdomain/renesas/rmobile-sysc.c   |   3 +-
include/linux/device.h                    |  12 ++
include/linux/device/driver.h             |   7 +
include/linux/pm_domain.h                 |   3 +
8 files changed, 200 insertions(+), 42 deletions(-)
[PATCH 0/9] driver core / pmdomain: Add support for fined grained sync_state
Posted by Ulf Hansson 1 month, 1 week ago
Since the introduction [1] of the common sync_state support for pmdomains
(genpd), we have encountered a lot of various interesting problems. In most
cases the new behaviour of genpd triggered some weird platform specific bugs.

That said, in LPC in Tokyo me and Saravana hosted a session to walk through the
remaining limitations that we have found for genpd's sync state support. In
particular, we discussed the problems we have for the so-called onecell power
domain providers, where a single provider typically provides multiple
independent power domains, all with their own set of consumers.

In these cases, the generic sync_state mechanism with fw_devlink isn't fine
grained enough, as we end up waiting for all consumers for all power domains
before the ->sync_callback gets called for the supplier/provider. In other
words, we may end up keeping unused power domains powered-on, for no good
reasons.

The series intends to fix this problem. Please have a look at the commit
messages for more details.

Please help review and test!

Kind regards
Ulf Hansson

[1]
https://lore.kernel.org/all/20250701114733.636510-1-ulf.hansson@linaro.org/


Ulf Hansson (9):
  driver core: Enable suppliers to implement fine grained sync_state
    support
  driver core: Add dev_set_drv_queue_sync_state()
  pmdomain: core: Move genpd_get_from_provider()
  pmdomain: core: Add initial fine grained sync_state support
  pmdomain: core: Extend fine grained sync_state to more onecell
    providers
  pmdomain: core: Export a common function for ->queue_sync_state()
  pmdomain: renesas: rcar-gen4-sysc: Drop GENPD_FLAG_NO_STAY_ON
  pmdomain: renesas: rcar-sysc: Drop GENPD_FLAG_NO_STAY_ON
  pmdomain: renesas: rmobile-sysc: Drop GENPD_FLAG_NO_STAY_ON

 drivers/base/core.c                       |   7 +-
 drivers/pmdomain/core.c                   | 208 ++++++++++++++++++----
 drivers/pmdomain/renesas/rcar-gen4-sysc.c |   1 -
 drivers/pmdomain/renesas/rcar-sysc.c      |   1 -
 drivers/pmdomain/renesas/rmobile-sysc.c   |   3 +-
 include/linux/device.h                    |  12 ++
 include/linux/device/driver.h             |   7 +
 include/linux/pm_domain.h                 |   3 +
 8 files changed, 200 insertions(+), 42 deletions(-)

-- 
2.43.0
Re: [PATCH 0/9] driver core / pmdomain: Add support for fined grained sync_state
Posted by Ulf Hansson 2 weeks, 6 days ago
On Tue, 3 Mar 2026 at 14:23, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> Since the introduction [1] of the common sync_state support for pmdomains
> (genpd), we have encountered a lot of various interesting problems. In most
> cases the new behaviour of genpd triggered some weird platform specific bugs.
>
> That said, in LPC in Tokyo me and Saravana hosted a session to walk through the
> remaining limitations that we have found for genpd's sync state support. In
> particular, we discussed the problems we have for the so-called onecell power
> domain providers, where a single provider typically provides multiple
> independent power domains, all with their own set of consumers.
>
> In these cases, the generic sync_state mechanism with fw_devlink isn't fine
> grained enough, as we end up waiting for all consumers for all power domains
> before the ->sync_callback gets called for the supplier/provider. In other
> words, we may end up keeping unused power domains powered-on, for no good
> reasons.
>
> The series intends to fix this problem. Please have a look at the commit
> messages for more details.
>
> Please help review and test!

Saravana, Rafael, Greg - any concerns you see with this approach?

Especially I need your confirmation for patch 1 and patch2.

Kind regards
Uffe


>
> Kind regards
> Ulf Hansson
>
> [1]
> https://lore.kernel.org/all/20250701114733.636510-1-ulf.hansson@linaro.org/
>
>
> Ulf Hansson (9):
>   driver core: Enable suppliers to implement fine grained sync_state
>     support
>   driver core: Add dev_set_drv_queue_sync_state()
>   pmdomain: core: Move genpd_get_from_provider()
>   pmdomain: core: Add initial fine grained sync_state support
>   pmdomain: core: Extend fine grained sync_state to more onecell
>     providers
>   pmdomain: core: Export a common function for ->queue_sync_state()
>   pmdomain: renesas: rcar-gen4-sysc: Drop GENPD_FLAG_NO_STAY_ON
>   pmdomain: renesas: rcar-sysc: Drop GENPD_FLAG_NO_STAY_ON
>   pmdomain: renesas: rmobile-sysc: Drop GENPD_FLAG_NO_STAY_ON
>
>  drivers/base/core.c                       |   7 +-
>  drivers/pmdomain/core.c                   | 208 ++++++++++++++++++----
>  drivers/pmdomain/renesas/rcar-gen4-sysc.c |   1 -
>  drivers/pmdomain/renesas/rcar-sysc.c      |   1 -
>  drivers/pmdomain/renesas/rmobile-sysc.c   |   3 +-
>  include/linux/device.h                    |  12 ++
>  include/linux/device/driver.h             |   7 +
>  include/linux/pm_domain.h                 |   3 +
>  8 files changed, 200 insertions(+), 42 deletions(-)
>
> --
> 2.43.0
>
Re: [PATCH 0/9] driver core / pmdomain: Add support for fined grained sync_state
Posted by Saravana Kannan 2 weeks, 6 days ago
On Thu, Mar 19, 2026 at 9:59 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Tue, 3 Mar 2026 at 14:23, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >
> > Since the introduction [1] of the common sync_state support for pmdomains
> > (genpd), we have encountered a lot of various interesting problems. In most
> > cases the new behaviour of genpd triggered some weird platform specific bugs.
> >
> > That said, in LPC in Tokyo me and Saravana hosted a session to walk through the
> > remaining limitations that we have found for genpd's sync state support. In
> > particular, we discussed the problems we have for the so-called onecell power
> > domain providers, where a single provider typically provides multiple
> > independent power domains, all with their own set of consumers.
> >
> > In these cases, the generic sync_state mechanism with fw_devlink isn't fine
> > grained enough, as we end up waiting for all consumers for all power domains
> > before the ->sync_callback gets called for the supplier/provider. In other
> > words, we may end up keeping unused power domains powered-on, for no good
> > reasons.
> >
> > The series intends to fix this problem. Please have a look at the commit
> > messages for more details.
> >
> > Please help review and test!
>
> Saravana, Rafael, Greg - any concerns you see with this approach?

Not specifically related to this thread, but a general update so
people know I haven't vanished. I've been reading this and all the
other fw_devlink related patches (Doug's making flags set/clear/check
safe, overlay series, the PCIe patch series, etc) being sent since I
last replied. I somehow missed this one. I'll definitely take a look
at this series.

Email replies to LKML are a pain right now but it's
expected to get much easier in a week or two. I'm holding off on
responding to most emails until then.

Thanks,
Saravana

>
> Especially I need your confirmation for patch 1 and patch2.
>
> Kind regards
> Uffe
>
>
> >
> > Kind regards
> > Ulf Hansson
> >
> > [1]
> > https://lore.kernel.org/all/20250701114733.636510-1-ulf.hansson@linaro.org/
> >
> >
> > Ulf Hansson (9):
> >   driver core: Enable suppliers to implement fine grained sync_state
> >     support
> >   driver core: Add dev_set_drv_queue_sync_state()
> >   pmdomain: core: Move genpd_get_from_provider()
> >   pmdomain: core: Add initial fine grained sync_state support
> >   pmdomain: core: Extend fine grained sync_state to more onecell
> >     providers
> >   pmdomain: core: Export a common function for ->queue_sync_state()
> >   pmdomain: renesas: rcar-gen4-sysc: Drop GENPD_FLAG_NO_STAY_ON
> >   pmdomain: renesas: rcar-sysc: Drop GENPD_FLAG_NO_STAY_ON
> >   pmdomain: renesas: rmobile-sysc: Drop GENPD_FLAG_NO_STAY_ON
> >
> >  drivers/base/core.c                       |   7 +-
> >  drivers/pmdomain/core.c                   | 208 ++++++++++++++++++----
> >  drivers/pmdomain/renesas/rcar-gen4-sysc.c |   1 -
> >  drivers/pmdomain/renesas/rcar-sysc.c      |   1 -
> >  drivers/pmdomain/renesas/rmobile-sysc.c   |   3 +-
> >  include/linux/device.h                    |  12 ++
> >  include/linux/device/driver.h             |   7 +
> >  include/linux/pm_domain.h                 |   3 +
> >  8 files changed, 200 insertions(+), 42 deletions(-)
> >
> > --
> > 2.43.0
> >
Re: [PATCH 0/9] driver core / pmdomain: Add support for fined grained sync_state
Posted by Geert Uytterhoeven 2 weeks, 6 days ago
Hi Ulf,

On Tue, 3 Mar 2026 at 14:23, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> Since the introduction [1] of the common sync_state support for pmdomains
> (genpd), we have encountered a lot of various interesting problems. In most
> cases the new behaviour of genpd triggered some weird platform specific bugs.
>
> That said, in LPC in Tokyo me and Saravana hosted a session to walk through the
> remaining limitations that we have found for genpd's sync state support. In
> particular, we discussed the problems we have for the so-called onecell power
> domain providers, where a single provider typically provides multiple
> independent power domains, all with their own set of consumers.
>
> In these cases, the generic sync_state mechanism with fw_devlink isn't fine
> grained enough, as we end up waiting for all consumers for all power domains
> before the ->sync_callback gets called for the supplier/provider. In other
> words, we may end up keeping unused power domains powered-on, for no good
> reasons.
>
> The series intends to fix this problem. Please have a look at the commit
> messages for more details.

Thanks for your series!

I gave it a try on various R-Car and R/SH-Mobile platforms, and all
PM Domains are handled fine.
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds