diff options
author | Alexandre Ghiti <alexghiti@rivosinc.com> | 2023-12-13 21:29:59 +0100 |
---|---|---|
committer | Palmer Dabbelt <palmer@rivosinc.com> | 2023-12-20 19:48:13 +0100 |
commit | eba2591d99d1f14a04c8a8a845ab0795b93f5646 (patch) | |
tree | 3cf33861700ea727208efc0a175d181fe10df5f4 /arch/arm | |
parent | riscv: Use WRITE_ONCE() when setting page table entries (diff) | |
download | linux-eba2591d99d1f14a04c8a8a845ab0795b93f5646.tar.xz linux-eba2591d99d1f14a04c8a8a845ab0795b93f5646.zip |
mm: Introduce pudp/p4dp/pgdp_get() functions
Instead of directly dereferencing page tables entries, which can cause
issues (see commit 20a004e7b017 ("arm64: mm: Use READ_ONCE/WRITE_ONCE when
accessing page tables"), let's introduce new functions to get the
pud/p4d/pgd entries (the pte and pmd versions already exist).
Note that arm pgd_t is actually an array so pgdp_get() is defined as a
macro to avoid a build error.
Those new functions will be used in subsequent commits by the riscv
architecture.
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20231213203001.179237-3-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 16b02f44c7d3..d657b84b6bf7 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -151,6 +151,8 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; +#define pgdp_get(pgpd) READ_ONCE(*pgdp) + #define pud_page(pud) pmd_page(__pmd(pud_val(pud))) #define pud_write(pud) pmd_write(__pmd(pud_val(pud))) |