aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-08-28 05:30:34 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-09-20 18:33:40 -0400
commit1aede681ac159884c77817d33230eed9185b6f6c (patch)
tree137427c7bc0e40151d43e79f92ec70b914171254 /arch/arm/mm
parentde8e71ca4f2e17329f6718ae88d5c8336cb249ee (diff)
ARM: pm: no need to save/restore context ID register
There is no need to save and restore the context ID register on ARMv6 and ARMv7 with a temporary page table as we write the context ID register when we switch back to the real page tables for the thread. Moreover, the temporary page tables do not contain any non-global mappings, so the context ID value should not be used. To be safe, initialize the register to a reserved context ID value. Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Tested-by: Shawn Guo <shawn.guo@linaro.org> Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/proc-v6.S33
-rw-r--r--arch/arm/mm/proc-v7.S13
2 files changed, 22 insertions, 24 deletions
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 2e27b467c6a6..d061d2fa5506 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -128,19 +128,18 @@ ENTRY(cpu_v6_set_pte_ext)
128 128
129/* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */ 129/* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */
130.globl cpu_v6_suspend_size 130.globl cpu_v6_suspend_size
131.equ cpu_v6_suspend_size, 4 * 7 131.equ cpu_v6_suspend_size, 4 * 6
132#ifdef CONFIG_PM_SLEEP 132#ifdef CONFIG_PM_SLEEP
133ENTRY(cpu_v6_do_suspend) 133ENTRY(cpu_v6_do_suspend)
134 stmfd sp!, {r4 - r10, lr} 134 stmfd sp!, {r4 - r9, lr}
135 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 135 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
136 mrc p15, 0, r5, c13, c0, 1 @ Context ID 136 mrc p15, 0, r5, c3, c0, 0 @ Domain ID
137 mrc p15, 0, r6, c3, c0, 0 @ Domain ID 137 mrc p15, 0, r6, c2, c0, 1 @ Translation table base 1
138 mrc p15, 0, r7, c2, c0, 1 @ Translation table base 1 138 mrc p15, 0, r7, c1, c0, 1 @ auxiliary control register
139 mrc p15, 0, r8, c1, c0, 1 @ auxiliary control register 139 mrc p15, 0, r8, c1, c0, 2 @ co-processor access control
140 mrc p15, 0, r9, c1, c0, 2 @ co-processor access control 140 mrc p15, 0, r9, c1, c0, 0 @ control register
141 mrc p15, 0, r10, c1, c0, 0 @ control register 141 stmia r0, {r4 - r9}
142 stmia r0, {r4 - r10} 142 ldmfd sp!, {r4- r9, pc}
143 ldmfd sp!, {r4- r10, pc}
144ENDPROC(cpu_v6_do_suspend) 143ENDPROC(cpu_v6_do_suspend)
145 144
146ENTRY(cpu_v6_do_resume) 145ENTRY(cpu_v6_do_resume)
@@ -149,19 +148,19 @@ ENTRY(cpu_v6_do_resume)
149 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 148 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
150 mcr p15, 0, ip, c7, c15, 0 @ clean+invalidate cache 149 mcr p15, 0, ip, c7, c15, 0 @ clean+invalidate cache
151 mcr p15, 0, ip, c7, c10, 4 @ drain write buffer 150 mcr p15, 0, ip, c7, c10, 4 @ drain write buffer
152 ldmia r0, {r4 - r10} 151 mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID
152 ldmia r0, {r4 - r9}
153 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID 153 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
154 mcr p15, 0, r5, c13, c0, 1 @ Context ID 154 mcr p15, 0, r5, c3, c0, 0 @ Domain ID
155 mcr p15, 0, r6, c3, c0, 0 @ Domain ID
156 ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP) 155 ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP)
157 ALT_UP(orr r1, r1, #TTB_FLAGS_UP) 156 ALT_UP(orr r1, r1, #TTB_FLAGS_UP)
158 mcr p15, 0, r1, c2, c0, 0 @ Translation table base 0 157 mcr p15, 0, r1, c2, c0, 0 @ Translation table base 0
159 mcr p15, 0, r7, c2, c0, 1 @ Translation table base 1 158 mcr p15, 0, r6, c2, c0, 1 @ Translation table base 1
160 mcr p15, 0, r8, c1, c0, 1 @ auxiliary control register 159 mcr p15, 0, r7, c1, c0, 1 @ auxiliary control register
161 mcr p15, 0, r9, c1, c0, 2 @ co-processor access control 160 mcr p15, 0, r8, c1, c0, 2 @ co-processor access control
162 mcr p15, 0, ip, c2, c0, 2 @ TTB control register 161 mcr p15, 0, ip, c2, c0, 2 @ TTB control register
163 mcr p15, 0, ip, c7, c5, 4 @ ISB 162 mcr p15, 0, ip, c7, c5, 4 @ ISB
164 mov r0, r10 @ control register 163 mov r0, r9 @ control register
165 b cpu_resume_mmu 164 b cpu_resume_mmu
166ENDPROC(cpu_v6_do_resume) 165ENDPROC(cpu_v6_do_resume)
167#endif 166#endif
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index b56004f90d93..6af366ce0165 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -217,14 +217,13 @@ ENDPROC(cpu_v7_set_pte_ext)
217 217
218/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ 218/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */
219.globl cpu_v7_suspend_size 219.globl cpu_v7_suspend_size
220.equ cpu_v7_suspend_size, 4 * 8 220.equ cpu_v7_suspend_size, 4 * 7
221#ifdef CONFIG_PM_SLEEP 221#ifdef CONFIG_PM_SLEEP
222ENTRY(cpu_v7_do_suspend) 222ENTRY(cpu_v7_do_suspend)
223 stmfd sp!, {r4 - r10, lr} 223 stmfd sp!, {r4 - r10, lr}
224 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 224 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
225 mrc p15, 0, r5, c13, c0, 1 @ Context ID 225 mrc p15, 0, r5, c13, c0, 3 @ User r/o thread ID
226 mrc p15, 0, r6, c13, c0, 3 @ User r/o thread ID 226 stmia r0!, {r4 - r5}
227 stmia r0!, {r4 - r6}
228 mrc p15, 0, r6, c3, c0, 0 @ Domain ID 227 mrc p15, 0, r6, c3, c0, 0 @ Domain ID
229 mrc p15, 0, r7, c2, c0, 1 @ TTB 1 228 mrc p15, 0, r7, c2, c0, 1 @ TTB 1
230 mrc p15, 0, r8, c1, c0, 0 @ Control register 229 mrc p15, 0, r8, c1, c0, 0 @ Control register
@@ -238,10 +237,10 @@ ENTRY(cpu_v7_do_resume)
238 mov ip, #0 237 mov ip, #0
239 mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs 238 mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs
240 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 239 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
241 ldmia r0!, {r4 - r6} 240 mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID
241 ldmia r0!, {r4 - r5}
242 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID 242 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
243 mcr p15, 0, r5, c13, c0, 1 @ Context ID 243 mcr p15, 0, r5, c13, c0, 3 @ User r/o thread ID
244 mcr p15, 0, r6, c13, c0, 3 @ User r/o thread ID
245 ldmia r0, {r6 - r10} 244 ldmia r0, {r6 - r10}
246 mcr p15, 0, r6, c3, c0, 0 @ Domain ID 245 mcr p15, 0, r6, c3, c0, 0 @ Domain ID
247 ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP) 246 ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP)