blob: c2b75cba26df1dca1f3c901fb3ec579292929457 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Russell King4baa9922008-08-02 10:55:55 +01003 * arch/arm/include/asm/page.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * Copyright (C) 1995-2003 Russell King
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7#ifndef _ASMARM_PAGE_H
8#define _ASMARM_PAGE_H
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010/* PAGE_SHIFT determines the page size */
11#define PAGE_SHIFT 12
Linus Walleijf6430a92009-06-24 23:38:56 +010012#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
Cyril Chemparathy926edcc2012-07-22 13:40:38 -040013#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#ifndef __ASSEMBLY__
16
Russell King002547b2006-06-20 20:46:52 +010017#ifndef CONFIG_MMU
18
David Howellsa1ce3922012-10-02 18:01:25 +010019#include <asm/page-nommu.h>
Russell King002547b2006-06-20 20:46:52 +010020
21#else
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <asm/glue.h>
24
25/*
26 * User Space Model
27 * ================
28 *
29 * This section selects the correct set of functions for dealing with
30 * page-based copying and clearing for user space for the particular
31 * processor(s) we're building for.
32 *
33 * We have the following to choose from:
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 * v4wt - ARMv4 with writethrough cache, without minicache
35 * v4wb - ARMv4 with writeback cache, without minicache
36 * v4_mc - ARMv4 with minicache
37 * xscale - Xscale
Lennert Buytenhek23bdf862006-03-28 21:00:40 +010038 * xsc3 - XScalev3
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 */
40#undef _USER
41#undef MULTI_USER
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#ifdef CONFIG_CPU_COPY_V4WT
44# ifdef _USER
45# define MULTI_USER 1
46# else
47# define _USER v4wt
48# endif
49#endif
50
51#ifdef CONFIG_CPU_COPY_V4WB
52# ifdef _USER
53# define MULTI_USER 1
54# else
55# define _USER v4wb
56# endif
57#endif
58
Lennert Buytenhek0ed15072008-04-24 01:31:45 -040059#ifdef CONFIG_CPU_COPY_FEROCEON
60# ifdef _USER
61# define MULTI_USER 1
62# else
63# define _USER feroceon
64# endif
65#endif
66
Paulius Zaleckas28853ac2009-03-25 13:10:01 +020067#ifdef CONFIG_CPU_COPY_FA
68# ifdef _USER
69# define MULTI_USER 1
70# else
71# define _USER fa
72# endif
73#endif
74
Linus Torvalds1da177e2005-04-16 15:20:36 -070075#ifdef CONFIG_CPU_SA1100
76# ifdef _USER
77# define MULTI_USER 1
78# else
79# define _USER v4_mc
80# endif
81#endif
82
83#ifdef CONFIG_CPU_XSCALE
84# ifdef _USER
85# define MULTI_USER 1
86# else
87# define _USER xscale_mc
88# endif
89#endif
90
Lennert Buytenhek23bdf862006-03-28 21:00:40 +010091#ifdef CONFIG_CPU_XSC3
92# ifdef _USER
93# define MULTI_USER 1
94# else
95# define _USER xsc3_mc
96# endif
97#endif
98
Linus Torvalds1da177e2005-04-16 15:20:36 -070099#ifdef CONFIG_CPU_COPY_V6
100# define MULTI_USER 1
101#endif
102
103#if !defined(_USER) && !defined(MULTI_USER)
104#error Unknown user operations model
105#endif
106
Russell King063b0a42008-10-31 15:08:35 +0000107struct page;
Russell Kingf00a75c2009-10-05 15:17:45 +0100108struct vm_area_struct;
Russell King063b0a42008-10-31 15:08:35 +0000109
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110struct cpu_user_fns {
Russell King303c6442008-10-31 16:32:19 +0000111 void (*cpu_clear_user_highpage)(struct page *page, unsigned long vaddr);
Russell King063b0a42008-10-31 15:08:35 +0000112 void (*cpu_copy_user_highpage)(struct page *to, struct page *from,
Russell Kingf00a75c2009-10-05 15:17:45 +0100113 unsigned long vaddr, struct vm_area_struct *vma);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114};
115
116#ifdef MULTI_USER
117extern struct cpu_user_fns cpu_user;
118
Russell King303c6442008-10-31 16:32:19 +0000119#define __cpu_clear_user_highpage cpu_user.cpu_clear_user_highpage
Russell King063b0a42008-10-31 15:08:35 +0000120#define __cpu_copy_user_highpage cpu_user.cpu_copy_user_highpage
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121
122#else
123
Russell King303c6442008-10-31 16:32:19 +0000124#define __cpu_clear_user_highpage __glue(_USER,_clear_user_highpage)
Russell King063b0a42008-10-31 15:08:35 +0000125#define __cpu_copy_user_highpage __glue(_USER,_copy_user_highpage)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126
Russell King303c6442008-10-31 16:32:19 +0000127extern void __cpu_clear_user_highpage(struct page *page, unsigned long vaddr);
Russell King063b0a42008-10-31 15:08:35 +0000128extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
Russell Kingf00a75c2009-10-05 15:17:45 +0100129 unsigned long vaddr, struct vm_area_struct *vma);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130#endif
131
Russell King303c6442008-10-31 16:32:19 +0000132#define clear_user_highpage(page,vaddr) \
133 __cpu_clear_user_highpage(page, vaddr)
Russell King063b0a42008-10-31 15:08:35 +0000134
135#define __HAVE_ARCH_COPY_USER_HIGHPAGE
136#define copy_user_highpage(to,from,vaddr,vma) \
Russell Kingf00a75c2009-10-05 15:17:45 +0100137 __cpu_copy_user_highpage(to, from, vaddr, vma)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
Russell King59f0cb02008-10-27 11:24:09 +0000139#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140extern void copy_page(void *to, const void *from);
141
Russell Kinga5463cd2013-07-31 21:58:56 +0100142#ifdef CONFIG_KUSER_HELPERS
Will Deaconf9d4861f2012-01-20 12:01:13 +0100143#define __HAVE_ARCH_GATE_AREA 1
Russell Kinga5463cd2013-07-31 21:58:56 +0100144#endif
Will Deaconf9d4861f2012-01-20 12:01:13 +0100145
Catalin Marinasdcfdae02011-11-22 17:30:29 +0000146#ifdef CONFIG_ARM_LPAE
147#include <asm/pgtable-3level-types.h>
148#else
Catalin Marinas17f57212011-09-05 17:41:02 +0100149#include <asm/pgtable-2level-types.h>
Catalin Marinasdcfdae02011-11-22 17:30:29 +0000150#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151
Russell King002547b2006-06-20 20:46:52 +0100152#endif /* CONFIG_MMU */
153
Greg Ungerer50346e62008-05-23 07:16:52 +0100154typedef struct page *pgtable_t;
155
Will Deacon7b7bf492011-05-19 13:21:14 +0100156#ifdef CONFIG_HAVE_ARCH_PFN_VALID
Russell Kingb7cfda92009-09-07 15:06:42 +0100157extern int pfn_valid(unsigned long);
158#endif
159
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160#include <asm/memory.h>
161
162#endif /* !__ASSEMBLY__ */
163
Russell King8ec53662008-09-07 17:16:54 +0100164#define VM_DATA_DEFAULT_FLAGS \
165 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
166 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167
Arnd Bergmann5b17e1c2009-05-13 22:56:30 +0000168#include <asm-generic/getorder.h>
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -0700169
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170#endif