From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] ARM: idmap: use idmap_pgd when setting up mm for reboot
Date: Wed, 16 Nov 2011 16:48:14 +0000 [thread overview]
Message-ID: <1321462094-6647-5-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1321462094-6647-1-git-send-email-will.deacon@arm.com>
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.
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
arch/arm/mm/idmap.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index 8c1230a..0f96fb2 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -104,17 +104,18 @@ static int __init init_static_idmap(void)
arch_initcall(init_static_idmap);
/*
- * In order to soft-boot, we need to insert a 1:1 mapping in place of
- * the user-mode pages. This will then ensure that we have predictable
- * results when turning the mmu off
+ * In order to soft-boot, we need to switch to a 1:1 mapping for the
+ * cpu_reset functions. This will then ensure that we have predictable
+ * results when turning off the mmu.
*/
void setup_mm_for_reboot(char mode)
{
- /*
- * We need to access to user-mode page tables here. For kernel threads
- * we don't have any user-mode mappings so we use the context that we
- * "borrowed".
- */
- identity_mapping_add(current->active_mm->pgd, 0, TASK_SIZE);
+ /* Clean and invalidate L1. */
+ flush_cache_all();
+
+ /* Switch exclusively to kernel mappings. */
+ cpu_switch_mm(idmap_pgd, &init_mm);
+
+ /* Flush the TLB. */
local_flush_tlb_all();
}
--
1.7.4.1
next prev parent reply other threads:[~2011-11-16 16:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 16:48 [PATCH 0/4] Consolidate identity mapping code in idmap.c Will Deacon
2011-11-16 16:48 ` [PATCH 1/4] ARM: idmap: populate identity map pgd at init time using .init.text Will Deacon
2011-11-18 12:02 ` Catalin Marinas
2011-11-18 12:08 ` Will Deacon
2011-11-16 16:48 ` [PATCH 2/4] ARM: suspend: use idmap_pgd instead of suspend_pgd Will Deacon
2011-11-18 16:43 ` Catalin Marinas
2011-11-18 17:26 ` Will Deacon
2011-11-16 16:48 ` [PATCH 3/4] ARM: proc-*.S: place cpu_reset functions into .idmap.text section Will Deacon
2011-11-16 16:48 ` Will Deacon [this message]
2011-11-18 16:56 ` [PATCH 4/4] ARM: idmap: use idmap_pgd when setting up mm for reboot Catalin Marinas
2011-11-18 17:21 ` Will Deacon
2011-11-17 13:47 ` [PATCH 0/4] Consolidate identity mapping code in idmap.c Dave Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1321462094-6647-5-git-send-email-will.deacon@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox