pgtable.h (bb5f33c069402035a3d6a2091ee68cac6999d774) pgtable.h (2fb4706057bcf8261b3b0521ec7a62b54b82ce48)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_H
3#define _ASM_POWERPC_NOHASH_64_PGTABLE_H
4/*
5 * This file contains the functions and defines necessary to modify and use
6 * the ppc64 non-hashed page table.
7 */
8

--- 161 unchanged lines hidden (view full) ---

170 return __pte(pud_val(pud));
171}
172
173static inline pud_t pte_pud(pte_t pte)
174{
175 return __pud(pte_val(pte));
176}
177#define pud_write(pud) pte_write(pud_pte(pud))
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_H
3#define _ASM_POWERPC_NOHASH_64_PGTABLE_H
4/*
5 * This file contains the functions and defines necessary to modify and use
6 * the ppc64 non-hashed page table.
7 */
8

--- 161 unchanged lines hidden (view full) ---

170 return __pte(pud_val(pud));
171}
172
173static inline pud_t pte_pud(pte_t pte)
174{
175 return __pud(pte_val(pte));
176}
177#define pud_write(pud) pte_write(pud_pte(pud))
178#define pgd_write(pgd) pte_write(pgd_pte(pgd))
178#define p4d_write(pgd) pte_write(p4d_pte(p4d))
179
179
180static inline void pgd_set(pgd_t *pgdp, unsigned long val)
180static inline void p4d_set(p4d_t *p4dp, unsigned long val)
181{
181{
182 *pgdp = __pgd(val);
182 *p4dp = __p4d(val);
183}
184
185/*
186 * Find an entry in a page-table-directory. We combine the address region
187 * (the high order N bits) and the pgd portion of the address.
188 */
189#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1))
190

--- 15 unchanged lines hidden (view full) ---

206
207/* Atomic PTE updates */
208static inline unsigned long pte_update(struct mm_struct *mm,
209 unsigned long addr,
210 pte_t *ptep, unsigned long clr,
211 unsigned long set,
212 int huge)
213{
183}
184
185/*
186 * Find an entry in a page-table-directory. We combine the address region
187 * (the high order N bits) and the pgd portion of the address.
188 */
189#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1))
190

--- 15 unchanged lines hidden (view full) ---

206
207/* Atomic PTE updates */
208static inline unsigned long pte_update(struct mm_struct *mm,
209 unsigned long addr,
210 pte_t *ptep, unsigned long clr,
211 unsigned long set,
212 int huge)
213{
214#ifdef PTE_ATOMIC_UPDATES
215 unsigned long old, tmp;
216
217 __asm__ __volatile__(
218 "1: ldarx %0,0,%3 # pte_update\n\
219 andc %1,%0,%4 \n\
220 or %1,%1,%6\n\
221 stdcx. %1,0,%3 \n\
222 bne- 1b"
223 : "=&r" (old), "=&r" (tmp), "=m" (*ptep)
224 : "r" (ptep), "r" (clr), "m" (*ptep), "r" (set)
225 : "cc" );
226#else
214 unsigned long old = pte_val(*ptep);
215 *ptep = __pte((old & ~clr) | set);
227 unsigned long old = pte_val(*ptep);
228 *ptep = __pte((old & ~clr) | set);
216
229#endif
217 /* huge pages use the old page table lock */
218 if (!huge)
219 assert_pte_locked(mm, addr);
220
221 return old;
222}
223
224static inline int pte_young(pte_t pte)

--- 67 unchanged lines hidden (view full) ---

292static inline void __ptep_set_access_flags(struct vm_area_struct *vma,
293 pte_t *ptep, pte_t entry,
294 unsigned long address,
295 int psize)
296{
297 unsigned long bits = pte_val(entry) &
298 (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
299
230 /* huge pages use the old page table lock */
231 if (!huge)
232 assert_pte_locked(mm, addr);
233
234 return old;
235}
236
237static inline int pte_young(pte_t pte)

--- 67 unchanged lines hidden (view full) ---

305static inline void __ptep_set_access_flags(struct vm_area_struct *vma,
306 pte_t *ptep, pte_t entry,
307 unsigned long address,
308 int psize)
309{
310 unsigned long bits = pte_val(entry) &
311 (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
312
313#ifdef PTE_ATOMIC_UPDATES
314 unsigned long old, tmp;
315
316 __asm__ __volatile__(
317 "1: ldarx %0,0,%4\n\
318 or %0,%3,%0\n\
319 stdcx. %0,0,%4\n\
320 bne- 1b"
321 :"=&r" (old), "=&r" (tmp), "=m" (*ptep)
322 :"r" (bits), "r" (ptep), "m" (*ptep)
323 :"cc");
324#else
300 unsigned long old = pte_val(*ptep);
301 *ptep = __pte(old | bits);
325 unsigned long old = pte_val(*ptep);
326 *ptep = __pte(old | bits);
327#endif
302
303 flush_tlb_page(vma, address);
304}
305
306#define __HAVE_ARCH_PTE_SAME
307#define pte_same(A,B) ((pte_val(A) ^ pte_val(B)) == 0)
308
309#define pte_ERROR(e) \

--- 31 unchanged lines hidden ---
328
329 flush_tlb_page(vma, address);
330}
331
332#define __HAVE_ARCH_PTE_SAME
333#define pte_same(A,B) ((pte_val(A) ^ pte_val(B)) == 0)
334
335#define pte_ERROR(e) \

--- 31 unchanged lines hidden ---