* [PATCH 1/5] ARM: realview: Use wfi macro in platform_do_lowpower.
2011-09-09 15:26 [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro Nick Bowler
@ 2011-09-09 15:26 ` Nick Bowler
2011-09-09 15:26 ` [PATCH 2/5] ARM: exynos4: " Nick Bowler
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Nick Bowler @ 2011-09-09 15:26 UTC (permalink / raw)
To: linux-arm-kernel
Current Realview CPU hotplug code includes a hardcoded WFI instruction,
in ARM encoding. The hardcoded instruction is both hard to understand
and doomed to failure when building the kernel in Thumb-2 mode.
Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
---
Compile tested in both ARM and Thumb-2 mode.
---
arch/arm/mach-realview/hotplug.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index a87523d..6d19377 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -13,6 +13,7 @@
#include <linux/smp.h>
#include <asm/cacheflush.h>
+#include <asm/system.h>
extern volatile int pen_release;
@@ -61,13 +62,7 @@ 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");
+ wfi();
if (pen_release == cpu) {
/*
--
1.7.3.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/5] ARM: exynos4: Use wfi macro in platform_do_lowpower.
2011-09-09 15:26 [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro Nick Bowler
2011-09-09 15:26 ` [PATCH 1/5] ARM: realview: Use wfi macro in platform_do_lowpower Nick Bowler
@ 2011-09-09 15:26 ` Nick Bowler
2011-09-09 15:26 ` [PATCH 3/5] ARM: shmobile: Use wfi macro in platform_cpu_die Nick Bowler
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Nick Bowler @ 2011-09-09 15:26 UTC (permalink / raw)
To: linux-arm-kernel
Current Exynos4 CPU hotplug code includes a hardcoded WFI instruction,
in ARM encoding. The hardcoded instruction is both hard to understand
and doomed to failure when building the kernel in Thumb-2 mode.
Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
---
Compile tested in both ARM and Thumb-2 mode.
---
arch/arm/mach-exynos4/hotplug.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-exynos4/hotplug.c b/arch/arm/mach-exynos4/hotplug.c
index 7490789..8724227 100644
--- a/arch/arm/mach-exynos4/hotplug.c
+++ b/arch/arm/mach-exynos4/hotplug.c
@@ -16,6 +16,7 @@
#include <linux/io.h>
#include <asm/cacheflush.h>
+#include <asm/system.h>
#include <mach/regs-pmu.h>
@@ -67,13 +68,7 @@ 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");
+ wfi();
if (pen_release == cpu) {
/*
--
1.7.3.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/5] ARM: shmobile: Use wfi macro in platform_cpu_die.
2011-09-09 15:26 [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro Nick Bowler
2011-09-09 15:26 ` [PATCH 1/5] ARM: realview: Use wfi macro in platform_do_lowpower Nick Bowler
2011-09-09 15:26 ` [PATCH 2/5] ARM: exynos4: " Nick Bowler
@ 2011-09-09 15:26 ` Nick Bowler
2011-09-09 15:26 ` [PATCH 4/5] ARM: tegra: Use wfi macro in platform_do_lowpower Nick Bowler
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Nick Bowler @ 2011-09-09 15:26 UTC (permalink / raw)
To: linux-arm-kernel
Current Shmobile CPU hotplug code includes a hardcoded WFI instruction,
in ARM encoding. The hardcoded instruction is both hard to understand
and doomed to failure when building the kernel in Thumb-2 mode.
Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
---
Compile tested in both ARM and Thumb-2 mode, and the resulting hotplug.o
contains the correct instruction sequence, but the final kernel failed
to link for apparently unrelated reasons:
In ARM mode:
LD .tmp_vmlinux1
arch/arm/kernel/built-in.o: In function `twd_timer_setup':
io.c:(.cpuinit.text+0x600): undefined reference to `gic_enable_ppi'
arch/arm/mach-shmobile/built-in.o: In function `smp_init_cpus':
pfc-sh7372.c:(.init.text+0xbb0): undefined reference to `gic_raise_softirq'
In Thumb-2 mode:
LD .tmp_vmlinux1
arch/arm/kernel/built-in.o: In function `get_wchan':
io.c:(.text+0x1542): undefined reference to `unwind_frame'
arch/arm/kernel/built-in.o: In function `walk_stackframe':
io.c:(.text+0x27f0): undefined reference to `unwind_frame'
arch/arm/kernel/built-in.o: In function `profile_pc':
io.c:(.text+0x2828): undefined reference to `unwind_frame'
arch/arm/kernel/built-in.o: In function `twd_timer_setup':
io.c:(.cpuinit.text+0x42e): undefined reference to `gic_enable_ppi'
arch/arm/mach-shmobile/built-in.o: In function `smp_init_cpus':
pfc-sh7372.c:(.init.text+0x8e8): undefined reference to `gic_raise_softirq'
---
arch/arm/mach-shmobile/hotplug.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-shmobile/hotplug.c b/arch/arm/mach-shmobile/hotplug.c
index 238a0d9..1e83087 100644
--- a/arch/arm/mach-shmobile/hotplug.c
+++ b/arch/arm/mach-shmobile/hotplug.c
@@ -13,6 +13,8 @@
#include <linux/errno.h>
#include <linux/smp.h>
+#include <asm/system.h>
+
int platform_cpu_kill(unsigned int cpu)
{
return 1;
@@ -21,13 +23,7 @@ int platform_cpu_kill(unsigned int cpu)
void platform_cpu_die(unsigned int cpu)
{
while (1) {
- /*
- * here's the WFI
- */
- asm(".word 0xe320f003\n"
- :
- :
- : "memory", "cc");
+ wfi();
}
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/5] ARM: tegra: Use wfi macro in platform_do_lowpower.
2011-09-09 15:26 [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro Nick Bowler
` (2 preceding siblings ...)
2011-09-09 15:26 ` [PATCH 3/5] ARM: shmobile: Use wfi macro in platform_cpu_die Nick Bowler
@ 2011-09-09 15:26 ` Nick Bowler
2011-09-09 15:26 ` [PATCH 5/5] ARM: omap4: Kill private do_wfi macro Nick Bowler
2011-09-09 15:42 ` [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro Nick Bowler
5 siblings, 0 replies; 10+ messages in thread
From: Nick Bowler @ 2011-09-09 15:26 UTC (permalink / raw)
To: linux-arm-kernel
Current Tegra CPU hotplug code includes a hardcoded WFI instruction, in
ARM encoding. The hardcoded instruction is both hard to understand and
doomed to failure when building the kernel in Thumb-2 mode.
Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
---
Compile tested in ARM mode only as I could not build for this platform
in Thumb-2 mode:
/scratch_space/linux-2.6/arch/arm/mach-tegra/headsmp.S: Assembler messages:
/scratch_space/linux-2.6/arch/arm/mach-tegra/headsmp.S:51: Error: Thumb encoding does not support an immediate here -- `msr cpsr_fsxc,#0xd3'
---
arch/arm/mach-tegra/hotplug.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index f329404..4fc72d6 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -13,6 +13,7 @@
#include <linux/smp.h>
#include <asm/cacheflush.h>
+#include <asm/system.h>
static inline void cpu_enter_lowpower(void)
{
@@ -60,13 +61,7 @@ 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");
+ wfi();
/*if (pen_release == cpu) {*/
/*
--
1.7.3.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 5/5] ARM: omap4: Kill private do_wfi macro.
2011-09-09 15:26 [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro Nick Bowler
` (3 preceding siblings ...)
2011-09-09 15:26 ` [PATCH 4/5] ARM: tegra: Use wfi macro in platform_do_lowpower Nick Bowler
@ 2011-09-09 15:26 ` Nick Bowler
2011-09-09 17:04 ` Santosh
2011-09-09 15:42 ` [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro Nick Bowler
5 siblings, 1 reply; 10+ messages in thread
From: Nick Bowler @ 2011-09-09 15:26 UTC (permalink / raw)
To: linux-arm-kernel
The do_wfi macro duplicates the functionality of the wfi macro in common
ARM code. Use the common version instead.
Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
---
Compile tested in both ARM and Thumb-2 mode.
---
arch/arm/mach-omap2/include/mach/omap4-common.h | 11 -----------
arch/arm/mach-omap2/omap-hotplug.c | 7 +++----
arch/arm/mach-omap2/pm44xx.c | 4 +++-
3 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/arch/arm/mach-omap2/include/mach/omap4-common.h b/arch/arm/mach-omap2/include/mach/omap4-common.h
index e4bd87619..9e8c214 100644
--- a/arch/arm/mach-omap2/include/mach/omap4-common.h
+++ b/arch/arm/mach-omap2/include/mach/omap4-common.h
@@ -13,17 +13,6 @@
#ifndef OMAP_ARCH_OMAP4_COMMON_H
#define OMAP_ARCH_OMAP4_COMMON_H
-/*
- * wfi used in low power code. Directly opcode is used instead
- * of instruction to avoid mulit-omap build break
- */
-#ifdef CONFIG_THUMB2_KERNEL
-#define do_wfi() __asm__ __volatile__ ("wfi" : : : "memory")
-#else
-#define do_wfi() \
- __asm__ __volatile__ (".word 0xe320f003" : : : "memory")
-#endif
-
#ifdef CONFIG_CACHE_L2X0
extern void __iomem *l2cache_base;
#endif
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index 4976b93..3a43eb8 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -19,6 +19,8 @@
#include <linux/smp.h>
#include <asm/cacheflush.h>
+#include <asm/system.h>
+
#include <mach/omap4-common.h>
int platform_cpu_kill(unsigned int cpu)
@@ -42,10 +44,7 @@ void platform_cpu_die(unsigned int cpu)
printk(KERN_CRIT "Secure clear status failed\n");
for (;;) {
- /*
- * Execute WFI
- */
- do_wfi();
+ wfi();
if (omap_read_auxcoreboot0() == cpu) {
/*
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 59a870b..c741ad7 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -16,6 +16,8 @@
#include <linux/err.h>
#include <linux/slab.h>
+#include <asm/system.h>
+
#include "powerdomain.h"
#include <mach/omap4-common.h>
@@ -33,7 +35,7 @@ static LIST_HEAD(pwrst_list);
#ifdef CONFIG_SUSPEND
static int omap4_pm_suspend(void)
{
- do_wfi();
+ wfi();
return 0;
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro.
2011-09-09 15:26 [PATCH 0/5] Convert ARM subarchitectures to generic wfi macro Nick Bowler
` (4 preceding siblings ...)
2011-09-09 15:26 ` [PATCH 5/5] ARM: omap4: Kill private do_wfi macro Nick Bowler
@ 2011-09-09 15:42 ` Nick Bowler
2011-09-09 19:02 ` Russell King - ARM Linux
5 siblings, 1 reply; 10+ messages in thread
From: Nick Bowler @ 2011-09-09 15:42 UTC (permalink / raw)
To: linux-arm-kernel
And after all that, I forgot to CC Russell on these patches. Oops.
On 2011-09-09 11:26 -0400, Nick Bowler wrote:
> This series cleans up all remaining ARM subarchitectures that I could
> find to use the generic wfi macro. As I don't have any of the boards in
> question, I've only compile-tested these patches to the extent that I
> was able.
>
> See the previous discussion in https://lkml.org/lkml/2011/8/19/433 for
> more background.
>
> Nick Bowler (5):
> ARM: realview: Use wfi macro in platform_do_lowpower.
> ARM: exynos4: Use wfi macro in platform_do_lowpower.
> ARM: shmobile: Use wfi macro in platform_cpu_die.
> ARM: tegra: Use wfi macro in platform_do_lowpower.
> ARM: omap4: Kill private do_wfi macro.
>
> arch/arm/mach-exynos4/hotplug.c | 9 ++-------
> arch/arm/mach-omap2/include/mach/omap4-common.h | 11 -----------
> arch/arm/mach-omap2/omap-hotplug.c | 7 +++----
> arch/arm/mach-omap2/pm44xx.c | 4 +++-
> arch/arm/mach-realview/hotplug.c | 9 ++-------
> arch/arm/mach-shmobile/hotplug.c | 10 +++-------
> arch/arm/mach-tegra/hotplug.c | 9 ++-------
> 7 files changed, 15 insertions(+), 44 deletions(-)
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
^ permalink raw reply [flat|nested] 10+ messages in thread