Skip to content

Commit 6509dc7

Browse files
tpetazzoniJason Cooper
authored andcommitted
ARM: mvebu: fix cpuidle implementation to work on big-endian systems
On Marvell Armada XP, when a CPU comes back from deep idle state of cpuidle, it restarts its execution at armada_370_xp_cpu_resume(), which puts back the CPU into the coherency, and then calls the generic cpu_resume() function. While this works on little-endian configurations, it doesn't work on big-endian configurations because the CPU restarts in little-endian, and therefore must be switched back to big-endian to operate properly. To achieve this, a 'setend be' instruction must be executed in big-endian configurations. However, the ARM_BE8() macro that is used to implement nice compile-time conditional for ARM LE vs. ARM BE8 is not easily usable in inline assembly. Therefore, this patch moves the armada_370_xp_cpu_resume() C function, which was anyway just a block of inline assembly, into a proper pmsu_ll.S file, and adds the appropriate ARM_BE8(setend be) instruction. Without this patch, an Armada XP big endian configuration with cpuidle enabled fails to boot, as it hangs as soon as one of the CPU hits the deep idle state. Signed-off-by: Thomas Petazzoni <[email protected]> Link: https://lkml.kernel.org/r/1404130165-3593-1-git-send-email-thomas.petazzoni@free-electrons.com Signed-off-by: Jason Cooper <[email protected]>
1 parent 0117889 commit 6509dc7

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

arch/arm/mach-mvebu/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CFLAGS_pmsu.o := -march=armv7-a
77
obj-y += system-controller.o mvebu-soc-id.o
88

99
ifeq ($(CONFIG_MACH_MVEBU_V7),y)
10-
obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o
10+
obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o pmsu_ll.o
1111
obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o
1212
obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
1313
endif

arch/arm/mach-mvebu/pmsu.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static void __iomem *pmsu_mp_base;
6666
extern void ll_disable_coherency(void);
6767
extern void ll_enable_coherency(void);
6868

69+
extern void armada_370_xp_cpu_resume(void);
70+
6971
static struct platform_device armada_xp_cpuidle_device = {
7072
.name = "cpuidle-armada-370-xp",
7173
};
@@ -140,13 +142,6 @@ static void armada_370_xp_pmsu_enable_l2_powerdown_onidle(void)
140142
writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL);
141143
}
142144

143-
static void armada_370_xp_cpu_resume(void)
144-
{
145-
asm volatile("bl ll_add_cpu_to_smp_group\n\t"
146-
"bl ll_enable_coherency\n\t"
147-
"b cpu_resume\n\t");
148-
}
149-
150145
/* No locking is needed because we only access per-CPU registers */
151146
void armada_370_xp_pmsu_idle_prepare(bool deepidle)
152147
{

arch/arm/mach-mvebu/pmsu_ll.S

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (C) 2014 Marvell
3+
*
4+
* Thomas Petazzoni <[email protected]>
5+
* Gregory Clement <[email protected]>
6+
*
7+
* This file is licensed under the terms of the GNU General Public
8+
* License version 2. This program is licensed "as is" without any
9+
* warranty of any kind, whether express or implied.
10+
*/
11+
12+
#include <linux/linkage.h>
13+
#include <asm/assembler.h>
14+
15+
/*
16+
* This is the entry point through which CPUs exiting cpuidle deep
17+
* idle state are going.
18+
*/
19+
ENTRY(armada_370_xp_cpu_resume)
20+
ARM_BE8(setend be ) @ go BE8 if entered LE
21+
bl ll_add_cpu_to_smp_group
22+
bl ll_enable_coherency
23+
b cpu_resume
24+
ENDPROC(armada_370_xp_cpu_resume)
25+

0 commit comments

Comments
 (0)