Skip to contentSkip to conversation

Make Tegra cpuidle driver PSCI compatible

PATCH Superseded Jan Kiszka 5 participants 8 messages May 8, 2015 – May 11, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

cover Make Tegra cpuidle driver PSCI compatible

Two small patches so that we can keep the Tegra cpuidle driver enabled even in the presence of PSCI which takes over some duties (U-Boot is about to gain such support for Tegra124).

Jan

Jan Kiszka (2):
ARM: Availability of psci_smp_available depends on CONFIG_SMP
ARM: tegra: Disable cpuidle driver if PSCI is present

 arch/arm/include/asm/psci.h | 6 +++++-
 arch/arm/mach-tegra/Kconfig | 1 +
 arch/arm/mach-tegra/tegra.c | 4 +++-
 3 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH 1/2 ARM: Availability of psci_smp_available depends on CONFIG_SMP

Ensure that we can use psci_smp_available without checking for CONFIG_SMP first.

---
 arch/arm/include/asm/psci.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/include/asm/psci.h +5 -1
index c25ef3e..eef6a0a 100644
@@ -39,9 +39,13 @@ extern struct smp_operations psci_smp_ops;
 
 #ifdef CONFIG_ARM_PSCI
 int psci_init(void);
-bool psci_smp_available(void);
 #else
 static inline int psci_init(void) { return 0; }
+#endif
+
+#if defined(CONFIG_ARM_PSCI) && defined(CONFIG_SMP)
+bool psci_smp_available(void);
+#else
 static inline bool psci_smp_available(void) { return false; }
 #endif
 
Signature · 1 line
2.1.4
#2 lore raw

PATCH 1/2 ARM: Availability of psci_smp_available depends on CONFIG_SMP

Quoted 17 lines · Jan Kiszka

Ensure that we can use psci_smp_available without checking for CONFIG_SMP first.

---
 arch/arm/include/asm/psci.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/include/asm/psci.h +0 -1
index c25ef3e..eef6a0a 100644
@@ -39,9 +39,13 @@ extern struct smp_operations psci_smp_ops;
 
 #ifdef CONFIG_ARM_PSCI
 int psci_init(void);
-bool psci_smp_available(void);

arch/arm/include/asm/psci.h extern struct smp_operations psci_smp_ops; · line 51

Quoted 10 lines
arch/arm/include/asm/psci.h +5 -0
 #else
 static inline int psci_init(void) { return 0; }
+#endif
+
+#if defined(CONFIG_ARM_PSCI) && defined(CONFIG_SMP)
+bool psci_smp_available(void);
+#else
 static inline bool psci_smp_available(void) { return false; }
 #endif
 

Looks good to me.

Russell, would you be willing to ack this patch so that I can take it through the Tegra tree along with patch 2/2 that depends on this?

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150508/3f33b4f0/attachment.sig>

#3 lore raw

PATCH 1/2 ARM: Availability of psci_smp_available depends on CONFIG_SMP

Quoted 31 lines · Thierry Reding
Quoted 17 lines · Jan Kiszka

Ensure that we can use psci_smp_available without checking for CONFIG_SMP first.

---
 arch/arm/include/asm/psci.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/include/asm/psci.h +0 -1
index c25ef3e..eef6a0a 100644
@@ -39,9 +39,13 @@ extern struct smp_operations psci_smp_ops;
 
 #ifdef CONFIG_ARM_PSCI
 int psci_init(void);
-bool psci_smp_available(void);

arch/arm/include/asm/psci.h extern struct smp_operations psci_smp_ops; · line 51

Quoted 10 lines
arch/arm/include/asm/psci.h +5 -0
 #else
 static inline int psci_init(void) { return 0; }
+#endif
+
+#if defined(CONFIG_ARM_PSCI) && defined(CONFIG_SMP)
+bool psci_smp_available(void);
+#else
 static inline bool psci_smp_available(void) { return false; }
 #endif
 

Looks good to me.

Quoted 2 lines

Russell, would you be willing to ack this patch so that I can take it through the Tegra tree along with patch 2/2 that depends on this?

I'd prefer to see an ack from Will on this, as it's code which Will contributed and presumably understands better than me.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#4 lore raw

PATCH 1/2 ARM: Availability of psci_smp_available depends on CONFIG_SMP

Quoted 32 lines · Russell King - ARM Linux
Quoted 31 lines · Thierry Reding
Quoted 17 lines · Jan Kiszka

Ensure that we can use psci_smp_available without checking for CONFIG_SMP first.

---
 arch/arm/include/asm/psci.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/include/asm/psci.h +0 -1
index c25ef3e..eef6a0a 100644
@@ -39,9 +39,13 @@ extern struct smp_operations psci_smp_ops;
 
 #ifdef CONFIG_ARM_PSCI
 int psci_init(void);
-bool psci_smp_available(void);

arch/arm/include/asm/psci.h extern struct smp_operations psci_smp_ops; · line 51

Quoted 10 lines
arch/arm/include/asm/psci.h +5 -0
 #else
 static inline int psci_init(void) { return 0; }
+#endif
+
+#if defined(CONFIG_ARM_PSCI) && defined(CONFIG_SMP)
+bool psci_smp_available(void);
+#else
 static inline bool psci_smp_available(void) { return false; }
 #endif
 

Looks good to me.

Quoted 5 lines
Quoted 2 lines

Russell, would you be willing to ack this patch so that I can take it through the Tegra tree along with patch 2/2 that depends on this?

I'd prefer to see an ack from Will on this, as it's code which Will contributed and presumably understands better than me.

Sorry, I'm late to the thread so I'm a tad confused.

If I understand correctly, these two patches are trying to avoid using the tegra cpuidle driver if PSCI is available instead? That raises the question as to whether or not you're actually trying to discover whether you're in the secure or non-secure world.

I assume PSCI only works if the kernel is running in non-secure mode, but does the Tegra cpuidle driver only work in secure mode?

Will

author
#5 lore raw

PATCH 1/2 ARM: Availability of psci_smp_available depends on CONFIG_SMP

Quoted 41 lines · Will Deacon
Quoted 32 lines · Russell King - ARM Linux
Quoted 31 lines · Thierry Reding
Quoted 17 lines · Jan Kiszka

Ensure that we can use psci_smp_available without checking for CONFIG_SMP first.

---
 arch/arm/include/asm/psci.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/include/asm/psci.h +0 -1
index c25ef3e..eef6a0a 100644
@@ -39,9 +39,13 @@ extern struct smp_operations psci_smp_ops;
 
 #ifdef CONFIG_ARM_PSCI
 int psci_init(void);
-bool psci_smp_available(void);

arch/arm/include/asm/psci.h extern struct smp_operations psci_smp_ops; · line 51

Quoted 10 lines
arch/arm/include/asm/psci.h +5 -0
 #else
 static inline int psci_init(void) { return 0; }
+#endif
+
+#if defined(CONFIG_ARM_PSCI) && defined(CONFIG_SMP)
+bool psci_smp_available(void);
+#else
 static inline bool psci_smp_available(void) { return false; }
 #endif
 

Looks good to me.

Quoted 5 lines
Quoted 2 lines

Russell, would you be willing to ack this patch so that I can take it through the Tegra tree along with patch 2/2 that depends on this?

I'd prefer to see an ack from Will on this, as it's code which Will contributed and presumably understands better than me.

Sorry, I'm late to the thread so I'm a tad confused.

Quoted 7 lines

If I understand correctly, these two patches are trying to avoid using the tegra cpuidle driver if PSCI is available instead? That raises the question as to whether or not you're actually trying to discover whether you're in the secure or non-secure world.

I assume PSCI only works if the kernel is running in non-secure mode, but does the Tegra cpuidle driver only work in secure mode?

To my understanding of the hardware, the flow controller can be accessed from both worlds. So, testing the mode would neither be sufficient nor more logical - it's PSCI which occupies this resource, not automatically all secure monitors.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#6 lore raw

PATCH 1/2 ARM: Availability of psci_smp_available depends on CONFIG_SMP

Quoted 47 lines · Jan Kiszka
Quoted 46 lines · Will Deacon
Quoted 32 lines · Russell King - ARM Linux
Quoted 31 lines · Thierry Reding
Quoted 17 lines · Jan Kiszka

Ensure that we can use psci_smp_available without checking for CONFIG_SMP first.

---
 arch/arm/include/asm/psci.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/include/asm/psci.h +0 -1
index c25ef3e..eef6a0a 100644
@@ -39,9 +39,13 @@ extern struct smp_operations psci_smp_ops;
 
 #ifdef CONFIG_ARM_PSCI
 int psci_init(void);
-bool psci_smp_available(void);

arch/arm/include/asm/psci.h extern struct smp_operations psci_smp_ops; · line 51

Quoted 10 lines
arch/arm/include/asm/psci.h +5 -0
 #else
 static inline int psci_init(void) { return 0; }
+#endif
+
+#if defined(CONFIG_ARM_PSCI) && defined(CONFIG_SMP)
+bool psci_smp_available(void);
+#else
 static inline bool psci_smp_available(void) { return false; }
 #endif
 

Looks good to me.

Quoted 5 lines
Quoted 2 lines

Russell, would you be willing to ack this patch so that I can take it through the Tegra tree along with patch 2/2 that depends on this?

I'd prefer to see an ack from Will on this, as it's code which Will contributed and presumably understands better than me.

Sorry, I'm late to the thread so I'm a tad confused.

If I understand correctly, these two patches are trying to avoid using the tegra cpuidle driver if PSCI is available instead? That raises the question as to whether or not you're actually trying to discover whether you're in the secure or non-secure world.

Quoted 7 lines
Quoted 2 lines

I assume PSCI only works if the kernel is running in non-secure mode, but does the Tegra cpuidle driver only work in secure mode?

To my understanding of the hardware, the flow controller can be accessed from both worlds. So, testing the mode would neither be sufficient nor more logical - it's PSCI which occupies this resource, not automatically all secure monitors.

This is correct. The flow controller doesn't check the NS bit.

Cheers,

Peter.

author
#7 lore raw

PATCH 2/2 ARM: tegra: Disable cpuidle driver if PSCI is present

In reply to Jan Kiszka

The firmware takes over the ownership of the flow controller when it provides PSCI support. To avoid clashes, disable the Tegra cpuidle driver if PSCI was detected.

---
 arch/arm/mach-tegra/Kconfig | 1 +
 arch/arm/mach-tegra/tegra.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-tegra/Kconfig +1 -0
index 5d1a318..f93e4dc 100644
@@ -4,6 +4,7 @@ menuconfig ARCH_TEGRA
 	select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
 	select ARM_AMBA
 	select ARM_GIC
+	select ARM_PSCI
 	select CLKSRC_MMIO
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
arch/arm/mach-tegra/tegra.c +3 -1
index 861d884..17e1adc 100644
@@ -44,6 +44,7 @@
 #include <asm/mach-types.h>
 #include <asm/setup.h>
 #include <asm/trusted_foundations.h>
+#include <asm/psci.h>
 
 #include "board.h"
 #include "common.h"
@@ -136,7 +137,8 @@ static void __init tegra_dt_init_late(void)
 	int i;
 
 	tegra_init_suspend();
-	tegra_cpuidle_init();
+	if (!psci_smp_available())
+		tegra_cpuidle_init();
 
 	for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
 		if (of_machine_is_compatible(board_init_funcs[i].machine)) {
Signature · 1 line
2.1.4