public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: swarren@wwwdotorg•org (Stephen Warren)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH V3 2/5] ARM: tegra20: cpuidle: add powered-down state for secondary CPU
Date: Thu, 20 Dec 2012 10:43:04 -0700	[thread overview]
Message-ID: <50D34E28.5000208@wwwdotorg.org> (raw)
In-Reply-To: <1355797861-12759-3-git-send-email-josephl@nvidia.com>

On 12/17/2012 07:30 PM, Joseph Lo wrote:
> The powered-down state of Tegra20 requires power gating both CPU cores.
> When the secondary CPU requests to enter powered-down state, it saves
> its own contexts and then enters WFI. The Tegra20 had a limition to
> power down both CPU cores. The secondary CPU must waits for CPU0 in
> powered-down state too. If the secondary CPU be woken up before CPU0
> entering powered-down state, then it needs to restore its CPU states
> and waits for next chance.
> 
> Be aware of that, you may see the legacy power state "LP2" in the code
> which is exactly the same meaning of "CPU power down".

> diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c

>  int __init tegra20_cpuidle_init(void)

> +	drv->state_count = sizeof(tegra_idle_states) /
> +			   sizeof(struct cpuidle_state);

Use ARRAY_SIZE() there?


> +	for (i = 0; i < drv->state_count; i++)
> +		memcpy(&drv->states[i], &tegra_idle_states[i],
> +		       sizeof(struct cpuidle_state));

Can't you call memcpy() once:

memcpy(drv->states, tegra_idle_states,
		drv->state_count * sizeof(drv->states[0]));

... although I personally much preferred when all this was just static
initialization directly in tegra_idle_driver, rather than all this messy
copying. Really, struct cpuidle_driver should point at the array, rather
than including it.

> diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c

> @@ -173,6 +173,8 @@ bool __cpuinit tegra_set_cpu_in_lp2(int phy_cpu_id)
>  
>  	if ((phy_cpu_id == 0) && cpumask_equal(cpu_lp2_mask, cpu_online_mask))
>  		last_cpu = true;
> +	else if (phy_cpu_id == 1)
> +		tegra20_cpu_set_resettable_soon();
>  
>  	spin_unlock(&tegra_lp2_lock);
>  	return last_cpu;

Shouldn't the code in that else branch have a run-time check for whether
it's running on Tegra20? When compiled without Tegra20 support,
tegra20_cpu_set_resettable_soon() is a dummy static inline, but when
both Tegra20 and Tegra30 are compiled in, isn't that code going to run
when it shouldn't; pm.c being a common file.

(Peter again, can you please review/ack this series. Thanks)

  parent reply	other threads:[~2012-12-20 17:43 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18  2:30 [PATCH V3 0/5] ARM: tegra20: cpuidle: add power-down state Joseph Lo
2012-12-18  2:30 ` [PATCH V3 1/5] ARM: tegra: add pending SGI checking API Joseph Lo
2012-12-18  2:42   ` Colin Cross
2012-12-18  2:57     ` Joseph Lo
2012-12-18 10:15     ` Peter De Schrijver
2012-12-18 19:36       ` Colin Cross
2012-12-19  1:06         ` Joseph Lo
2012-12-19  3:47           ` Joseph Lo
2012-12-20  7:16         ` Santosh Shilimkar
2012-12-20  9:34           ` Peter De Schrijver
2012-12-20  9:49             ` Santosh Shilimkar
2012-12-20  9:59               ` Peter De Schrijver
2012-12-20 10:24                 ` Santosh Shilimkar
2012-12-20 11:14                   ` Peter De Schrijver
2012-12-20 12:06                     ` Santosh Shilimkar
2012-12-18  2:30 ` [PATCH V3 2/5] ARM: tegra20: cpuidle: add powered-down state for secondary CPU Joseph Lo
2012-12-18  2:46   ` Colin Cross
2012-12-18  3:06     ` Joseph Lo
2012-12-20 17:43   ` Stephen Warren [this message]
2012-12-21  6:36     ` Joseph Lo
2012-12-21 21:04       ` Stephen Warren
2012-12-18  2:30 ` [PATCH V3 3/5] ARM: tegra20: clocks: add CPU low-power function into tegra_cpu_car_ops Joseph Lo
2012-12-20 17:46   ` Stephen Warren
2012-12-21  5:02     ` Joseph Lo
2012-12-21 21:10       ` Stephen Warren
2012-12-18  2:31 ` [PATCH V3 4/5] ARM: tegra20: flowctrl: add support for cpu_suspend_enter/exit Joseph Lo
2012-12-18  2:31 ` [PATCH V3 5/5] ARM: tegra20: cpuidle: apply coupled cpuidle for powered-down mode Joseph Lo
2012-12-18 10:18   ` Peter De Schrijver
2012-12-20 17:54   ` Stephen Warren
2012-12-21  7:10     ` Joseph Lo
2012-12-21 21:06       ` Stephen Warren
2013-01-02 19:05 ` [PATCH V3 0/5] ARM: tegra20: cpuidle: add power-down state Stephen Warren
2013-01-03  8:39   ` Joseph Lo

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=50D34E28.5000208@wwwdotorg.org \
    --to=swarren@wwwdotorg$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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