Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andreas Kemnade" <andreas@kemnade.info>
Cc: imx@lists.linux.dev, devicetree@vger.kernel.org, robh@kernel.org,
	conor+dt@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v2 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit
Date: Thu, 26 Nov 2026 11:13:50 +0000	[thread overview]
Message-ID: <sashiko-outbox-235350@kernel.org> (raw)
In-Reply-To: <20261126-imx6-idlestop-v2-1-c6987e7a392f@kemnade.info>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ARM: imx: broken fallback to states 0 and 1 in
  imx6sx_enter_pll_off()
- [Low] ARM: imx: wrong clock names in imx6sll_check_pll_are_used()
  comments
--

commit 6724bea26c43aa799d88abd3c3139a314f0fea52
Author: Andreas Kemnade <andreas@kemnade.info>

ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit

This commit adds a STOP ON cpuidle state on i.MX6SLL that powers off the
ARM core and PLLs when no peripheral clocks requiring PLLs are active.

> diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c b/arch/arm/mach-imx/cpuidle-imx6sx.c
> index 83c5cbd3748e1..d2e8a98cc6ebb 100644
> --- a/arch/arm/mach-imx/cpuidle-imx6sx.c
> +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c
> @@ -65,6 +65,40 @@ static __cpuidle int imx6sx_enter_wait(struct cpuidle_device *dev,
>  	return index;
>  }
>  
> +static __cpuidle int imx6sx_enter_pll_off(struct cpuidle_device *dev,
> +				       struct cpuidle_driver *drv, int index)
> +{
> +	if (imx6sll_check_pll_are_used()) {
> +		for (index--; index >= 0; index--)
> +			if (!dev->states_usage[index].disable)
> +				return imx6sx_enter_wait(dev, drv, index);
> +
> +		return -EBUSY;
> +	}

[Severity: Medium]
Can this fallback call imx6sx_enter_wait() with index 1 or 0?

State 3 sets CPUIDLE_FLAG_RCU_IDLE, so cpuidle_enter_state() skips
ct_cpuidle_enter() and ct_cpuidle_exit() around target_state->enter().
If state 2 is disabled in sysfs and imx6sll_check_pll_are_used() returns
true, falling back to index 1 runs case 1 in imx6sx_enter_wait(), which
calls cpu_do_idle() without ct_cpuidle_enter() / ct_cpuidle_exit() and
leaves RCU non-idle while the CPU sleeps with its local timer stopped.

If states 2 and 1 are both disabled, falling back to index 0 hits
default: break in imx6sx_enter_wait() and returns 0 without calling
cpu_do_idle() at all, causing the idle loop to busy-spin while counting
entries into state 0.

Calling drv->states[index].enter(dev, drv, index) wrapped in
ct_cpuidle_enter() and ct_cpuidle_exit() when the fallback state does not
have CPUIDLE_FLAG_RCU_IDLE set would handle all shallower states.

> diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
> index 3c73e2cdb8ceb..2494ee4d20c3a 100644
> --- a/arch/arm/mach-imx/pm-imx6.c
> +++ b/arch/arm/mach-imx/pm-imx6.c
[ ... ]
> @@ -287,6 +295,29 @@ 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 */
> +
> +				/* uart2 | dcp */
> +	return readl_relaxed(ccm_base + CCGR0) & (BIT(29) | BIT(11)) ||
> +				/* uart | gpt_serial | epit | ecspi */
> +		readl_relaxed(ccm_base + CCGR1) & (BIT(25) | BIT(23) | BIT(15) | BIT(13) |
> +						   BIT(11) | BIT(7) | BIT(5) | BIT(3) | BIT(1)) ||
> +				/* pxp | lcd | i2c */
> +		readl_relaxed(ccm_base + CCGR2) & (BIT(31) | BIT(29) | BIT(11) | BIT(9) |
> +						   BIT(7) | BIT(3)) ||
> +				/* lcdif | epdc | pxp */
> +		readl_relaxed(ccm_base + CCGR3) & (BIT(11) | BIT(5) | BIT(3)) ||

[Severity: Low]
This isn't a bug, but in drivers/clk/imx/clk-imx6sll.c, BIT(3) of CCGR2
(0x70) gates csi (omitted from the CCGR2 comment) and BIT(3) of CCGR3
(0x74) gates uart5_ipg / uart5_serial rather than pxp.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-imx6-idlestop-v2-0-c6987e7a392f@kemnade.info?part=1

  reply	other threads:[~2026-11-26 11:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 11:00 [PATCH v2 0/3] ARM: imx: Add a more agressive idle mode on i.MX6SLL Andreas Kemnade
2026-11-26 11:00 ` [PATCH v2 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit Andreas Kemnade
2026-11-26 11:13   ` sashiko-bot [this message]
2026-11-26 12:46     ` Andreas Kemnade
2026-11-26 11:00 ` [PATCH v2 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source Andreas Kemnade
2026-11-26 11:14   ` sashiko-bot
2026-11-26 11:00 ` [PATCH v2 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer 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=sashiko-outbox-235350@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=andreas@kemnade.info \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@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