xref: /linux/arch/arm64/include/asm/page.h (revision 2d7eaeb05ae265bd64270376e6a2c0d80244771f)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Based on arch/arm/include/asm/page.h
4  *
5  * Copyright (C) 1995-2003 Russell King
6  * Copyright (C) 2012 ARM Ltd.
7  */
8 #ifndef __ASM_PAGE_H
9 #define __ASM_PAGE_H
10 
11 #include <asm/page-def.h>
12 
13 #ifndef __ASSEMBLER__
14 
15 #include <linux/personality.h> /* for READ_IMPLIES_EXEC */
16 #include <linux/string.h> /* for memset() */
17 #include <linux/types.h> /* for gfp_t */
18 #include <asm/pgtable-types.h>
19 
20 struct page;
21 struct vm_area_struct;
22 
23 extern void copy_page(void *to, const void *from);
24 
25 static inline void clear_pages(void *addr, unsigned int npages)
26 {
27 	memset(addr, 0, npages * PAGE_SIZE);
28 }
29 #define clear_pages clear_pages
30 
31 static inline void clear_page(void *addr)
32 {
33 	clear_pages(addr, 1);
34 }
35 
36 void copy_user_highpage(struct page *to, struct page *from,
37 			unsigned long vaddr, struct vm_area_struct *vma);
38 #define __HAVE_ARCH_COPY_USER_HIGHPAGE
39 
40 void copy_highpage(struct page *to, struct page *from);
41 #define __HAVE_ARCH_COPY_HIGHPAGE
42 
43 struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma,
44 						unsigned long vaddr);
45 #define vma_alloc_zeroed_movable_folio vma_alloc_zeroed_movable_folio
46 
47 bool tag_clear_highpages(struct page *to, int numpages, bool clear_pages);
48 #define __HAVE_ARCH_TAG_CLEAR_HIGHPAGES
49 
50 #define copy_user_page(to, from, vaddr, pg)	copy_page(to, from)
51 
52 typedef struct page *pgtable_t;
53 
54 int pfn_is_map_memory(unsigned long pfn);
55 
56 #include <asm/memory.h>
57 
58 #endif /* !__ASSEMBLER__ */
59 
60 #ifdef CONFIG_ARM64_MTE
61 #define VMA_DATA_DEFAULT_FLAGS	append_vma_flags(VMA_DATA_FLAGS_TSK_EXEC, \
62 						 VMA_MTE_ALLOWED_BIT)
63 #else
64 #define VMA_DATA_DEFAULT_FLAGS	VMA_DATA_FLAGS_TSK_EXEC
65 #endif
66 
67 #include <asm-generic/getorder.h>
68 
69 #endif
70