1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
Date: Wed, 1 Feb 2012 10:00:00 +0100
Subject: [PATCH] ARM: v7m: add trivial suspend support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/arm/Kconfig | 2 +-
arch/arm/kernel/suspend.c | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d788fd6..cecc416 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2215,7 +2215,7 @@ source "kernel/power/Kconfig"
config ARCH_SUSPEND_POSSIBLE
depends on !ARCH_S5PC100
depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \
- CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK
+ CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK || CPU_V7M
def_bool y
config ARM_CPU_SUSPEND
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
index 41cf3cb..0cceeb3 100644
--- a/arch/arm/kernel/suspend.c
+++ b/arch/arm/kernel/suspend.c
@@ -20,11 +20,13 @@ extern void cpu_resume_mmu(void);
*/
int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
{
- struct mm_struct *mm = current->active_mm;
int ret;
+#ifdef CONFIG_MMU
+ struct mm_struct *mm = current->active_mm;
if (!idmap_pgd)
return -EINVAL;
+#endif
/*
* Provide a temporary page table with an identity mapping for
@@ -33,11 +35,13 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
* back to the correct page tables.
*/
ret = __cpu_suspend(arg, fn);
+#ifdef CONFIG_MMU
if (ret == 0) {
cpu_switch_mm(mm->pgd, mm);
local_flush_bp_all();
local_flush_tlb_all();
}
+#endif
return ret;
}
@@ -61,7 +65,11 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr)
*save_ptr = virt_to_phys(ptr);
/* This must correspond to the LDM in cpu_resume() assembly */
+#ifdef CONFIG_MMU
*ptr++ = virt_to_phys(idmap_pgd);
+#else
+ *ptr++ = 0;
+#endif
*ptr++ = sp;
*ptr++ = virt_to_phys(cpu_do_resume);
|