Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _PGTABLE_NOP4D_H
0003 #define _PGTABLE_NOP4D_H
0004 
0005 #ifndef __ASSEMBLY__
0006 
0007 #define __PAGETABLE_P4D_FOLDED 1
0008 
0009 typedef struct { pgd_t pgd; } p4d_t;
0010 
0011 #define P4D_SHIFT       PGDIR_SHIFT
0012 #define PTRS_PER_P4D        1
0013 #define P4D_SIZE        (1UL << P4D_SHIFT)
0014 #define P4D_MASK        (~(P4D_SIZE-1))
0015 
0016 /*
0017  * The "pgd_xxx()" functions here are trivial for a folded two-level
0018  * setup: the p4d is never bad, and a p4d always exists (as it's folded
0019  * into the pgd entry)
0020  */
0021 static inline int pgd_none(pgd_t pgd)       { return 0; }
0022 static inline int pgd_bad(pgd_t pgd)        { return 0; }
0023 static inline int pgd_present(pgd_t pgd)    { return 1; }
0024 static inline void pgd_clear(pgd_t *pgd)    { }
0025 #define p4d_ERROR(p4d)              (pgd_ERROR((p4d).pgd))
0026 
0027 #define pgd_populate(mm, pgd, p4d)      do { } while (0)
0028 #define pgd_populate_safe(mm, pgd, p4d)     do { } while (0)
0029 /*
0030  * (p4ds are folded into pgds so this doesn't get actually called,
0031  * but the define is needed for a generic inline function.)
0032  */
0033 #define set_pgd(pgdptr, pgdval) set_p4d((p4d_t *)(pgdptr), (p4d_t) { pgdval })
0034 
0035 static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)
0036 {
0037     return (p4d_t *)pgd;
0038 }
0039 
0040 #define p4d_val(x)              (pgd_val((x).pgd))
0041 #define __p4d(x)                ((p4d_t) { __pgd(x) })
0042 
0043 #define pgd_page(pgd)               (p4d_page((p4d_t){ pgd }))
0044 #define pgd_page_vaddr(pgd)         ((unsigned long)(p4d_pgtable((p4d_t){ pgd })))
0045 
0046 /*
0047  * allocating and freeing a p4d is trivial: the 1-entry p4d is
0048  * inside the pgd, so has no extra memory associated with it.
0049  */
0050 #define p4d_alloc_one(mm, address)      NULL
0051 #define p4d_free(mm, x)             do { } while (0)
0052 #define p4d_free_tlb(tlb, x, a)         do { } while (0)
0053 
0054 #undef  p4d_addr_end
0055 #define p4d_addr_end(addr, end)         (end)
0056 
0057 #endif /* __ASSEMBLY__ */
0058 #endif /* _PGTABLE_NOP4D_H */