Devicetree
 help / color / mirror / Atom feed
From: Andreas Kemnade <andreas@kemnade.info>
To: sashiko-bot@kernel.org
Cc: sashiko-reviews@lists.linux.dev, imx@lists.linux.dev,
	devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	Frank.Li@kernel.org
Subject: Re: [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit
Date: Tue, 24 Nov 2026 11:28:34 +0100	[thread overview]
Message-ID: <20261124112834.775a1042@kemnade.info> (raw)
In-Reply-To: <sashiko-outbox-230024@kernel.org>

On Mon, 23 Nov 2026 20:49:04 +0000
sashiko-bot@kernel.org wrote:

> Thank you for your contribution! Sashiko AI review found 4 potential
> issues to consider:
> - [Medium] ARM: imx: i.MX6SLL-only STOP ON idle state registered on all
>   i.MX6SX/UL SoCs
> - [Medium] ARM: imx: imx6sll_check_pll_are_used() omits DCP DMA clock in
>   CCGR0 check
> - [Low] ARM: imx: duplicate BIT(21) term in CCGR5 mask in
>   imx6sll_check_pll_are_used()
> - [Low] ARM: imx: imx6sx_enter_pll_off() duplicates state 2 power-off
>   sequence
> --
[...]
> 
> [Severity: Low]
> This isn't a bug, but imx6sx_enter_pll_off() duplicates the state 2
> power-off sequence from imx6sx_enter_wait(), differing only in passing
> STOP_POWER_ON instead of WAIT_UNCLOCKED to imx6_set_lpm().  Calling
> imx6_set_int_mem_clk_lpm(true) on every entry is also redundant, since
> imx6sx_cpuidle_init() sets it at init and imx6q_pm_enter() restores it on
> resume from suspend.
> 
probably these things should be merged.

> > @@ -95,8 +125,18 @@ static struct cpuidle_driver imx6sx_cpuidle_driver = {
> >  			.name = "LOW-POWER-IDLE",
> >  			.desc = "ARM power off",
> >  		},
> > +		/* STOP ON */
> > +		{
> > +			.exit_latency = 500,
> > +			.target_residency = 800,
> > +			.flags = CPUIDLE_FLAG_TIMER_STOP |
> > +				 CPUIDLE_FLAG_RCU_IDLE,
> > +			.enter = imx6sx_enter_pll_off,
> > +			.name = "STOP ON",
> > +			.desc = "ARM power off + PLL off",
> > +		},
> >  	},
> > -	.state_count = 3,
> > +	.state_count = 4,
> >  	.safe_state_index = 0,
> >  };  
> 
> [Severity: Medium]
> Should state 3 only be exposed on i.MX6SLL, and should falling back to
> state 2 respect dev->states_usage[2].disable?
> 
> imx6sx_cpuidle_init() registers imx6sx_cpuidle_driver on i.MX6SX, i.MX6UL,
> i.MX6ULL and i.MX6ULZ as well as i.MX6SLL.  Unconditionally setting
> state_count = 4 advertises an enabled state 3 on those other SoCs that
> always demotes to state 2, causing cpuidle_enter_state() to record false
> state 2 "below" misses whenever actual idle time reaches 800 us and
> skewing governor residency bins.  In addition, calling
> imx6sx_enter_wait(dev, drv, 2) directly bypasses sysfs if state 2 has been
> disabled by userspace.
> 
The idle state is probably good for the other SoCs as well, but
they need individual checks, so until that is there, probably decrement
state_count if on non 6sll machines and of course usage.disable should be
respected.


> > diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
> > index 3c73e2cdb8ceb..65a5268d31614 100644
> > --- a/arch/arm/mach-imx/pm-imx6.c
> > +++ b/arch/arm/mach-imx/pm-imx6.c  
> [ ... ]
> > @@ -287,6 +295,21 @@ void imx6_enable_rbc(bool enable)
> >  	imx_gpc_restore_all();
> >  }
> >  
> > +bool imx6sll_check_pll_are_used(void)
> > +{
> > +	/* check for any clock active which provides more than register access */
> > +	return readl_relaxed(ccm_base + CCGR0) & BIT(29)  ||  
> 
> [Severity: Medium]
> Does the CCGR0 mask also need BIT(11) for IMX6SLL_CLK_DCP?
> 
> In drivers/clk/imx/clk-imx6sll.c, IMX6SLL_CLK_DCP ("dcp", parented to
> "ahb") is gated by CCGR0 bits 11:10.  When mxs_dcp_start_dma() starts a
> crypto DMA transfer and sleeps in wait_for_completion_timeout(), the
> single CPU on i.MX6SLL can enter cpuidle; without BIT(11) in the CCGR0
> check, entering STOP_POWER_ON stops AHB and PLL clocks mid-transfer and
> stalls DCP DMA until it times out.
> 
Seems that it is a good idea to also add CLK_DCP and teach the driver to
disable clocks when not used.

> > +		readl_relaxed(ccm_base + CCGR1) & (BIT(25) | BIT(23) | BIT(15) | BIT(13) |
> > +						   BIT(11) | BIT(7) | BIT(5) | BIT(3) | BIT(1)) ||
> > +		readl_relaxed(ccm_base + CCGR2) & (BIT(31) | BIT(29) | BIT(11) | BIT(9) |
> > +						   BIT(7) | BIT(3)) ||
> > +		readl_relaxed(ccm_base + CCGR3) & (BIT(11) | BIT(5) | BIT(3)) ||
> > +		readl_relaxed(ccm_base + CCGR4) & (BIT(23) | BIT(21) | BIT(19) | BIT(17)) ||
> > +		readl_relaxed(ccm_base + CCGR5) & (BIT(25) | BIT(23) | BIT(21) | BIT(21) |
> > +						   BIT(19) | BIT(15) | BIT(7)) ||  
> 
> [Severity: Low]
> BIT(21) is listed twice in the CCGR5 mask; is one of them redundant or
> meant to be another bit?
> 
That bit seems to be redundant, will clean up that.

Regards,
Andreas

  reply	other threads:[~2026-11-24 10:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 20:31 [PATCH RFC 0/3] ARM: imx: Add a more agressive idle mode on i.MX6SLL Andreas Kemnade
2026-11-23 20:31 ` [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit Andreas Kemnade
2026-11-23 20:49   ` sashiko-bot
2026-11-24 10:28     ` Andreas Kemnade [this message]
2026-11-23 20:31 ` [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source Andreas Kemnade
2026-11-23 20:45   ` sashiko-bot
2026-11-23 20:31 ` [PATCH 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer Andreas Kemnade
2026-11-23 20:59   ` sashiko-bot
2026-11-23 21:26     ` Andreas Kemnade

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=20261124112834.775a1042@kemnade.info \
    --to=andreas@kemnade.info \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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