ARM: use cpu_do_idle for entering wfi mode
Subsystems (7)
cover ARM: use cpu_do_idle for entering wfi mode
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(-)
Signature · 1 line
1.7.9.5
PATCH 1/8 ARM: EXYNOS: use generic cpu idle function for wfi
use cpu_do_idle for entering the WFI mode.
--- arch/arm/mach-exynos/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
arch/arm/mach-exynos/hotplug.c +2 -7
@@ -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)) {/*
Signature · 1 line
1.7.9.5
PATCH 1/8 ARM: EXYNOS: use generic cpu idle function for wfi
Hello Kukjin,
can you please review the patch?
Quoted 27 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the WFI mode.Signed-off-by Sanjay Singh Rawat<[email protected]>--- arch/arm/mach-exynos/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)arch/arm/mach-exynos/hotplug.c +2
-7@@ -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)) {/*
PATCH 2/8 ARM: RealView: use generic cpu idle function for wfi
In reply to Sanjay Singh Rawatuse cpu_do_idle for entering the wfi mode
--- arch/arm/mach-realview/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
arch/arm/mach-realview/hotplug.c +2 -7
@@ -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)) {/*
Signature · 1 line
1.7.9.5
PATCH 2/8 ARM: RealView: use generic cpu idle function for wfi
Hello Russell,
can you please review this patch?
Quoted 28 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi modeSigned-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-realview/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)arch/arm/mach-realview/hotplug.c +2
-7@@ -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)) {/*
PATCH 3/8 ARM: SPEAr: use generic cpu idle function for wfi
In reply to Sanjay Singh Rawatuse cpu_do_idle for entering the wfi mode.
--- arch/arm/mach-spear/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-spear/hotplug.c +2 -1
@@ -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) {/*
Signature · 1 line
1.7.9.5
PATCH 3/8 ARM: SPEAr: use generic cpu idle function for wfi
Quoted 12 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-spear/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-spear/hotplug.c +0
-0
arch/arm/mach-spear/hotplug.c static inline void cpu_leave_lowpower(void) · line 61
Quoted 8 lines
arch/arm/mach-spear/hotplug.c +2
-1@@ -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) {
PATCH 4/8 ARM: vexpress: use generic cpu idle function for wfi
In reply to Sanjay Singh Rawatuse cpu_do_idle for entering the wfi mode.
--- arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-vexpress/hotplug.c +2 -1
@@ -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)) {/*
Signature · 1 line
1.7.9.5
PATCH 4/8 ARM: vexpress: use generic cpu idle function for wfi
hello Russell, Nicolas,
can you please review this patch?
Quoted 21 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat<[email protected]>--- arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-vexpress/hotplug.c +2
-1@@ -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)) {/*
PATCH 4/8 ARM: vexpress: use generic cpu idle function for wfi
Quoted 3 lines · Sanjay Singh Rawat
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
PATCH 4/8 ARM: vexpress: use generic cpu idle function for wfi
In reply to Sanjay Singh RawatQuoted 12 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-vexpress/hotplug.c +0
-0
arch/arm/mach-vexpress/hotplug.c static inline void platform_do_lowpower(unsigned int cpu, int *spurious) · line 67
Quoted 9 lines
arch/arm/mach-vexpress/hotplug.c +2
-1@@ -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?
PATCH 4/8 ARM: vexpress: use generic cpu idle function for wfi
commit: 8553cb67d2318db327071018fc81084cbabccc46 explains that
-sanjay
Quoted 29 lines · Pawel Moll
Quoted 12 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-vexpress/hotplug.c +0
-0arch/arm/mach-vexpress/hotplug.c static inline void platform_do_lowpower(unsigned int cpu, int *spurious) · line 67
Quoted 9 lines
arch/arm/mach-vexpress/hotplug.c +2
-1@@ -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?
PATCH 4/8 ARM: vexpress: use generic cpu idle function for wfi
Quoted 19 lines · Sanjay Singh Rawat
Quoted 19 lines
Quoted 19 lines
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-vexpress/hotplug.c +2
-1@@ -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 ();
Quoted 7 lines
Quoted 5 lines
arch/arm/mach-vexpress/hotplug.c static inline void platform_do_lowpower(unsigned int cpu, int *spurious) · line 67
Quoted 2 lines
arch/arm/mach-vexpress/hotplug.c +0
-0if (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:
8553cb67d2318db327071018fc81084cbabccc46explains 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
PATCH 4/8 ARM: vexpress: use generic cpu idle function for wfi
Quoted 33 lines · Pawel Moll
Quoted 19 lines · Sanjay Singh Rawat
Quoted 19 lines
Quoted 19 lines
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-vexpress/hotplug.c +2
-1@@ -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 ();Quoted 7 lines
Quoted 5 lines
arch/arm/mach-vexpress/hotplug.c static inline void platform_do_lowpower(unsigned int cpu, int *spurious) · line 67
Quoted 2 lines
arch/arm/mach-vexpress/hotplug.c +0
-0if (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:
8553cb67d2318db327071018fc81084cbabccc46explains thatOh, 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.
Quoted 5 lines
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
PATCH 4/8 ARM: vexpress: use generic cpu idle function for wfi
Pawel, Nicolas,
Thanks for the clarification :), dropping.
sanjay
Quoted 49 lines · Nicolas Pitre
Quoted 33 lines · Pawel Moll
Quoted 19 lines · Sanjay Singh Rawat
Quoted 19 lines
Quoted 19 lines
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-vexpress/hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-vexpress/hotplug.c +2
-1@@ -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 ();Quoted 7 lines
Quoted 5 lines
arch/arm/mach-vexpress/hotplug.c static inline void platform_do_lowpower(unsigned int cpu, int *spurious) · line 67
Quoted 2 lines
arch/arm/mach-vexpress/hotplug.c +0
-0if (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:
8553cb67d2318db327071018fc81084cbabccc46explains thatOh, 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.Quoted 5 lines
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 usecpu_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
PATCH 5/8 ARM: zynq: use generic cpu idle function for wfi
In reply to Sanjay Singh Rawatuse cpu_do_idle for entering the wfi mode.
--- arch/arm/mach-zynq/hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-zynq/hotplug.c +2 -2
@@ -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
Signature · 1 line
1.7.9.5
Michal Simek
AppliedPATCH 5/8 ARM: zynq: use generic cpu idle function for wfi
Quoted 13 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-zynq/hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-zynq/hotplug.c +0
-0
arch/arm/mach-zynq/hotplug.c static inline void zynq_platform_do_lowpower(unsigned int cpu, int *spurious) · line 71
Quoted 10 lines
arch/arm/mach-zynq/hotplug.c +2
-2@@ -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
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130529/663c5f5e/attachment.sig>
PATCH 6/8 ARM: ux500: use generic cpu idle function for wfi
In reply to Sanjay Singh Rawatuse cpu_do_idle for entering the wfi mode.
--- arch/arm/mach-ux500/hotplug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-ux500/hotplug.c +3 -2
@@ -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
Signature · 1 line
1.7.9.5
PATCH 6/8 ARM: ux500: use generic cpu idle function for wfi
Quoted 12 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-ux500/hotplug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/arm/mach-ux500/hotplug.c +0
-0
arch/arm/mach-ux500/hotplug.c void __ref ux500_cpu_die(unsigned int cpu) · line 30
Quoted 8 lines
arch/arm/mach-ux500/hotplug.c +3
-2@@ -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 (); +
srinidhi
Quoted 6 lines
arch/arm/mach-ux500/hotplug.c +0
-0if (pen_release ==cpu_logical_map (cpu)) {/* * OK, proper wakeup, we're done Signature · 1 line
1.7.9.5
PATCH 7/8 ARM: msm: use generic cpu idle function for wfi
In reply to Sanjay Singh Rawatuse cpu_do_idle for entering the wfi mode.
--- arch/arm/mach-msm/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
arch/arm/mach-msm/hotplug.c +2 -7
@@ -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)) {/*
Signature · 1 line
1.7.9.5
PATCH 7/8 ARM: msm: use generic cpu idle function for wfi
Quoted 6 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-msm/hotplug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Signature · 3 lines
sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
PATCH 7/8 ARM: msm: use generic cpu idle function for wfi
In reply to Sanjay Singh RawatQuoted 6 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>---
arch/arm/mach-msm/hotplug.c| 9 ++-------1 file changed, 2 insertions(+), 7 deletions(-)
Signature · 3 lines
sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
PATCH 8/8 ARM: PRIMA2: use generic cpu idle function for wfi
In reply to Sanjay Singh Rawatuse cpu_do_idle for entering the wfi mode.
--- arch/arm/mach-prima2/hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/hotplug.c +2 -2
@@ -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
Signature · 1 line
1.7.9.5
PATCH 8/8 ARM: PRIMA2: use generic cpu idle function for wfi
Hello Barry,
Sorry i missed you in the initial mail. Can you please review the patch.
thanks,
sanjay
Quoted 23 lines · Sanjay Singh Rawat
use
cpu_do_idlefor entering the wfi mode.Signed-off-by Sanjay Singh Rawat <[email protected]>--- arch/arm/mach-prima2/hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-prima2/hotplug.c +2
-2@@ -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