• Mark Rutland's avatar
    arm64: mm: specialise pagetable allocators · 21ab99c2
    Mark Rutland authored
    We pass a size parameter to early_alloc and late_alloc, but these are
    only ever used to allocate single pages. In late_alloc we always
    allocate a single page.
    
    Both allocators provide us with zeroed pages (such that all entries are
    invalid), but we have no barriers between allocating a page and adding
    that page to existing (live) tables. A concurrent page table walk may
    see stale data, leading to a number of issues.
    
    This patch specialises the two allocators for page tables. The size
    parameter is removed and the necessary dsb(ishst) is folded into each.
    To make it clear that the functions are intended for use for page table
    allocation, they are renamed to {early,late}_pgtable_alloc, with the
    related function pointed renamed to pgtable_alloc.
    
    As the dsb(ishst) is now in the allocator, the existing barrier for the
    zero page is redundant and thus is removed. The previously missing
    include of barrier.h is added.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Reviewed-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Tested-by: default avatarJeremy Linton <jeremy.linton@arm.com>
    Cc: Laura Abbott <labbott@fedoraproject.org>
    Cc: Will Deacon <will.deacon@arm.com>
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    21ab99c2
mmu.c 17.8 KB