Skip to content

Commit 2426266

Browse files
mrutland-armAlex Shi
authored andcommitted
arm64: consistently use p?d_set_huge
Commit 324420bf91f60582 ("arm64: add support for ioremap() block mappings") added new p?d_set_huge functions which do the hard work to generate and set a correct block entry. These differ from open-coded huge page creation in the early page table code by explicitly setting the P?D_TYPE_SECT bits (which are implicitly retained by mk_sect_prot() for any valid prot), but are otherwise identical (and cannot fail on arm64). For simplicity and consistency, make use of these in the initial page table creation code. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit c661cb1c537e2364bfdabb298fb934fd77445e98) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent f2971e0 commit 2426266

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

arch/arm64/mm/mmu.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ static void alloc_init_pmd(pud_t *pud, unsigned long addr, unsigned long end,
211211
if (((addr | next | phys) & ~SECTION_MASK) == 0 &&
212212
block_mappings_allowed(pgtable_alloc)) {
213213
pmd_t old_pmd =*pmd;
214-
set_pmd(pmd, __pmd(phys |
215-
pgprot_val(mk_sect_prot(prot))));
214+
pmd_set_huge(pmd, phys, prot);
216215
/*
217216
* Check for previous table entries created during
218217
* boot (__create_page_tables) and flush them.
@@ -272,8 +271,7 @@ static void alloc_init_pud(pgd_t *pgd, unsigned long addr, unsigned long end,
272271
if (use_1G_block(addr, next, phys) &&
273272
block_mappings_allowed(pgtable_alloc)) {
274273
pud_t old_pud = *pud;
275-
set_pud(pud, __pud(phys |
276-
pgprot_val(mk_sect_prot(prot))));
274+
pud_set_huge(pud, phys, prot);
277275

278276
/*
279277
* If we have an old value for a pud, it will

0 commit comments

Comments
 (0)