diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2023-09-25 20:31:33 +0200 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-10-19 17:12:45 +1100 |
commit | 799d8836a7c4f4327833e4a5ca952a1700acdb14 (patch) | |
tree | 6062e0f28206a4e19a65b15d13d7d4e922811461 /arch/powerpc/include/asm/nohash/pgtable.h | |
parent | 2ef9f4bb9c47ed30ff3c7961744cae545c034154 (diff) | |
download | lwn-799d8836a7c4f4327833e4a5ca952a1700acdb14.tar.gz lwn-799d8836a7c4f4327833e4a5ca952a1700acdb14.zip |
powerpc/nohash: Refactor __ptep_set_access_flags()
nohash/32 version of __ptep_set_access_flags() does the same
as nohash/64 version, the only difference is that nohash/32
version is more complete and uses pte_update().
Make it common and remove the nohash/64 version.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/e296885df46289d3e5f4cb51efeefe593f76ef24.1695659959.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/include/asm/nohash/pgtable.h')
-rw-r--r-- | arch/powerpc/include/asm/nohash/pgtable.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h index b974d1ab8a97..c5f21eda2a43 100644 --- a/arch/powerpc/include/asm/nohash/pgtable.h +++ b/arch/powerpc/include/asm/nohash/pgtable.h @@ -101,6 +101,23 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt pte_update(mm, addr, ptep, ~0UL, 0, 0); } +/* Set the dirty and/or accessed bits atomically in a linux PTE */ +#ifndef __ptep_set_access_flags +static inline void __ptep_set_access_flags(struct vm_area_struct *vma, + pte_t *ptep, pte_t entry, + unsigned long address, + int psize) +{ + unsigned long set = pte_val(entry) & + (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); + int huge = psize > mmu_virtual_psize ? 1 : 0; + + pte_update(vma->vm_mm, address, ptep, 0, set, huge); + + flush_tlb_page(vma, address); +} +#endif + /* Generic accessors to PTE bits */ #ifndef pte_mkwrite_novma static inline pte_t pte_mkwrite_novma(pte_t pte) |