diff options
author | Will Deacon <will.deacon@arm.com> | 2011-11-23 07:26:25 -0500 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2011-12-06 09:04:15 -0500 |
commit | 4e8ee7de227e3ab9a72040b448ad728c5428a042 (patch) | |
tree | ffaf8492fd359d3281a55ff6e751504e905cc27c /arch/arm/mm | |
parent | 72662e01088394577be4a3f14da94cf87bea2591 (diff) |
ARM: SMP: use idmap_pgd for mapping MMU enable during secondary booting
The ARM SMP booting code allocates a temporary set of page tables
containing an identity mapping of the kernel image and provides this
to secondary CPUs for initial booting.
In reality, we only need to include the __turn_mmu_on function in the
identity mapping since the rest of the kernel is executing from virtual
addresses after this point.
This patch adds __turn_mmu_on to the .idmap.text section, allowing the
SMP booting code to use the idmap_pgd directly and not have to populate
its own set of page table.
As a result of this patch, we can make the identity_mapping_add function
static (since it is only used within mm/idmap.c) and also remove the
identity_mapping_del function. The identity map population is moved to
an early initcall so that it is setup in time for secondary CPU bringup.
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.c | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c index b01760e6da18..660f1bc68f99 100644 --- a/arch/arm/mm/idmap.c +++ b/arch/arm/mm/idmap.c | |||
@@ -32,7 +32,7 @@ static void idmap_add_pud(pgd_t *pgd, unsigned long addr, unsigned long end, | |||
32 | } while (pud++, addr = next, addr != end); | 32 | } while (pud++, addr = next, addr != end); |
33 | } | 33 | } |
34 | 34 | ||
35 | void identity_mapping_add(pgd_t *pgd, unsigned long addr, unsigned long end) | 35 | static void identity_mapping_add(pgd_t *pgd, unsigned long addr, unsigned long end) |
36 | { | 36 | { |
37 | unsigned long prot, next; | 37 | unsigned long prot, next; |
38 | 38 | ||
@@ -47,36 +47,6 @@ void identity_mapping_add(pgd_t *pgd, unsigned long addr, unsigned long end) | |||
47 | } while (pgd++, addr = next, addr != end); | 47 | } while (pgd++, addr = next, addr != end); |
48 | } | 48 | } |
49 | 49 | ||
50 | #ifdef CONFIG_SMP | ||
51 | static void idmap_del_pmd(pud_t *pud, unsigned long addr, unsigned long end) | ||
52 | { | ||
53 | pmd_t *pmd = pmd_offset(pud, addr); | ||
54 | pmd_clear(pmd); | ||
55 | } | ||
56 | |||
57 | static void idmap_del_pud(pgd_t *pgd, unsigned long addr, unsigned long end) | ||
58 | { | ||
59 | pud_t *pud = pud_offset(pgd, addr); | ||
60 | unsigned long next; | ||
61 | |||
62 | do { | ||
63 | next = pud_addr_end(addr, end); | ||
64 | idmap_del_pmd(pud, addr, next); | ||
65 | } while (pud++, addr = next, addr != end); | ||
66 | } | ||
67 | |||
68 | void identity_mapping_del(pgd_t *pgd, unsigned long addr, unsigned long end) | ||
69 | { | ||
70 | unsigned long next; | ||
71 | |||
72 | pgd += pgd_index(addr); | ||
73 | do { | ||
74 | next = pgd_addr_end(addr, end); | ||
75 | idmap_del_pud(pgd, addr, next); | ||
76 | } while (pgd++, addr = next, addr != end); | ||
77 | } | ||
78 | #endif | ||
79 | |||
80 | extern char __idmap_text_start[], __idmap_text_end[]; | 50 | extern char __idmap_text_start[], __idmap_text_end[]; |
81 | 51 | ||
82 | static int __init init_static_idmap(void) | 52 | static int __init init_static_idmap(void) |
@@ -97,7 +67,7 @@ static int __init init_static_idmap(void) | |||
97 | 67 | ||
98 | return 0; | 68 | return 0; |
99 | } | 69 | } |
100 | arch_initcall(init_static_idmap); | 70 | early_initcall(init_static_idmap); |
101 | 71 | ||
102 | /* | 72 | /* |
103 | * In order to soft-boot, we need to switch to a 1:1 mapping for the | 73 | * In order to soft-boot, we need to switch to a 1:1 mapping for the |