aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2011-06-08 10:53:34 -0400
committerWill Deacon <will.deacon@arm.com>2011-12-06 09:04:15 -0500
commit2c8951ab0c337cb198236df07ad55f9dd4892c26 (patch)
treecfbc338f1d2b9642af2036dffd9fbf76024d2732 /arch/arm/mm
parent1a4baafa7d203da1cceb302c2df38f0fea1c17a1 (diff)
ARM: idmap: use idmap_pgd when setting up mm for reboot
For soft-rebooting a system, it is necessary to map the MMU-off code with an identity mapping so that execution can continue safely once the MMU has been switched off. Currently, switch_mm_for_reboot takes out a 1:1 mapping from 0x0 to TASK_SIZE during reboot in the hope that the reset code lives at a physical address corresponding to a userspace virtual address. This patch modifies the code so that we switch to the idmap_pgd tables, which contain a 1:1 mapping of the cpu_reset code. This has the advantage of only remapping the code that we need and also means we don't need to worry about allocating a pgd from an atomic context in the case that the physical address of the cpu_reset code aliases with the virtual space used by the kernel. Acked-by: Dave Martin <dave.martin@linaro.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/idmap.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index cda5ea3157a7..b01760e6da18 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -100,17 +100,18 @@ static int __init init_static_idmap(void)
100arch_initcall(init_static_idmap); 100arch_initcall(init_static_idmap);
101 101
102/* 102/*
103 * In order to soft-boot, we need to insert a 1:1 mapping in place of 103 * In order to soft-boot, we need to switch to a 1:1 mapping for the
104 * the user-mode pages. This will then ensure that we have predictable 104 * cpu_reset functions. This will then ensure that we have predictable
105 * results when turning the mmu off 105 * results when turning off the mmu.
106 */ 106 */
107void setup_mm_for_reboot(void) 107void setup_mm_for_reboot(void)
108{ 108{
109 /* 109 /* Clean and invalidate L1. */
110 * We need to access to user-mode page tables here. For kernel threads 110 flush_cache_all();
111 * we don't have any user-mode mappings so we use the context that we 111
112 * "borrowed". 112 /* Switch to the identity mapping. */
113 */ 113 cpu_switch_mm(idmap_pgd, &init_mm);
114 identity_mapping_add(current->active_mm->pgd, 0, TASK_SIZE); 114
115 /* Flush the TLB. */
115 local_flush_tlb_all(); 116 local_flush_tlb_all();
116} 117}