Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+4 -43
+4 -43
arch/arm64/mm/mmu.c
··· 96 96 return phys; 97 97 } 98 98 99 - /* 100 - * remap a PMD into pages 101 - */ 102 - static 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 - 117 99 static void alloc_init_pte(pmd_t *pmd, unsigned long addr, 118 100 unsigned long end, unsigned long pfn, 119 101 pgprot_t prot, ··· 103 121 { 104 122 pte_t *pte; 105 123 106 - if (pmd_none(*pmd) || pmd_sect(*pmd)) { 124 + BUG_ON(pmd_sect(*pmd)); 125 + if (pmd_none(*pmd)) { 107 126 phys_addr_t pte_phys; 108 127 BUG_ON(!pgtable_alloc); 109 128 pte_phys = pgtable_alloc(); 110 129 pte = pte_set_fixmap(pte_phys); 111 - if (pmd_sect(*pmd)) 112 - split_pmd(pmd, pte); 113 130 __pmd_populate(pmd, pte_phys, PMD_TYPE_TABLE); 114 - flush_tlb_all(); 115 131 pte_clear_fixmap(); 116 132 } 117 133 BUG_ON(pmd_bad(*pmd)); ··· 123 143 pte_clear_fixmap(); 124 144 } 125 145 126 - static void split_pud(pud_t *old_pud, pmd_t *pmd) 127 - { 128 - unsigned long addr = pud_pfn(*old_pud) << PAGE_SHIFT; 129 - pgprot_t prot = __pgprot(pud_val(*old_pud) ^ addr); 130 - int i = 0; 131 - 132 - do { 133 - set_pmd(pmd, __pmd(addr | pgprot_val(prot))); 134 - addr += PMD_SIZE; 135 - } while (pmd++, i++, i < PTRS_PER_PMD); 136 - } 137 - 138 146 static void alloc_init_pmd(pud_t *pud, unsigned long addr, unsigned long end, 139 147 phys_addr_t phys, pgprot_t prot, 140 148 phys_addr_t (*pgtable_alloc)(void), ··· 134 166 /* 135 167 * Check for initial section mappings in the pgd/pud and remove them. 136 168 */ 137 - if (pud_none(*pud) || pud_sect(*pud)) { 169 + BUG_ON(pud_sect(*pud)); 170 + if (pud_none(*pud)) { 138 171 phys_addr_t pmd_phys; 139 172 BUG_ON(!pgtable_alloc); 140 173 pmd_phys = pgtable_alloc(); 141 174 pmd = pmd_set_fixmap(pmd_phys); 142 - if (pud_sect(*pud)) { 143 - /* 144 - * need to have the 1G of mappings continue to be 145 - * present 146 - */ 147 - split_pud(pud, pmd); 148 - } 149 175 __pud_populate(pud, pmd_phys, PUD_TYPE_TABLE); 150 - flush_tlb_all(); 151 176 pmd_clear_fixmap(); 152 177 } 153 178 BUG_ON(pud_bad(*pud));