Re: [PATCH v4 4/4] watchdog: rzg2l_wdt: Power on the watchdog domain in the restart handler
From: Andy Shevchenko
Date: Wed Oct 28 2026 - 09:55:07 EST
On Wed, Oct 28, 2026 at 02:45:15PM +0200, claudiu beznea wrote:
> On 10/27/26 16:54, Andy Shevchenko wrote:
> > On Tue, Oct 15, 2024 at 07:47:32PM +0300, Claudiu wrote:
...
> > > Commit e4cf89596c1f ("watchdog: rzg2l_wdt: Fix 'BUG: Invalid wait
> > > context'") dropped the pm_runtime_get_sync() and replaced it with
> > > clk_prepare_enable() to avoid invalid wait context due to genpd_lock()
> > > in genpd_runtime_resume() being called from atomic context. But
> > > clk_prepare_enable() doesn't fit for this either (as reported by
> > > Ulf Hansson) as clk_prepare() can also sleep (it just not throw invalid
> > > wait context warning as it is not written for this).
> >
> > > Because the watchdog device is marked now as IRQ safe (though this patch)
> >
> > ...which is complete hack and has to be avoided.
> >
> > Can it be solved differently?
>
> Can't tell ATM. This solution was suggested by Ulf.
With all respect to Ulf, this is a bad idea. We need to get rid of
pm_runtime_irq_safe() sooner and avoid adding new users of this hack.
> > (Note, OMAP, for example, got patches in the past
> > and become pm_runtime_irq_safe()-free.)
>
> I'll look through it.
Thank you!
> > > the irq_safe_dev_in_sleep_domain() call from genpd_runtime_resume() returns
> > > 1 for devices not registering an IRQ safe PM domain for watchdog (as the
> > > watchdog device is IRQ safe, PM domain is not and watchdog PM domain is
> > > always-on), this being the case for RZ/G3S with old device trees and
> > > the rest of the SoCs that use this driver, we can now drop also the
> > > clk_prepare_enable() calls in restart handler and rely on
> > > pm_runtime_resume_and_get().
> >
> > > Thus, drop clk_prepare_enable() and use pm_runtime_resume_and_get() in
> > > watchdog restart handler.
--
With Best Regards,
Andy Shevchenko