blob: 4355f0ec44d62e9b5d7c40132f28f0ff6710f387 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Russell King4baa9922008-08-02 10:55:55 +01002 * arch/arm/include/asm/page.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Copyright (C) 1995-2003 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASMARM_PAGE_H
11#define _ASMARM_PAGE_H
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013/* PAGE_SHIFT determines the page size */
14#define PAGE_SHIFT 12
Linus Walleijf6430a92009-06-24 23:38:56 +010015#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
Cyril Chemparathy926edcc2012-07-22 13:40:38 -040016#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#ifndef __ASSEMBLY__
19
Russell King002547b2006-06-20 20:46:52 +010020#ifndef CONFIG_MMU
21
David Howellsa1ce3922012-10-02 18:01:25 +010022#include <asm/page-nommu.h>
Russell King002547b2006-06-20 20:46:52 +010023
24#else
25
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <asm/glue.h>
27
28/*
29 * User Space Model
30 * ================
31 *
32 * This section selects the correct set of functions for dealing with
33 * page-based copying and clearing for user space for the particular
34 * processor(s) we're building for.
35 *
36 * We have the following to choose from:
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 * v4wt - ARMv4 with writethrough cache, without minicache
38 * v4wb - ARMv4 with writeback cache, without minicache
39 * v4_mc - ARMv4 with minicache
40 * xscale - Xscale
Lennert Buytenhek23bdf862006-03-28 21:00:40 +010041 * xsc3 - XScalev3
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 */
43#undef _USER
44#undef MULTI_USER
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#ifdef CONFIG_CPU_COPY_V4WT
47# ifdef _USER
48# define MULTI_USER 1
49# else
50# define _USER v4wt
51# endif
52#endif
53
54#ifdef CONFIG_CPU_COPY_V4WB
55# ifdef _USER
56# define MULTI_USER 1
57# else
58# define _USER v4wb
59# endif
60#endif
61
Lennert Buytenhek0ed15072008-04-24 01:31:45 -040062#ifdef CONFIG_CPU_COPY_FEROCEON
63# ifdef _USER
64# define MULTI_USER 1
65# else
66# define _USER feroceon
67# endif
68#endif
69
Paulius Zaleckas28853ac2009-03-25 13:10:01 +020070#ifdef CONFIG_CPU_COPY_FA
71# ifdef _USER
72# define MULTI_USER 1
73# else
74# define _USER fa
75# endif
76#endif
77
Linus Torvalds1da177e2005-04-16 15:20:36 -070078#ifdef CONFIG_CPU_SA1100
79# ifdef _USER
80# define MULTI_USER 1
81# else
82# define _USER v4_mc
83# endif
84#endif
85
86#ifdef CONFIG_CPU_XSCALE
87# ifdef _USER
88# define MULTI_USER 1
89# else
90# define _USER xscale_mc
91# endif
92#endif
93
Lennert Buytenhek23bdf862006-03-28 21:00:40 +010094#ifdef CONFIG_CPU_XSC3
95# ifdef _USER
96# define MULTI_USER 1
97# else
98# define _USER xsc3_mc
99# endif
100#endif
101
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102#ifdef CONFIG_CPU_COPY_V6
103# define MULTI_USER 1
104#endif
105
106#if !defined(_USER) && !defined(MULTI_USER)
107#error Unknown user operations model
108#endif
109
Russell King063b0a42008-10-31 15:08:35 +0000110struct page;
Russell Kingf00a75c2009-10-05 15:17:45 +0100111struct vm_area_struct;
Russell King063b0a42008-10-31 15:08:35 +0000112
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113struct cpu_user_fns {
Russell King303c6442008-10-31 16:32:19 +0000114 void (*cpu_clear_user_highpage)(struct page *page, unsigned long vaddr);
Russell King063b0a42008-10-31 15:08:35 +0000115 void (*cpu_copy_user_highpage)(struct page *to, struct page *from,
Russell Kingf00a75c2009-10-05 15:17:45 +0100116 unsigned long vaddr, struct vm_area_struct *vma);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117};
118
119#ifdef MULTI_USER
120extern struct cpu_user_fns cpu_user;
121
Russell King303c6442008-10-31 16:32:19 +0000122#define __cpu_clear_user_highpage cpu_user.cpu_clear_user_highpage
Russell King063b0a42008-10-31 15:08:35 +0000123#define __cpu_copy_user_highpage cpu_user.cpu_copy_user_highpage
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
125#else
126
Russell King303c6442008-10-31 16:32:19 +0000127#define __cpu_clear_user_highpage __glue(_USER,_clear_user_highpage)
Russell King063b0a42008-10-31 15:08:35 +0000128#define __cpu_copy_user_highpage __glue(_USER,_copy_user_highpage)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
Russell King303c6442008-10-31 16:32:19 +0000130extern void __cpu_clear_user_highpage(struct page *page, unsigned long vaddr);
Russell King063b0a42008-10-31 15:08:35 +0000131extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
Russell Kingf00a75c2009-10-05 15:17:45 +0100132 unsigned long vaddr, struct vm_area_struct *vma);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133#endif
134
Russell King303c6442008-10-31 16:32:19 +0000135#define clear_user_highpage(page,vaddr) \
136 __cpu_clear_user_highpage(page, vaddr)
Russell King063b0a42008-10-31 15:08:35 +0000137
138#define __HAVE_ARCH_COPY_USER_HIGHPAGE
139#define copy_user_highpage(to,from,vaddr,vma) \
Russell Kingf00a75c2009-10-05 15:17:45 +0100140 __cpu_copy_user_highpage(to, from, vaddr, vma)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
Russell King59f0cb02008-10-27 11:24:09 +0000142#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143extern void copy_page(void *to, const void *from);
144
Russell Kinga5463cd2013-07-31 21:58:56 +0100145#ifdef CONFIG_KUSER_HELPERS
Will Deaconf9d48612012-01-20 12:01:13 +0100146#define __HAVE_ARCH_GATE_AREA 1
Russell Kinga5463cd2013-07-31 21:58:56 +0100147#endif
Will Deaconf9d48612012-01-20 12:01:13 +0100148
Catalin Marinasdcfdae02011-11-22 17:30:29 +0000149#ifdef CONFIG_ARM_LPAE
150#include <asm/pgtable-3level-types.h>
151#else
Catalin Marinas17f57212011-09-05 17:41:02 +0100152#include <asm/pgtable-2level-types.h>
Catalin Marinasdcfdae02011-11-22 17:30:29 +0000153#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154
Russell King002547b2006-06-20 20:46:52 +0100155#endif /* CONFIG_MMU */
156
Greg Ungerer50346e62008-05-23 07:16:52 +0100157typedef struct page *pgtable_t;
158
Will Deacon7b7bf492011-05-19 13:21:14 +0100159#ifdef CONFIG_HAVE_ARCH_PFN_VALID
Russell Kingb7cfda92009-09-07 15:06:42 +0100160extern int pfn_valid(unsigned long);
161#endif
162
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163#include <asm/memory.h>
164
165#endif /* !__ASSEMBLY__ */
166
Russell King8ec53662008-09-07 17:16:54 +0100167#define VM_DATA_DEFAULT_FLAGS \
168 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
169 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170
Arnd Bergmann5b17e1c2009-05-13 22:56:30 +0000171#include <asm-generic/getorder.h>
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -0700172
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173#endif