aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-07-11 23:57:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 14:05:44 -0400
commit3c9b9accad9f25a52438c790f76b08d79051d383 (patch)
tree62495fb4945b1346d712350ffaef55048c051845 /arch/sh/include
parent2f85e7f948a2c9f7e1524397d1818191ff5abb03 (diff)
sh: use the generic get_user_pages_fast code
The sh code is mostly equivalent to the generic one, minus various bugfixes and two arch overrides that this patch adds to pgtable.h. Link: http://lkml.kernel.org/r/20190625143715.1689-7-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Andrey Konovalov <andreyknvl@google.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David Miller <davem@davemloft.net> Cc: James Hogan <jhogan@kernel.org> Cc: Jason Gunthorpe <jgg@mellanox.com> Cc: Khalid Aziz <khalid.aziz@oracle.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Paul Burton <paul.burton@mips.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Rich Felker <dalias@libc.org> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/sh/include')
-rw-r--r--arch/sh/include/asm/pgtable.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h
index 3587103afe59..9085d1142fa3 100644
--- a/arch/sh/include/asm/pgtable.h
+++ b/arch/sh/include/asm/pgtable.h
@@ -149,6 +149,43 @@ extern void paging_init(void);
149extern void page_table_range_init(unsigned long start, unsigned long end, 149extern void page_table_range_init(unsigned long start, unsigned long end,
150 pgd_t *pgd); 150 pgd_t *pgd);
151 151
152static inline bool __pte_access_permitted(pte_t pte, u64 prot)
153{
154 return (pte_val(pte) & (prot | _PAGE_SPECIAL)) == prot;
155}
156
157#ifdef CONFIG_X2TLB
158static inline bool pte_access_permitted(pte_t pte, bool write)
159{
160 u64 prot = _PAGE_PRESENT;
161
162 prot |= _PAGE_EXT(_PAGE_EXT_KERN_READ | _PAGE_EXT_USER_READ);
163 if (write)
164 prot |= _PAGE_EXT(_PAGE_EXT_KERN_WRITE | _PAGE_EXT_USER_WRITE);
165 return __pte_access_permitted(pte, prot);
166}
167#elif defined(CONFIG_SUPERH64)
168static inline bool pte_access_permitted(pte_t pte, bool write)
169{
170 u64 prot = _PAGE_PRESENT | _PAGE_USER | _PAGE_READ;
171
172 if (write)
173 prot |= _PAGE_WRITE;
174 return __pte_access_permitted(pte, prot);
175}
176#else
177static inline bool pte_access_permitted(pte_t pte, bool write)
178{
179 u64 prot = _PAGE_PRESENT | _PAGE_USER;
180
181 if (write)
182 prot |= _PAGE_RW;
183 return __pte_access_permitted(pte, prot);
184}
185#endif
186
187#define pte_access_permitted pte_access_permitted
188
152/* arch/sh/mm/mmap.c */ 189/* arch/sh/mm/mmap.c */
153#define HAVE_ARCH_UNMAPPED_AREA 190#define HAVE_ARCH_UNMAPPED_AREA
154#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN 191#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN