c91252eb6b29cf96a90624a665b66412a4e6ca74
[openwrt/staging/linusw.git] /
1 From c5ec455ebd2b488d91de9d8915a0c8036a2a04dd Mon Sep 17 00:00:00 2001
2 From: Juergen Gross <jgross@suse.com>
3 Date: Wed, 30 Nov 2022 14:49:41 -0800
4 Subject: [PATCH 17/29] mm: add dummy pmd_young() for architectures not having
5 it
6
7 In order to avoid #ifdeffery add a dummy pmd_young() implementation as a
8 fallback. This is required for the later patch "mm: introduce
9 arch_has_hw_nonleaf_pmd_young()".
10
11 Link: https://lkml.kernel.org/r/fd3ac3cd-7349-6bbd-890a-71a9454ca0b3@suse.com
12 Signed-off-by: Juergen Gross <jgross@suse.com>
13 Acked-by: Yu Zhao <yuzhao@google.com>
14 Cc: Borislav Petkov <bp@alien8.de>
15 Cc: Dave Hansen <dave.hansen@linux.intel.com>
16 Cc: Geert Uytterhoeven <geert@linux-m68k.org>
17 Cc: "H. Peter Anvin" <hpa@zytor.com>
18 Cc: Ingo Molnar <mingo@redhat.com>
19 Cc: Sander Eikelenboom <linux@eikelenboom.it>
20 Cc: Thomas Gleixner <tglx@linutronix.de>
21 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
22 ---
23 arch/mips/include/asm/pgtable.h | 1 +
24 arch/riscv/include/asm/pgtable.h | 1 +
25 arch/s390/include/asm/pgtable.h | 1 +
26 arch/sparc/include/asm/pgtable_64.h | 1 +
27 arch/x86/include/asm/pgtable.h | 1 +
28 include/linux/pgtable.h | 7 +++++++
29 6 files changed, 12 insertions(+)
30
31 --- a/arch/mips/include/asm/pgtable.h
32 +++ b/arch/mips/include/asm/pgtable.h
33 @@ -632,6 +632,7 @@ static inline pmd_t pmd_mkdirty(pmd_t pm
34 return pmd;
35 }
36
37 +#define pmd_young pmd_young
38 static inline int pmd_young(pmd_t pmd)
39 {
40 return !!(pmd_val(pmd) & _PAGE_ACCESSED);
41 --- a/arch/riscv/include/asm/pgtable.h
42 +++ b/arch/riscv/include/asm/pgtable.h
43 @@ -531,6 +531,7 @@ static inline int pmd_dirty(pmd_t pmd)
44 return pte_dirty(pmd_pte(pmd));
45 }
46
47 +#define pmd_young pmd_young
48 static inline int pmd_young(pmd_t pmd)
49 {
50 return pte_young(pmd_pte(pmd));
51 --- a/arch/s390/include/asm/pgtable.h
52 +++ b/arch/s390/include/asm/pgtable.h
53 @@ -748,6 +748,7 @@ static inline int pmd_dirty(pmd_t pmd)
54 return (pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY) != 0;
55 }
56
57 +#define pmd_young pmd_young
58 static inline int pmd_young(pmd_t pmd)
59 {
60 return (pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG) != 0;
61 --- a/arch/sparc/include/asm/pgtable_64.h
62 +++ b/arch/sparc/include/asm/pgtable_64.h
63 @@ -712,6 +712,7 @@ static inline unsigned long pmd_dirty(pm
64 return pte_dirty(pte);
65 }
66
67 +#define pmd_young pmd_young
68 static inline unsigned long pmd_young(pmd_t pmd)
69 {
70 pte_t pte = __pte(pmd_val(pmd));
71 --- a/arch/x86/include/asm/pgtable.h
72 +++ b/arch/x86/include/asm/pgtable.h
73 @@ -136,6 +136,7 @@ static inline int pmd_dirty(pmd_t pmd)
74 return pmd_flags(pmd) & _PAGE_DIRTY;
75 }
76
77 +#define pmd_young pmd_young
78 static inline int pmd_young(pmd_t pmd)
79 {
80 return pmd_flags(pmd) & _PAGE_ACCESSED;
81 --- a/include/linux/pgtable.h
82 +++ b/include/linux/pgtable.h
83 @@ -164,6 +164,13 @@ static inline pte_t *virt_to_kpte(unsign
84 return pmd_none(*pmd) ? NULL : pte_offset_kernel(pmd, vaddr);
85 }
86
87 +#ifndef pmd_young
88 +static inline int pmd_young(pmd_t pmd)
89 +{
90 + return 0;
91 +}
92 +#endif
93 +
94 #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
95 extern int ptep_set_access_flags(struct vm_area_struct *vma,
96 unsigned long address, pte_t *ptep,