aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/mm/fault.c3
-rw-r--r--arch/arc/mm/fault.c4
-rw-r--r--arch/arm/mm/fault.c7
-rw-r--r--arch/arm64/mm/fault.c6
-rw-r--r--arch/hexagon/mm/vm_fault.c2
-rw-r--r--arch/ia64/mm/fault.c2
-rw-r--r--arch/m68k/mm/fault.c4
-rw-r--r--arch/microblaze/mm/fault.c2
-rw-r--r--arch/mips/mm/fault.c2
-rw-r--r--arch/nds32/mm/fault.c2
-rw-r--r--arch/nios2/mm/fault.c2
-rw-r--r--arch/openrisc/mm/fault.c2
-rw-r--r--arch/parisc/mm/fault.c2
-rw-r--r--arch/powerpc/include/asm/copro.h4
-rw-r--r--arch/powerpc/mm/copro_fault.c2
-rw-r--r--arch/powerpc/mm/fault.c7
-rw-r--r--arch/powerpc/platforms/cell/spufs/fault.c2
-rw-r--r--arch/riscv/mm/fault.c3
-rw-r--r--arch/s390/mm/fault.c13
-rw-r--r--arch/sh/mm/fault.c4
-rw-r--r--arch/sparc/mm/fault_32.c3
-rw-r--r--arch/sparc/mm/fault_64.c3
-rw-r--r--arch/um/kernel/trap.c2
-rw-r--r--arch/unicore32/mm/fault.c9
-rw-r--r--arch/x86/mm/fault.c5
-rw-r--r--arch/xtensa/mm/fault.c2
-rw-r--r--drivers/iommu/amd_iommu_v2.c2
-rw-r--r--drivers/iommu/intel-svm.c4
-rw-r--r--drivers/misc/cxl/fault.c2
-rw-r--r--drivers/misc/ocxl/link.c3
-rw-r--r--mm/hmm.c8
-rw-r--r--mm/ksm.c2
32 files changed, 69 insertions, 51 deletions
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index de2bd217adad..d73dc473fbb9 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -87,7 +87,8 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
87 struct vm_area_struct * vma; 87 struct vm_area_struct * vma;
88 struct mm_struct *mm = current->mm; 88 struct mm_struct *mm = current->mm;
89 const struct exception_table_entry *fixup; 89 const struct exception_table_entry *fixup;
90 int fault, si_code = SEGV_MAPERR; 90 int si_code = SEGV_MAPERR;
91 vm_fault_t fault;
91 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 92 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
92 93
93 /* As of EV6, a load into $31/$f31 is a prefetch, and never faults 94 /* As of EV6, a load into $31/$f31 is a prefetch, and never faults
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index b884bbd6f354..db6913094be3 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -15,6 +15,7 @@
15#include <linux/uaccess.h> 15#include <linux/uaccess.h>
16#include <linux/kdebug.h> 16#include <linux/kdebug.h>
17#include <linux/perf_event.h> 17#include <linux/perf_event.h>
18#include <linux/mm_types.h>
18#include <asm/pgalloc.h> 19#include <asm/pgalloc.h>
19#include <asm/mmu.h> 20#include <asm/mmu.h>
20 21
@@ -66,7 +67,8 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
66 struct task_struct *tsk = current; 67 struct task_struct *tsk = current;
67 struct mm_struct *mm = tsk->mm; 68 struct mm_struct *mm = tsk->mm;
68 siginfo_t info; 69 siginfo_t info;
69 int fault, ret; 70 int ret;
71 vm_fault_t fault;
70 int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */ 72 int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */
71 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 73 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
72 74
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 84becc911ee3..3232afb6fdc0 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -224,12 +224,12 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
224 return vma->vm_flags & mask ? false : true; 224 return vma->vm_flags & mask ? false : true;
225} 225}
226 226
227static int __kprobes 227static vm_fault_t __kprobes
228__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, 228__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
229 unsigned int flags, struct task_struct *tsk) 229 unsigned int flags, struct task_struct *tsk)
230{ 230{
231 struct vm_area_struct *vma; 231 struct vm_area_struct *vma;
232 int fault; 232 vm_fault_t fault;
233 233
234 vma = find_vma(mm, addr); 234 vma = find_vma(mm, addr);
235 fault = VM_FAULT_BADMAP; 235 fault = VM_FAULT_BADMAP;
@@ -264,7 +264,8 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
264{ 264{
265 struct task_struct *tsk; 265 struct task_struct *tsk;
266 struct mm_struct *mm; 266 struct mm_struct *mm;
267 int fault, sig, code; 267 int sig, code;
268 vm_fault_t fault;
268 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 269 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
269 270
270 if (notify_page_fault(regs, fsr)) 271 if (notify_page_fault(regs, fsr))
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 9943690a3924..50b30ff30de4 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -379,12 +379,12 @@ static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *re
379#define VM_FAULT_BADMAP 0x010000 379#define VM_FAULT_BADMAP 0x010000
380#define VM_FAULT_BADACCESS 0x020000 380#define VM_FAULT_BADACCESS 0x020000
381 381
382static int __do_page_fault(struct mm_struct *mm, unsigned long addr, 382static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr,
383 unsigned int mm_flags, unsigned long vm_flags, 383 unsigned int mm_flags, unsigned long vm_flags,
384 struct task_struct *tsk) 384 struct task_struct *tsk)
385{ 385{
386 struct vm_area_struct *vma; 386 struct vm_area_struct *vma;
387 int fault; 387 vm_fault_t fault;
388 388
389 vma = find_vma(mm, addr); 389 vma = find_vma(mm, addr);
390 fault = VM_FAULT_BADMAP; 390 fault = VM_FAULT_BADMAP;
@@ -427,7 +427,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
427 struct task_struct *tsk; 427 struct task_struct *tsk;
428 struct mm_struct *mm; 428 struct mm_struct *mm;
429 struct siginfo si; 429 struct siginfo si;
430 int fault, major = 0; 430 vm_fault_t fault, major = 0;
431 unsigned long vm_flags = VM_READ | VM_WRITE; 431 unsigned long vm_flags = VM_READ | VM_WRITE;
432 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 432 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
433 433
diff --git a/arch/hexagon/mm/vm_fault.c b/arch/hexagon/mm/vm_fault.c
index 933bbcef5363..eb263e61daf4 100644
--- a/arch/hexagon/mm/vm_fault.c
+++ b/arch/hexagon/mm/vm_fault.c
@@ -52,7 +52,7 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
52 struct mm_struct *mm = current->mm; 52 struct mm_struct *mm = current->mm;
53 int si_signo; 53 int si_signo;
54 int si_code = SEGV_MAPERR; 54 int si_code = SEGV_MAPERR;
55 int fault; 55 vm_fault_t fault;
56 const struct exception_table_entry *fixup; 56 const struct exception_table_entry *fixup;
57 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 57 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
58 58
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 817fa120645f..a9d55ad8d67b 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -86,7 +86,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
86 struct vm_area_struct *vma, *prev_vma; 86 struct vm_area_struct *vma, *prev_vma;
87 struct mm_struct *mm = current->mm; 87 struct mm_struct *mm = current->mm;
88 unsigned long mask; 88 unsigned long mask;
89 int fault; 89 vm_fault_t fault;
90 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 90 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
91 91
92 mask = ((((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT) 92 mask = ((((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index f2ff3779875a..9b6163c05a75 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -70,7 +70,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
70{ 70{
71 struct mm_struct *mm = current->mm; 71 struct mm_struct *mm = current->mm;
72 struct vm_area_struct * vma; 72 struct vm_area_struct * vma;
73 int fault; 73 vm_fault_t fault;
74 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 74 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
75 75
76 pr_debug("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n", 76 pr_debug("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
@@ -136,7 +136,7 @@ good_area:
136 */ 136 */
137 137
138 fault = handle_mm_fault(vma, address, flags); 138 fault = handle_mm_fault(vma, address, flags);
139 pr_debug("handle_mm_fault returns %d\n", fault); 139 pr_debug("handle_mm_fault returns %x\n", fault);
140 140
141 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) 141 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
142 return 0; 142 return 0;
diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c
index af607447c683..202ad6a494f5 100644
--- a/arch/microblaze/mm/fault.c
+++ b/arch/microblaze/mm/fault.c
@@ -90,7 +90,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
90 struct mm_struct *mm = current->mm; 90 struct mm_struct *mm = current->mm;
91 int code = SEGV_MAPERR; 91 int code = SEGV_MAPERR;
92 int is_write = error_code & ESR_S; 92 int is_write = error_code & ESR_S;
93 int fault; 93 vm_fault_t fault;
94 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 94 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
95 95
96 regs->ear = address; 96 regs->ear = address;
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 5f71f2b903b7..73d8a0f0b810 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -43,7 +43,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,
43 struct mm_struct *mm = tsk->mm; 43 struct mm_struct *mm = tsk->mm;
44 const int field = sizeof(unsigned long) * 2; 44 const int field = sizeof(unsigned long) * 2;
45 int si_code; 45 int si_code;
46 int fault; 46 vm_fault_t fault;
47 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 47 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
48 48
49 static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10); 49 static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10);
diff --git a/arch/nds32/mm/fault.c b/arch/nds32/mm/fault.c
index 9bdb7c3ecbb6..b740534b152c 100644
--- a/arch/nds32/mm/fault.c
+++ b/arch/nds32/mm/fault.c
@@ -73,7 +73,7 @@ void do_page_fault(unsigned long entry, unsigned long addr,
73 struct mm_struct *mm; 73 struct mm_struct *mm;
74 struct vm_area_struct *vma; 74 struct vm_area_struct *vma;
75 int si_code; 75 int si_code;
76 int fault; 76 vm_fault_t fault;
77 unsigned int mask = VM_READ | VM_WRITE | VM_EXEC; 77 unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
78 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 78 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
79 79
diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c
index b804dd06ea1c..24fd84cf6006 100644
--- a/arch/nios2/mm/fault.c
+++ b/arch/nios2/mm/fault.c
@@ -47,7 +47,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,
47 struct task_struct *tsk = current; 47 struct task_struct *tsk = current;
48 struct mm_struct *mm = tsk->mm; 48 struct mm_struct *mm = tsk->mm;
49 int code = SEGV_MAPERR; 49 int code = SEGV_MAPERR;
50 int fault; 50 vm_fault_t fault;
51 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 51 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
52 52
53 cause >>= 2; 53 cause >>= 2;
diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c
index 9f011d16cc46..dc4dbafc1d83 100644
--- a/arch/openrisc/mm/fault.c
+++ b/arch/openrisc/mm/fault.c
@@ -53,7 +53,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
53 struct mm_struct *mm; 53 struct mm_struct *mm;
54 struct vm_area_struct *vma; 54 struct vm_area_struct *vma;
55 int si_code; 55 int si_code;
56 int fault; 56 vm_fault_t fault;
57 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 57 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
58 58
59 tsk = current; 59 tsk = current;
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index a80117980fc2..c8e8b7c05558 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -262,7 +262,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
262 struct task_struct *tsk; 262 struct task_struct *tsk;
263 struct mm_struct *mm; 263 struct mm_struct *mm;
264 unsigned long acc_type; 264 unsigned long acc_type;
265 int fault = 0; 265 vm_fault_t fault = 0;
266 unsigned int flags; 266 unsigned int flags;
267 267
268 if (faulthandler_disabled()) 268 if (faulthandler_disabled())
diff --git a/arch/powerpc/include/asm/copro.h b/arch/powerpc/include/asm/copro.h
index ce216df31381..48616fe7ea75 100644
--- a/arch/powerpc/include/asm/copro.h
+++ b/arch/powerpc/include/asm/copro.h
@@ -10,13 +10,15 @@
10#ifndef _ASM_POWERPC_COPRO_H 10#ifndef _ASM_POWERPC_COPRO_H
11#define _ASM_POWERPC_COPRO_H 11#define _ASM_POWERPC_COPRO_H
12 12
13#include <linux/mm_types.h>
14
13struct copro_slb 15struct copro_slb
14{ 16{
15 u64 esid, vsid; 17 u64 esid, vsid;
16}; 18};
17 19
18int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea, 20int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
19 unsigned long dsisr, unsigned *flt); 21 unsigned long dsisr, vm_fault_t *flt);
20 22
21int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb); 23int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb);
22 24
diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c
index 7d0945bd3a61..c8da352e8686 100644
--- a/arch/powerpc/mm/copro_fault.c
+++ b/arch/powerpc/mm/copro_fault.c
@@ -34,7 +34,7 @@
34 * to handle fortunately. 34 * to handle fortunately.
35 */ 35 */
36int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea, 36int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
37 unsigned long dsisr, unsigned *flt) 37 unsigned long dsisr, vm_fault_t *flt)
38{ 38{
39 struct vm_area_struct *vma; 39 struct vm_area_struct *vma;
40 unsigned long is_write; 40 unsigned long is_write;
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index b1ca7a0974e3..7c061313cc6f 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -156,7 +156,7 @@ static noinline int bad_access(struct pt_regs *regs, unsigned long address)
156} 156}
157 157
158static int do_sigbus(struct pt_regs *regs, unsigned long address, 158static int do_sigbus(struct pt_regs *regs, unsigned long address,
159 unsigned int fault) 159 vm_fault_t fault)
160{ 160{
161 siginfo_t info; 161 siginfo_t info;
162 unsigned int lsb = 0; 162 unsigned int lsb = 0;
@@ -187,7 +187,8 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
187 return 0; 187 return 0;
188} 188}
189 189
190static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault) 190static int mm_fault_error(struct pt_regs *regs, unsigned long addr,
191 vm_fault_t fault)
191{ 192{
192 /* 193 /*
193 * Kernel page fault interrupted by SIGKILL. We have no reason to 194 * Kernel page fault interrupted by SIGKILL. We have no reason to
@@ -415,7 +416,7 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
415 int is_exec = TRAP(regs) == 0x400; 416 int is_exec = TRAP(regs) == 0x400;
416 int is_user = user_mode(regs); 417 int is_user = user_mode(regs);
417 int is_write = page_fault_is_write(error_code); 418 int is_write = page_fault_is_write(error_code);
418 int fault, major = 0; 419 vm_fault_t fault, major = 0;
419 bool must_retry = false; 420 bool must_retry = false;
420 421
421 if (notify_page_fault(regs)) 422 if (notify_page_fault(regs))
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c
index 1e002e94d0f6..83cf58daaa79 100644
--- a/arch/powerpc/platforms/cell/spufs/fault.c
+++ b/arch/powerpc/platforms/cell/spufs/fault.c
@@ -111,7 +111,7 @@ int spufs_handle_class1(struct spu_context *ctx)
111{ 111{
112 u64 ea, dsisr, access; 112 u64 ea, dsisr, access;
113 unsigned long flags; 113 unsigned long flags;
114 unsigned flt = 0; 114 vm_fault_t flt = 0;
115 int ret; 115 int ret;
116 116
117 /* 117 /*
diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index 148c98ca9b45..88401d5125bc 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -41,7 +41,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
41 struct mm_struct *mm; 41 struct mm_struct *mm;
42 unsigned long addr, cause; 42 unsigned long addr, cause;
43 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 43 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
44 int fault, code = SEGV_MAPERR; 44 int code = SEGV_MAPERR;
45 vm_fault_t fault;
45 46
46 cause = regs->scause; 47 cause = regs->scause;
47 addr = regs->sbadaddr; 48 addr = regs->sbadaddr;
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 4cc3f06b0ab3..72af23bacbb5 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -341,7 +341,8 @@ static noinline int signal_return(struct pt_regs *regs)
341 return -EACCES; 341 return -EACCES;
342} 342}
343 343
344static noinline void do_fault_error(struct pt_regs *regs, int access, int fault) 344static noinline void do_fault_error(struct pt_regs *regs, int access,
345 vm_fault_t fault)
345{ 346{
346 int si_code; 347 int si_code;
347 348
@@ -401,7 +402,7 @@ static noinline void do_fault_error(struct pt_regs *regs, int access, int fault)
401 * 11 Page translation -> Not present (nullification) 402 * 11 Page translation -> Not present (nullification)
402 * 3b Region third trans. -> Not present (nullification) 403 * 3b Region third trans. -> Not present (nullification)
403 */ 404 */
404static inline int do_exception(struct pt_regs *regs, int access) 405static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
405{ 406{
406 struct gmap *gmap; 407 struct gmap *gmap;
407 struct task_struct *tsk; 408 struct task_struct *tsk;
@@ -411,7 +412,7 @@ static inline int do_exception(struct pt_regs *regs, int access)
411 unsigned long trans_exc_code; 412 unsigned long trans_exc_code;
412 unsigned long address; 413 unsigned long address;
413 unsigned int flags; 414 unsigned int flags;
414 int fault; 415 vm_fault_t fault;
415 416
416 tsk = current; 417 tsk = current;
417 /* 418 /*
@@ -564,7 +565,8 @@ out:
564void do_protection_exception(struct pt_regs *regs) 565void do_protection_exception(struct pt_regs *regs)
565{ 566{
566 unsigned long trans_exc_code; 567 unsigned long trans_exc_code;
567 int access, fault; 568 int access;
569 vm_fault_t fault;
568 570
569 trans_exc_code = regs->int_parm_long; 571 trans_exc_code = regs->int_parm_long;
570 /* 572 /*
@@ -599,7 +601,8 @@ NOKPROBE_SYMBOL(do_protection_exception);
599 601
600void do_dat_exception(struct pt_regs *regs) 602void do_dat_exception(struct pt_regs *regs)
601{ 603{
602 int access, fault; 604 int access;
605 vm_fault_t fault;
603 606
604 access = VM_READ | VM_EXEC | VM_WRITE; 607 access = VM_READ | VM_EXEC | VM_WRITE;
605 fault = do_exception(regs, access); 608 fault = do_exception(regs, access);
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index b8e7bb84b6b1..6defd2c6d9b1 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -313,7 +313,7 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address)
313 313
314static noinline int 314static noinline int
315mm_fault_error(struct pt_regs *regs, unsigned long error_code, 315mm_fault_error(struct pt_regs *regs, unsigned long error_code,
316 unsigned long address, unsigned int fault) 316 unsigned long address, vm_fault_t fault)
317{ 317{
318 /* 318 /*
319 * Pagefault was interrupted by SIGKILL. We have no reason to 319 * Pagefault was interrupted by SIGKILL. We have no reason to
@@ -396,7 +396,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
396 struct task_struct *tsk; 396 struct task_struct *tsk;
397 struct mm_struct *mm; 397 struct mm_struct *mm;
398 struct vm_area_struct * vma; 398 struct vm_area_struct * vma;
399 int fault; 399 vm_fault_t fault;
400 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 400 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
401 401
402 tsk = current; 402 tsk = current;
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index 9f75b6444bf1..b0440b0edd97 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -166,7 +166,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
166 unsigned int fixup; 166 unsigned int fixup;
167 unsigned long g2; 167 unsigned long g2;
168 int from_user = !(regs->psr & PSR_PS); 168 int from_user = !(regs->psr & PSR_PS);
169 int fault, code; 169 int code;
170 vm_fault_t fault;
170 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 171 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
171 172
172 if (text_fault) 173 if (text_fault)
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 63166fcf9e25..8f8a604c1300 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -278,7 +278,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
278 struct mm_struct *mm = current->mm; 278 struct mm_struct *mm = current->mm;
279 struct vm_area_struct *vma; 279 struct vm_area_struct *vma;
280 unsigned int insn = 0; 280 unsigned int insn = 0;
281 int si_code, fault_code, fault; 281 int si_code, fault_code;
282 vm_fault_t fault;
282 unsigned long address, mm_rss; 283 unsigned long address, mm_rss;
283 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 284 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
284 285
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index ec9a42c14c56..cced82946042 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -72,7 +72,7 @@ good_area:
72 } 72 }
73 73
74 do { 74 do {
75 int fault; 75 vm_fault_t fault;
76 76
77 fault = handle_mm_fault(vma, address, flags); 77 fault = handle_mm_fault(vma, address, flags);
78 78
diff --git a/arch/unicore32/mm/fault.c b/arch/unicore32/mm/fault.c
index 381473412937..8f12a5b50a42 100644
--- a/arch/unicore32/mm/fault.c
+++ b/arch/unicore32/mm/fault.c
@@ -168,11 +168,11 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
168 return vma->vm_flags & mask ? false : true; 168 return vma->vm_flags & mask ? false : true;
169} 169}
170 170
171static int __do_pf(struct mm_struct *mm, unsigned long addr, unsigned int fsr, 171static vm_fault_t __do_pf(struct mm_struct *mm, unsigned long addr,
172 unsigned int flags, struct task_struct *tsk) 172 unsigned int fsr, unsigned int flags, struct task_struct *tsk)
173{ 173{
174 struct vm_area_struct *vma; 174 struct vm_area_struct *vma;
175 int fault; 175 vm_fault_t fault;
176 176
177 vma = find_vma(mm, addr); 177 vma = find_vma(mm, addr);
178 fault = VM_FAULT_BADMAP; 178 fault = VM_FAULT_BADMAP;
@@ -209,7 +209,8 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
209{ 209{
210 struct task_struct *tsk; 210 struct task_struct *tsk;
211 struct mm_struct *mm; 211 struct mm_struct *mm;
212 int fault, sig, code; 212 int sig, code;
213 vm_fault_t fault;
213 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 214 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
214 215
215 tsk = current; 216 tsk = current;
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index db1c042e9853..b9123c497e0a 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -16,6 +16,7 @@
16#include <linux/prefetch.h> /* prefetchw */ 16#include <linux/prefetch.h> /* prefetchw */
17#include <linux/context_tracking.h> /* exception_enter(), ... */ 17#include <linux/context_tracking.h> /* exception_enter(), ... */
18#include <linux/uaccess.h> /* faulthandler_disabled() */ 18#include <linux/uaccess.h> /* faulthandler_disabled() */
19#include <linux/mm_types.h>
19 20
20#include <asm/cpufeature.h> /* boot_cpu_has, ... */ 21#include <asm/cpufeature.h> /* boot_cpu_has, ... */
21#include <asm/traps.h> /* dotraplinkage, ... */ 22#include <asm/traps.h> /* dotraplinkage, ... */
@@ -999,7 +1000,7 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
999 1000
1000static noinline void 1001static noinline void
1001mm_fault_error(struct pt_regs *regs, unsigned long error_code, 1002mm_fault_error(struct pt_regs *regs, unsigned long error_code,
1002 unsigned long address, u32 *pkey, unsigned int fault) 1003 unsigned long address, u32 *pkey, vm_fault_t fault)
1003{ 1004{
1004 if (fatal_signal_pending(current) && !(error_code & X86_PF_USER)) { 1005 if (fatal_signal_pending(current) && !(error_code & X86_PF_USER)) {
1005 no_context(regs, error_code, address, 0, 0); 1006 no_context(regs, error_code, address, 0, 0);
@@ -1213,7 +1214,7 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code,
1213 struct vm_area_struct *vma; 1214 struct vm_area_struct *vma;
1214 struct task_struct *tsk; 1215 struct task_struct *tsk;
1215 struct mm_struct *mm; 1216 struct mm_struct *mm;
1216 int fault, major = 0; 1217 vm_fault_t fault, major = 0;
1217 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 1218 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
1218 u32 pkey; 1219 u32 pkey;
1219 1220
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index c111a833205a..2ab0e0dcd166 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -42,7 +42,7 @@ void do_page_fault(struct pt_regs *regs)
42 int code; 42 int code;
43 43
44 int is_write, is_exec; 44 int is_write, is_exec;
45 int fault; 45 vm_fault_t fault;
46 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 46 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
47 47
48 code = SEGV_MAPERR; 48 code = SEGV_MAPERR;
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 1d0b53a04a08..58da65df03f5 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -508,7 +508,7 @@ static void do_fault(struct work_struct *work)
508{ 508{
509 struct fault *fault = container_of(work, struct fault, work); 509 struct fault *fault = container_of(work, struct fault, work);
510 struct vm_area_struct *vma; 510 struct vm_area_struct *vma;
511 int ret = VM_FAULT_ERROR; 511 vm_fault_t ret = VM_FAULT_ERROR;
512 unsigned int flags = 0; 512 unsigned int flags = 0;
513 struct mm_struct *mm; 513 struct mm_struct *mm;
514 u64 address; 514 u64 address;
diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
index 45f6e581cd56..7d65aab36a96 100644
--- a/drivers/iommu/intel-svm.c
+++ b/drivers/iommu/intel-svm.c
@@ -24,6 +24,7 @@
24#include <linux/pci-ats.h> 24#include <linux/pci-ats.h>
25#include <linux/dmar.h> 25#include <linux/dmar.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/mm_types.h>
27#include <asm/page.h> 28#include <asm/page.h>
28 29
29#define PASID_ENTRY_P BIT_ULL(0) 30#define PASID_ENTRY_P BIT_ULL(0)
@@ -594,7 +595,8 @@ static irqreturn_t prq_event_thread(int irq, void *d)
594 struct vm_area_struct *vma; 595 struct vm_area_struct *vma;
595 struct page_req_dsc *req; 596 struct page_req_dsc *req;
596 struct qi_desc resp; 597 struct qi_desc resp;
597 int ret, result; 598 int result;
599 vm_fault_t ret;
598 u64 address; 600 u64 address;
599 601
600 handled = 1; 602 handled = 1;
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index 70dbb6de102c..93ecc67a0f3b 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -134,7 +134,7 @@ static int cxl_handle_segment_miss(struct cxl_context *ctx,
134 134
135int cxl_handle_mm_fault(struct mm_struct *mm, u64 dsisr, u64 dar) 135int cxl_handle_mm_fault(struct mm_struct *mm, u64 dsisr, u64 dar)
136{ 136{
137 unsigned flt = 0; 137 vm_fault_t flt = 0;
138 int result; 138 int result;
139 unsigned long access, flags, inv_flags = 0; 139 unsigned long access, flags, inv_flags = 0;
140 140
diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c
index 88876ae8f330..ffc731b0731a 100644
--- a/drivers/misc/ocxl/link.c
+++ b/drivers/misc/ocxl/link.c
@@ -2,6 +2,7 @@
2// Copyright 2017 IBM Corp. 2// Copyright 2017 IBM Corp.
3#include <linux/sched/mm.h> 3#include <linux/sched/mm.h>
4#include <linux/mutex.h> 4#include <linux/mutex.h>
5#include <linux/mm_types.h>
5#include <linux/mmu_context.h> 6#include <linux/mmu_context.h>
6#include <asm/copro.h> 7#include <asm/copro.h>
7#include <asm/pnv-ocxl.h> 8#include <asm/pnv-ocxl.h>
@@ -126,7 +127,7 @@ static void ack_irq(struct spa *spa, enum xsl_response r)
126 127
127static void xsl_fault_handler_bh(struct work_struct *fault_work) 128static void xsl_fault_handler_bh(struct work_struct *fault_work)
128{ 129{
129 unsigned int flt = 0; 130 vm_fault_t flt = 0;
130 unsigned long access, flags, inv_flags = 0; 131 unsigned long access, flags, inv_flags = 0;
131 enum xsl_response r; 132 enum xsl_response r;
132 struct xsl_fault *fault = container_of(fault_work, struct xsl_fault, 133 struct xsl_fault *fault = container_of(fault_work, struct xsl_fault,
diff --git a/mm/hmm.c b/mm/hmm.c
index f40e8add84b5..caf9df27599e 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -299,14 +299,14 @@ static int hmm_vma_do_fault(struct mm_walk *walk, unsigned long addr,
299 struct hmm_vma_walk *hmm_vma_walk = walk->private; 299 struct hmm_vma_walk *hmm_vma_walk = walk->private;
300 struct hmm_range *range = hmm_vma_walk->range; 300 struct hmm_range *range = hmm_vma_walk->range;
301 struct vm_area_struct *vma = walk->vma; 301 struct vm_area_struct *vma = walk->vma;
302 int r; 302 vm_fault_t ret;
303 303
304 flags |= hmm_vma_walk->block ? 0 : FAULT_FLAG_ALLOW_RETRY; 304 flags |= hmm_vma_walk->block ? 0 : FAULT_FLAG_ALLOW_RETRY;
305 flags |= write_fault ? FAULT_FLAG_WRITE : 0; 305 flags |= write_fault ? FAULT_FLAG_WRITE : 0;
306 r = handle_mm_fault(vma, addr, flags); 306 ret = handle_mm_fault(vma, addr, flags);
307 if (r & VM_FAULT_RETRY) 307 if (ret & VM_FAULT_RETRY)
308 return -EBUSY; 308 return -EBUSY;
309 if (r & VM_FAULT_ERROR) { 309 if (ret & VM_FAULT_ERROR) {
310 *pfn = range->values[HMM_PFN_ERROR]; 310 *pfn = range->values[HMM_PFN_ERROR];
311 return -EFAULT; 311 return -EFAULT;
312 } 312 }
diff --git a/mm/ksm.c b/mm/ksm.c
index 9b855a8b0f2d..2621be57bd95 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -470,7 +470,7 @@ static inline bool ksm_test_exit(struct mm_struct *mm)
470static int break_ksm(struct vm_area_struct *vma, unsigned long addr) 470static int break_ksm(struct vm_area_struct *vma, unsigned long addr)
471{ 471{
472 struct page *page; 472 struct page *page;
473 int ret = 0; 473 vm_fault_t ret = 0;
474 474
475 do { 475 do {
476 cond_resched(); 476 cond_resched();