Blame view

include/asm-generic/pgtable-nopmd.h 1.9 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
7
  #ifndef _PGTABLE_NOPMD_H
  #define _PGTABLE_NOPMD_H
  
  #ifndef __ASSEMBLY__
  
  #include <asm-generic/pgtable-nopud.h>
34ee55014   Andrew Morton   include/asm-gener...
8
  struct mm_struct;
ba38c3e78   Martin Schwidefsky   mm: make the __PA...
9
  #define __PAGETABLE_PMD_FOLDED 1
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  
  /*
   * Having the pmd type consist of a pud gets the size right, and allows
   * us to conceptually access the pud entry that this pmd is folded into
   * without casting.
   */
  typedef struct { pud_t pud; } pmd_t;
  
  #define PMD_SHIFT	PUD_SHIFT
  #define PTRS_PER_PMD	1
  #define PMD_SIZE  	(1UL << PMD_SHIFT)
  #define PMD_MASK  	(~(PMD_SIZE-1))
  
  /*
   * The "pud_xxx()" functions here are trivial for a folded two-level
   * setup: the pmd is never bad, and a pmd always exists (as it's folded
   * into the pud entry)
   */
  static inline int pud_none(pud_t pud)		{ return 0; }
  static inline int pud_bad(pud_t pud)		{ return 0; }
  static inline int pud_present(pud_t pud)	{ return 1; }
  static inline void pud_clear(pud_t *pud)	{ }
  #define pmd_ERROR(pmd)				(pud_ERROR((pmd).pud))
  
  #define pud_populate(mm, pmd, pte)		do { } while (0)
  
  /*
   * (pmds are folded into puds so this doesn't get actually called,
   * but the define is needed for a generic inline function.)
   */
  #define set_pud(pudptr, pudval)			set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
  
  static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
  {
  	return (pmd_t *)pud;
  }
  
  #define pmd_val(x)				(pud_val((x).pud))
  #define __pmd(x)				((pmd_t) { __pud(x) } )
  
  #define pud_page(pud)				(pmd_page((pmd_t){ pud }))
46a82b2d5   Dave McCracken   [PATCH] Standardi...
51
  #define pud_page_vaddr(pud)			(pmd_page_vaddr((pmd_t){ pud }))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
53
54
55
56
57
  
  /*
   * allocating and freeing a pmd is trivial: the 1-entry pmd is
   * inside the pud, so has no extra memory associated with it.
   */
  #define pmd_alloc_one(mm, address)		NULL
34ee55014   Andrew Morton   include/asm-gener...
58
59
60
  static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
  {
  }
9e1b32caa   Benjamin Herrenschmidt   mm: Pass virtual ...
61
  #define __pmd_free_tlb(tlb, x, a)		do { } while (0)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
62
63
64
65
66
67
68
  
  #undef  pmd_addr_end
  #define pmd_addr_end(addr, end)			(end)
  
  #endif /* __ASSEMBLY__ */
  
  #endif /* _PGTABLE_NOPMD_H */