* [PATCH] ARM: tegra: don't timeout if CPU is powergated
@ 2014-02-11 0:44 Stefan Agner
[not found] ` <1d5ea6b7df4573d866779857922ac650fe59af60.1392078805.git.stefan-XLVq0VzYD2Y@public.gmane.org>
2014-02-12 19:20 ` Stephen Warren
0 siblings, 2 replies; 6+ messages in thread
From: Stefan Agner @ 2014-02-11 0:44 UTC (permalink / raw)
To: swarren, thierry.reding, josephl
Cc: dev, linux-tegra, linux-arm-kernel, linux-kernel, Stefan Agner
When booting secondary CPU(s) which are not yet powergated, a wrong
check lead to a timeout after 100 jiffies. With this patch, we only
delay powergating if CPUs are still not powered yet.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
I happend to come accross this while working on Colibri T30 support.
Obviously, the downstream U-Boot doesn't powergate all CPUs, so
the Linux kernel always timed out when booting CPU 1 through 3...
arch/arm/mach-tegra/platsmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index eb72ae7..929d104 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -114,7 +114,7 @@ static int tegra30_boot_secondary(unsigned int cpu, struct task_struct *idle)
/* Wait for the power to come up. */
timeout = jiffies + msecs_to_jiffies(100);
- while (tegra_pmc_cpu_is_powered(cpu)) {
+ while (!tegra_pmc_cpu_is_powered(cpu)) {
if (time_after(jiffies, timeout))
return -ETIMEDOUT;
udelay(10);
--
1.8.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <1d5ea6b7df4573d866779857922ac650fe59af60.1392078805.git.stefan-XLVq0VzYD2Y@public.gmane.org>]
* Re: [PATCH] ARM: tegra: don't timeout if CPU is powergated
[not found] ` <1d5ea6b7df4573d866779857922ac650fe59af60.1392078805.git.stefan-XLVq0VzYD2Y@public.gmane.org>
@ 2014-02-11 21:18 ` Thierry Reding
0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2014-02-11 21:18 UTC (permalink / raw)
To: Stefan Agner
Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q, josephl-DDmLM1+adcrQT0dZR+AlfA,
dev-8ppwABl0HbeELgA04lAiVw, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 2106 bytes --]
On Tue, Feb 11, 2014 at 01:44:13AM +0100, Stefan Agner wrote:
> When booting secondary CPU(s) which are not yet powergated, a wrong
> check lead to a timeout after 100 jiffies. With this patch, we only
> delay powergating if CPUs are still not powered yet.
>
> Signed-off-by: Stefan Agner <stefan-XLVq0VzYD2Y@public.gmane.org>
> ---
> I happend to come accross this while working on Colibri T30 support.
> Obviously, the downstream U-Boot doesn't powergate all CPUs, so
> the Linux kernel always timed out when booting CPU 1 through 3...
>
> arch/arm/mach-tegra/platsmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
> index eb72ae7..929d104 100644
> --- a/arch/arm/mach-tegra/platsmp.c
> +++ b/arch/arm/mach-tegra/platsmp.c
> @@ -114,7 +114,7 @@ static int tegra30_boot_secondary(unsigned int cpu, struct task_struct *idle)
>
> /* Wait for the power to come up. */
> timeout = jiffies + msecs_to_jiffies(100);
> - while (tegra_pmc_cpu_is_powered(cpu)) {
> + while (!tegra_pmc_cpu_is_powered(cpu)) {
> if (time_after(jiffies, timeout))
> return -ETIMEDOUT;
> udelay(10);
This is indeed what I'd expect the code to look like. Since the code
enables power to the CPU, the logical thing to do would be to then wait
for it to be powered up.
I don't quite understand when exactly this will fail, since the whole
block above is conditional on !tegra_pmc_cpu_is_powered() condition, so
the only way that this can happen is when the first check fails, then
the CPU is powered on and the PMC recognizes the CPU as powered before
the while (...) is executed.
Thinking about it I've seen an issue on Cardhu where occasionally only
three of the four CPUs actually came up (I've only noticed this since
the DRM panel patches because three penguins looks kind of weird =).
This bug would explain that issue.
Any way, the new code makes much more sense than the old one, so:
Reviewed-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: tegra: don't timeout if CPU is powergated
2014-02-11 0:44 [PATCH] ARM: tegra: don't timeout if CPU is powergated Stefan Agner
[not found] ` <1d5ea6b7df4573d866779857922ac650fe59af60.1392078805.git.stefan-XLVq0VzYD2Y@public.gmane.org>
@ 2014-02-12 19:20 ` Stephen Warren
[not found] ` <52FBC97D.8040809-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2014-02-12 19:20 UTC (permalink / raw)
To: Stefan Agner, thierry.reding, josephl
Cc: dev, linux-tegra, linux-arm-kernel, linux-kernel
On 02/10/2014 05:44 PM, Stefan Agner wrote:
> When booting secondary CPU(s) which are not yet powergated, a wrong
> check lead to a timeout after 100 jiffies. With this patch, we only
> delay powergating if CPUs are still not powered yet.
I've applied this to Tegra's for-3.15/soc branch.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-13 16:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-11 0:44 [PATCH] ARM: tegra: don't timeout if CPU is powergated Stefan Agner
[not found] ` <1d5ea6b7df4573d866779857922ac650fe59af60.1392078805.git.stefan-XLVq0VzYD2Y@public.gmane.org>
2014-02-11 21:18 ` Thierry Reding
2014-02-12 19:20 ` Stephen Warren
[not found] ` <52FBC97D.8040809-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-02-13 8:28 ` Marc Dietrich
2014-02-13 8:49 ` Thierry Reding
2014-02-13 16:36 ` Stephen Warren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox