aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2016-06-29 08:51:29 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2016-07-01 06:56:27 -0400
commit4133af6c0419b5a2a4da245ff7af7ceca7fd740d (patch)
tree8dec3ba9354752da09b3ea990a7bd2b981bcf051
parent74c102c988cd48fff8055a0bfb84234fd3509419 (diff)
arm64: mm: Remove split_p*d() functions
Since the efi_create_mapping() no longer generates block mappings and being the last user of the split_p*d code, remove these functions and the corresponding TLBI. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> [ardb: replace 'overlapping regions' with 'block mappings' in commit log] Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/mm/mmu.c47
1 files changed, 4 insertions, 43 deletions
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index a289d66121b6..9d2d7cfb95b4 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -96,24 +96,6 @@ static phys_addr_t __init early_pgtable_alloc(void)
96 return phys; 96 return phys;
97} 97}
98 98
99/*
100 * remap a PMD into pages
101 */
102static void split_pmd(pmd_t *pmd, pte_t *pte)
103{
104 unsigned long pfn = pmd_pfn(*pmd);
105 int i = 0;
106
107 do {
108 /*
109 * Need to have the least restrictive permissions available
110 * permissions will be fixed up later
111 */
112 set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC));
113 pfn++;
114 } while (pte++, i++, i < PTRS_PER_PTE);
115}
116
117static void alloc_init_pte(pmd_t *pmd, unsigned long addr, 99static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
118 unsigned long end, unsigned long pfn, 100 unsigned long end, unsigned long pfn,
119 pgprot_t prot, 101 pgprot_t prot,
@@ -121,15 +103,13 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
121{ 103{
122 pte_t *pte; 104 pte_t *pte;
123 105
124 if (pmd_none(*pmd) || pmd_sect(*pmd)) { 106 BUG_ON(pmd_sect(*pmd));
107 if (pmd_none(*pmd)) {
125 phys_addr_t pte_phys; 108 phys_addr_t pte_phys;
126 BUG_ON(!pgtable_alloc); 109 BUG_ON(!pgtable_alloc);
127 pte_phys = pgtable_alloc(); 110 pte_phys = pgtable_alloc();
128 pte = pte_set_fixmap(pte_phys); 111 pte = pte_set_fixmap(pte_phys);
129 if (pmd_sect(*pmd))
130 split_pmd(pmd, pte);
131 __pmd_populate(pmd, pte_phys, PMD_TYPE_TABLE); 112 __pmd_populate(pmd, pte_phys, PMD_TYPE_TABLE);
132 flush_tlb_all();
133 pte_clear_fixmap(); 113 pte_clear_fixmap();
134 } 114 }
135 BUG_ON(pmd_bad(*pmd)); 115 BUG_ON(pmd_bad(*pmd));
@@ -143,18 +123,6 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
143 pte_clear_fixmap(); 123 pte_clear_fixmap();
144} 124}
145 125
146static void split_pud(pud_t *old_pud, pmd_t *pmd)
147{
148 unsigned long addr = pud_pfn(*old_pud) << PAGE_SHIFT;
149 pgprot_t prot = __pgprot(pud_val(*old_pud) ^ addr);
150 int i = 0;
151
152 do {
153 set_pmd(pmd, __pmd(addr | pgprot_val(prot)));
154 addr += PMD_SIZE;
155 } while (pmd++, i++, i < PTRS_PER_PMD);
156}
157
158static void alloc_init_pmd(pud_t *pud, unsigned long addr, unsigned long end, 126static void alloc_init_pmd(pud_t *pud, unsigned long addr, unsigned long end,
159 phys_addr_t phys, pgprot_t prot, 127 phys_addr_t phys, pgprot_t prot,
160 phys_addr_t (*pgtable_alloc)(void), 128 phys_addr_t (*pgtable_alloc)(void),
@@ -166,20 +134,13 @@ static void alloc_init_pmd(pud_t *pud, unsigned long addr, unsigned long end,
166 /* 134 /*
167 * Check for initial section mappings in the pgd/pud and remove them. 135 * Check for initial section mappings in the pgd/pud and remove them.
168 */ 136 */
169 if (pud_none(*pud) || pud_sect(*pud)) { 137 BUG_ON(pud_sect(*pud));
138 if (pud_none(*pud)) {
170 phys_addr_t pmd_phys; 139 phys_addr_t pmd_phys;
171 BUG_ON(!pgtable_alloc); 140 BUG_ON(!pgtable_alloc);
172 pmd_phys = pgtable_alloc(); 141 pmd_phys = pgtable_alloc();
173 pmd = pmd_set_fixmap(pmd_phys); 142 pmd = pmd_set_fixmap(pmd_phys);
174 if (pud_sect(*pud)) {
175 /*
176 * need to have the 1G of mappings continue to be
177 * present
178 */
179 split_pud(pud, pmd);
180 }
181 __pud_populate(pud, pmd_phys, PUD_TYPE_TABLE); 143 __pud_populate(pud, pmd_phys, PUD_TYPE_TABLE);
182 flush_tlb_all();
183 pmd_clear_fixmap(); 144 pmd_clear_fixmap();
184 } 145 }
185 BUG_ON(pud_bad(*pud)); 146 BUG_ON(pud_bad(*pud));