diff mbox series

[v5,08/14] ARM: tegra: Make outer_disable() open-coded

Message ID 20190929175952.22690-9-digetx@gmail.com
State Changes Requested
Headers show
Series Consolidate and improve NVIDIA Tegra CPUIDLE driver(s) | expand

Commit Message

Dmitry Osipenko Sept. 29, 2019, 5:59 p.m. UTC
The outer_disable() of Tegra's suspend code is open-coded now since
that helper produces spurious warning message about secondary CPUs being
online. The secondaries are actually halted by the cpuidle driver on
entering into LP2 idle-state. This fixes a storm of warnings once LP2
idling state is enabled on Tegra30.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 arch/arm/mach-tegra/pm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Thierry Reding Sept. 30, 2019, 8:05 a.m. UTC | #1
On Sun, Sep 29, 2019 at 08:59:46PM +0300, Dmitry Osipenko wrote:
> The outer_disable() of Tegra's suspend code is open-coded now since
> that helper produces spurious warning message about secondary CPUs being
> online. The secondaries are actually halted by the cpuidle driver on
> entering into LP2 idle-state. This fixes a storm of warnings once LP2
> idling state is enabled on Tegra30.

If the cpuidle driver halts the secondaries, shouldn't it set it offline
then so that outer_disable() can still work correctly?

Thierry

> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  arch/arm/mach-tegra/pm.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
> index 7d9ef26e52a7..16a02937d3da 100644
> --- a/arch/arm/mach-tegra/pm.c
> +++ b/arch/arm/mach-tegra/pm.c
> @@ -146,9 +146,10 @@ static int tegra_sleep_cpu(unsigned long v2p)
>  	 * if any of secondary CPU's is online and this is the LP2-idle
>  	 * code-path only for Tegra20/30.
>  	 */
> -	if (trusted_foundations_registered())
> -		outer_disable();
> -
> +#ifdef CONFIG_OUTER_CACHE
> +	if (trusted_foundations_registered() && outer_cache.disable)
> +		outer_cache.disable();
> +#endif
>  	/*
>  	 * Note that besides of setting up CPU reset vector this firmware
>  	 * call may also do the following, depending on the FW version:
> -- 
> 2.23.0
>
Dmitry Osipenko Sept. 30, 2019, 2:29 p.m. UTC | #2
30.09.2019 11:05, Thierry Reding пишет:
> On Sun, Sep 29, 2019 at 08:59:46PM +0300, Dmitry Osipenko wrote:
>> The outer_disable() of Tegra's suspend code is open-coded now since
>> that helper produces spurious warning message about secondary CPUs being
>> online. The secondaries are actually halted by the cpuidle driver on
>> entering into LP2 idle-state. This fixes a storm of warnings once LP2
>> idling state is enabled on Tegra30.
> 
> If the cpuidle driver halts the secondaries, shouldn't it set it offline
> then so that outer_disable() can still work correctly?

No.. how would you know what CPU's should be resumed?

AFAIK, the online status should be only changed by the hotplug code and
nothing else. I don't think that it's a good idea to manually touch the
online mask.

It looks to me that the only purpose of outer_disable() checking for the
num_online_cpus is to prevent people from doing wrong things by
disabling L2 in a random places in their code. Hence it should be
absolutely fine to open code when you know what you're doing, which is
the case here.

We can check the rail status in tegra_sleep_cpu():

if (trusted_foundations_registered() && outer_cache.disable) {
	if (WARN_ON(!tegra_cpu_rail_off_ready()))
		return -EBUSY;

	outer_cache.disable();
}

Which is equal to the check for num_online_cpus. Does it sound good?
diff mbox series

Patch

diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 7d9ef26e52a7..16a02937d3da 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -146,9 +146,10 @@  static int tegra_sleep_cpu(unsigned long v2p)
 	 * if any of secondary CPU's is online and this is the LP2-idle
 	 * code-path only for Tegra20/30.
 	 */
-	if (trusted_foundations_registered())
-		outer_disable();
-
+#ifdef CONFIG_OUTER_CACHE
+	if (trusted_foundations_registered() && outer_cache.disable)
+		outer_cache.disable();
+#endif
 	/*
 	 * Note that besides of setting up CPU reset vector this firmware
 	 * call may also do the following, depending on the FW version: