With this patch set we make use of cpu_do_idle to enter WFI mode, many platform are not clearing the data buffer before WFI or directly using the address instead of opcode. For the rest its good to have a common approach.
Sanjay Singh Rawat (8): ARM: EXYNOS: use generic cpu idle function for wfi ARM: RealView: use generic cpu idle function for wfi ARM: SPEAr: use generic cpu idle function for wfi ARM: vexpress: use generic cpu idle function for wfi ARM: zynq: use generic cpu idle function for wfi ARM: ux500: use generic cpu idle function for wfi ARM: msm: use generic cpu idle function for wfi ARM: PRIMA2: use generic cpu idle function for wfi
arch/arm/mach-exynos/hotplug.c | 9 ++------- arch/arm/mach-msm/hotplug.c | 9 ++------- arch/arm/mach-prima2/hotplug.c | 4 ++-- arch/arm/mach-realview/hotplug.c | 9 ++------- arch/arm/mach-spear/hotplug.c | 3 ++- arch/arm/mach-ux500/hotplug.c | 5 +++-- arch/arm/mach-vexpress/hotplug.c | 3 ++- arch/arm/mach-zynq/hotplug.c | 4 ++-- 8 files changed, 17 insertions(+), 29 deletions(-)
use cpu_do_idle for entering the WFI mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org --- arch/arm/mach-exynos/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index af90cfa..7fcedd8 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c @@ -98,13 +98,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) if (cpu == 1) __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION);
- /* - * here's the WFI - */ - asm(".word 0xe320f003\n" - : - : - : "memory", "cc"); + /* enter WFI mode */ + cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
Hello Kukjin,
can you please review the patch?
On Monday 27 May 2013 08:02 PM, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the WFI mode.
Signed-off-by: Sanjay Singh Rawatsanjay.rawat@linaro.org
arch/arm/mach-exynos/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index af90cfa..7fcedd8 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c @@ -98,13 +98,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) if (cpu == 1) __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION);
/*
* here's the WFI
*/
asm(".word 0xe320f003\n"
:
:
: "memory", "cc");
/* enter WFI mode */
cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
use cpu_do_idle for entering the wfi mode
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org --- arch/arm/mach-realview/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c index ac22dd4..c42022b 100644 --- a/arch/arm/mach-realview/hotplug.c +++ b/arch/arm/mach-realview/hotplug.c @@ -59,13 +59,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) { - /* - * here's the WFI - */ - asm(".word 0xe320f003\n" - : - : - : "memory", "cc"); + /* enter WFI mode */ + cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
Hello Russell,
can you please review this patch?
On Monday 27 May 2013 08:02 PM, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-realview/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c index ac22dd4..c42022b 100644 --- a/arch/arm/mach-realview/hotplug.c +++ b/arch/arm/mach-realview/hotplug.c @@ -59,13 +59,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) {
/*
* here's the WFI
*/
asm(".word 0xe320f003\n"
:
:
: "memory", "cc");
/* enter WFI mode */
cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org --- arch/arm/mach-spear/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-spear/hotplug.c b/arch/arm/mach-spear/hotplug.c index d97749c..6dbd3dc 100644 --- a/arch/arm/mach-spear/hotplug.c +++ b/arch/arm/mach-spear/hotplug.c @@ -55,7 +55,8 @@ static inline void cpu_leave_lowpower(void) static inline void spear13xx_do_lowpower(unsigned int cpu, int *spurious) { for (;;) { - wfi(); + /* enter WFI mode */ + cpu_do_idle();
if (pen_release == cpu) { /*
On 27 May 2013 20:02, Sanjay Singh Rawat sanjay.rawat@linaro.org wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-spear/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-spear/hotplug.c b/arch/arm/mach-spear/hotplug.c index d97749c..6dbd3dc 100644 --- a/arch/arm/mach-spear/hotplug.c +++ b/arch/arm/mach-spear/hotplug.c @@ -55,7 +55,8 @@ static inline void cpu_leave_lowpower(void) static inline void spear13xx_do_lowpower(unsigned int cpu, int *spurious) { for (;;) {
wfi();
/* enter WFI mode */
cpu_do_idle(); if (pen_release == cpu) {
Acked-by: Viresh Kumar viresh.kumar@linaro.org
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org --- arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index f0ce6b8..b3dffc2 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c @@ -60,7 +60,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) { - wfi(); + /* enter WFI mode */ + cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
hello Russell, Nicolas,
can you please review this patch?
On Monday 27 May 2013 08:02 PM, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawatsanjay.rawat@linaro.org
arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index f0ce6b8..b3dffc2 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c @@ -60,7 +60,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) {
wfi();
/* enter WFI mode */
cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
On Tue, Jun 4, 2013 at 5:23 PM, Sanjay Singh Rawat sanjay.rawat@linaro.org wrote:
hello Russell, Nicolas,
can you please review this patch?
I think you may want Pawel to look at this, he usually looks after the Vexpress.
Yours, Linus Walleij
On Mon, 2013-05-27 at 15:32 +0100, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index f0ce6b8..b3dffc2 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c @@ -60,7 +60,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) {
wfi();
/* enter WFI mode */
cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
I probably don't get the whole picture, but may I ask what is the rationale behind this change? As in: why cpu_do_idle() is better?
Paweł
commit: 8553cb67d2318db327071018fc81084cbabccc46 explains that
-sanjay
On Friday 07 June 2013 08:41 PM, Pawel Moll wrote:
On Mon, 2013-05-27 at 15:32 +0100, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index f0ce6b8..b3dffc2 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c @@ -60,7 +60,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) {
wfi();
/* enter WFI mode */
cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
I probably don't get the whole picture, but may I ask what is the rationale behind this change? As in: why cpu_do_idle() is better?
Paweł
On Tue, 2013-06-11 at 06:33 +0100, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index f0ce6b8..b3dffc2 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c @@ -60,7 +60,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) {
wfi();
/* enter WFI mode */
cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
I probably don't get the whole picture, but may I ask what is the rationale behind this change? As in: why cpu_do_idle() is better?
commit: 8553cb67d2318db327071018fc81084cbabccc46 explains that
Oh, I've noticed the dsb there, I'm just asking why is it necessary in the cpu_die() case? The core is going down anyway, it left the coherency domain and we could cut the power now (if only it was possible). All cache maintenance (which undoubtedly included dsb) has been long done.
Now, don't get me wrong - I'm not saying it's wrong to do the dsb. I simply would like to know if and why is required (I'm admitting my ignorance here ;-) But if you simply grep-ed for "wfi()" in the whole kernel and automatically replaced them with "cpu_do_idle()", it doesn't make sense.
Regards
Pawel
On Tue, 11 Jun 2013, Pawel Moll wrote:
On Tue, 2013-06-11 at 06:33 +0100, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index f0ce6b8..b3dffc2 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c @@ -60,7 +60,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) {
wfi();
/* enter WFI mode */
cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
I probably don't get the whole picture, but may I ask what is the rationale behind this change? As in: why cpu_do_idle() is better?
commit: 8553cb67d2318db327071018fc81084cbabccc46 explains that
Oh, I've noticed the dsb there, I'm just asking why is it necessary in the cpu_die() case? The core is going down anyway, it left the coherency domain and we could cut the power now (if only it was possible). All cache maintenance (which undoubtedly included dsb) has been long done.
Now, don't get me wrong - I'm not saying it's wrong to do the dsb. I simply would like to know if and why is required (I'm admitting my ignorance here ;-) But if you simply grep-ed for "wfi()" in the whole kernel and automatically replaced them with "cpu_do_idle()", it doesn't make sense.
That's my feeling too. There is a semantic difference between calling cpu_do_idle() and executing a WFI inline. I'd use cpu_do_idle() only in those cases where the call is expected to return and keep the inlined WFI otherwise (with the added DSB when necessary which is not all cases as explained above).
Nicolas
Pawel, Nicolas,
Thanks for the clarification :), dropping.
sanjay
On Tuesday 11 June 2013 09:00 PM, Nicolas Pitre wrote:
On Tue, 11 Jun 2013, Pawel Moll wrote:
On Tue, 2013-06-11 at 06:33 +0100, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index f0ce6b8..b3dffc2 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c @@ -60,7 +60,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) {
wfi();
/* enter WFI mode */
cpu_do_idle(); if (pen_release == cpu_logical_map(cpu)) { /*
I probably don't get the whole picture, but may I ask what is the rationale behind this change? As in: why cpu_do_idle() is better?
commit: 8553cb67d2318db327071018fc81084cbabccc46 explains that
Oh, I've noticed the dsb there, I'm just asking why is it necessary in the cpu_die() case? The core is going down anyway, it left the coherency domain and we could cut the power now (if only it was possible). All cache maintenance (which undoubtedly included dsb) has been long done.
Now, don't get me wrong - I'm not saying it's wrong to do the dsb. I simply would like to know if and why is required (I'm admitting my ignorance here ;-) But if you simply grep-ed for "wfi()" in the whole kernel and automatically replaced them with "cpu_do_idle()", it doesn't make sense.
That's my feeling too. There is a semantic difference between calling cpu_do_idle() and executing a WFI inline. I'd use cpu_do_idle() only in those cases where the call is expected to return and keep the inlined WFI otherwise (with the added DSB when necessary which is not all cases as explained above).
Nicolas
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org --- arch/arm/mach-zynq/hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-zynq/hotplug.c b/arch/arm/mach-zynq/hotplug.c index c89672b..ef0d65d 100644 --- a/arch/arm/mach-zynq/hotplug.c +++ b/arch/arm/mach-zynq/hotplug.c @@ -64,8 +64,8 @@ static inline void zynq_platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) { - dsb(); - wfi(); + /* enter WFI mode */ + cpu_do_idle();
/* * Getting here, means that we have come out of WFI without
On 05/27/2013 04:32 PM, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-zynq/hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-zynq/hotplug.c b/arch/arm/mach-zynq/hotplug.c index c89672b..ef0d65d 100644 --- a/arch/arm/mach-zynq/hotplug.c +++ b/arch/arm/mach-zynq/hotplug.c @@ -64,8 +64,8 @@ static inline void zynq_platform_do_lowpower(unsigned int cpu, int *spurious) * code will have already disabled interrupts */ for (;;) {
dsb();
wfi();
/* enter WFI mode */
cpu_do_idle();
/* * Getting here, means that we have come out of WFI without
Applied to zynq/cleanup branch.
Thanks, Michal
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org --- arch/arm/mach-ux500/hotplug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c index 2bc00b0..f4ded92 100644 --- a/arch/arm/mach-ux500/hotplug.c +++ b/arch/arm/mach-ux500/hotplug.c @@ -25,8 +25,9 @@ void __ref ux500_cpu_die(unsigned int cpu) { /* directly enter low power state, skipping secure registers */ for (;;) { - __asm__ __volatile__("dsb\n\t" "wfi\n\t" - : : : "memory"); + /* enter WFI mode */ + cpu_do_idle(); + if (pen_release == cpu_logical_map(cpu)) { /* * OK, proper wakeup, we're done
On Mon, May 27, 2013 at 16:32:43 +0200, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-ux500/hotplug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c index 2bc00b0..f4ded92 100644 --- a/arch/arm/mach-ux500/hotplug.c +++ b/arch/arm/mach-ux500/hotplug.c @@ -25,8 +25,9 @@ void __ref ux500_cpu_die(unsigned int cpu) { /* directly enter low power state, skipping secure registers */ for (;;) {
__asm__ __volatile__("dsb\n\t" "wfi\n\t"
: : : "memory");
/* enter WFI mode */
cpu_do_idle();
Acked-by: srinidhi kasagar srinidhi.kasagar@stericsson.com
srinidhi
if (pen_release == cpu_logical_map(cpu)) { /* * OK, proper wakeup, we're done
-- 1.7.9.5
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org --- arch/arm/mach-msm/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c index 326a872..1b03e5f 100644 --- a/arch/arm/mach-msm/hotplug.c +++ b/arch/arm/mach-msm/hotplug.c @@ -26,13 +26,8 @@ static inline void platform_do_lowpower(unsigned int cpu) { /* Just enter wfi for now. TODO: Properly shut off the cpu. */ for (;;) { - /* - * here's the WFI - */ - asm("wfi" - : - : - : "memory", "cc"); + /* enter WFI mode */ + cpu_do_idle();
if (pen_release == cpu_logical_map(cpu)) { /*
On Mon, May 27, 2013 at 08:02:44PM +0530, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-msm/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Acked-by: David Brown davidb@codeaurora.org
On Mon, May 27, 2013 at 08:02:44PM +0530, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-msm/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Acked-by: David Brown davidb@codeaurora.org
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org --- arch/arm/mach-prima2/hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-prima2/hotplug.c b/arch/arm/mach-prima2/hotplug.c index 0ab2f8b..68d2903 100644 --- a/arch/arm/mach-prima2/hotplug.c +++ b/arch/arm/mach-prima2/hotplug.c @@ -16,8 +16,8 @@ static inline void platform_do_lowpower(unsigned int cpu) { /* we put the platform to just WFI */ for (;;) { - __asm__ __volatile__("dsb\n\t" "wfi\n\t" - : : : "memory"); + cpu_do_idle(); + if (pen_release == cpu_logical_map(cpu)) { /* * OK, proper wakeup, we're done
Hello Barry,
Sorry i missed you in the initial mail. Can you please review the patch.
thanks, sanjay
On Monday 27 May 2013 08:02 PM, Sanjay Singh Rawat wrote:
use cpu_do_idle for entering the wfi mode.
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org
arch/arm/mach-prima2/hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-prima2/hotplug.c b/arch/arm/mach-prima2/hotplug.c index 0ab2f8b..68d2903 100644 --- a/arch/arm/mach-prima2/hotplug.c +++ b/arch/arm/mach-prima2/hotplug.c @@ -16,8 +16,8 @@ static inline void platform_do_lowpower(unsigned int cpu) { /* we put the platform to just WFI */ for (;;) {
__asm__ __volatile__("dsb\n\t" "wfi\n\t"
: : : "memory");
cpu_do_idle();
- if (pen_release == cpu_logical_map(cpu)) { /* * OK, proper wakeup, we're done