aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2012-09-07 01:36:57 -0400
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2012-09-25 06:20:26 -0400
commitdbee0c6fb4c1269b2dfc8b0b7a29907ea7fed560 (patch)
tree893b25918fea5ebb4016ffda4d6d8dc185b7c7ba /arch
parent3287be8c4e2bd91211b3947ba726d95e8a1092b5 (diff)
ARM: kernel: update cpu_suspend code to use cache LoUIS operations
In processors like A15/A7 L2 cache is unified and integrated within the processor cache hierarchy, so that it is not considered an outer cache anymore. For processors like A15/A7 flush_cache_all() ends up cleaning all cache levels up to Level of Coherency (LoC) that includes the L2 unified cache. When a single CPU is suspended (CPU idle) a complete L2 clean is not required, so generic cpu_suspend code must clean the data cache using the newly introduced cache LoUIS function. The context and stack pointer (context pointer) are cleaned to main memory using cache area functions that operate on MVA and guarantee that the data is written back to main memory (perform cache cleaning up to the Point of Coherency - PoC) so that the processor can fetch the context when the MMU is off in the cpu_resume code path. outer_cache management remains unchanged. Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Reviewed-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Tested-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/suspend.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
index 1794cc3b0f18..358bca3a995e 100644
--- a/arch/arm/kernel/suspend.c
+++ b/arch/arm/kernel/suspend.c
@@ -17,6 +17,8 @@ extern void cpu_resume_mmu(void);
17 */ 17 */
18void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr) 18void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr)
19{ 19{
20 u32 *ctx = ptr;
21
20 *save_ptr = virt_to_phys(ptr); 22 *save_ptr = virt_to_phys(ptr);
21 23
22 /* This must correspond to the LDM in cpu_resume() assembly */ 24 /* This must correspond to the LDM in cpu_resume() assembly */
@@ -26,7 +28,20 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr)
26 28
27 cpu_do_suspend(ptr); 29 cpu_do_suspend(ptr);
28 30
29 flush_cache_all(); 31 flush_cache_louis();
32
33 /*
34 * flush_cache_louis does not guarantee that
35 * save_ptr and ptr are cleaned to main memory,
36 * just up to the Level of Unification Inner Shareable.
37 * Since the context pointer and context itself
38 * are to be retrieved with the MMU off that
39 * data must be cleaned from all cache levels
40 * to main memory using "area" cache primitives.
41 */
42 __cpuc_flush_dcache_area(ctx, ptrsz);
43 __cpuc_flush_dcache_area(save_ptr, sizeof(*save_ptr));
44
30 outer_clean_range(*save_ptr, *save_ptr + ptrsz); 45 outer_clean_range(*save_ptr, *save_ptr + ptrsz);
31 outer_clean_range(virt_to_phys(save_ptr), 46 outer_clean_range(virt_to_phys(save_ptr),
32 virt_to_phys(save_ptr) + sizeof(*save_ptr)); 47 virt_to_phys(save_ptr) + sizeof(*save_ptr));