struct vm_area_struct * vma;
        struct mm_struct *mm = current->mm;
        const struct exception_table_entry *fixup;
-       int fault, si_code = SEGV_MAPERR;
+       int si_code = SEGV_MAPERR;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        /* As of EV6, a load into $31/$f31 is a prefetch, and never faults
 
 #include <linux/uaccess.h>
 #include <linux/kdebug.h>
 #include <linux/perf_event.h>
+#include <linux/mm_types.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu.h>
 
        struct task_struct *tsk = current;
        struct mm_struct *mm = tsk->mm;
        siginfo_t info;
-       int fault, ret;
+       int ret;
+       vm_fault_t fault;
        int write = regs->ecr_cause & ECR_C_PROTV_STORE;  /* ST/EX */
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
 
        return vma->vm_flags & mask ? false : true;
 }
 
-static int __kprobes
+static vm_fault_t __kprobes
 __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
                unsigned int flags, struct task_struct *tsk)
 {
        struct vm_area_struct *vma;
-       int fault;
+       vm_fault_t fault;
 
        vma = find_vma(mm, addr);
        fault = VM_FAULT_BADMAP;
 {
        struct task_struct *tsk;
        struct mm_struct *mm;
-       int fault, sig, code;
+       int sig, code;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        if (notify_page_fault(regs, fsr))
 
 #define VM_FAULT_BADMAP                0x010000
 #define VM_FAULT_BADACCESS     0x020000
 
-static int __do_page_fault(struct mm_struct *mm, unsigned long addr,
+static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr,
                           unsigned int mm_flags, unsigned long vm_flags,
                           struct task_struct *tsk)
 {
        struct vm_area_struct *vma;
-       int fault;
+       vm_fault_t fault;
 
        vma = find_vma(mm, addr);
        fault = VM_FAULT_BADMAP;
        struct task_struct *tsk;
        struct mm_struct *mm;
        struct siginfo si;
-       int fault, major = 0;
+       vm_fault_t fault, major = 0;
        unsigned long vm_flags = VM_READ | VM_WRITE;
        unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
 
        struct mm_struct *mm = current->mm;
        int si_signo;
        int si_code = SEGV_MAPERR;
-       int fault;
+       vm_fault_t fault;
        const struct exception_table_entry *fixup;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
 
        struct vm_area_struct *vma, *prev_vma;
        struct mm_struct *mm = current->mm;
        unsigned long mask;
-       int fault;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        mask = ((((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
 
 {
        struct mm_struct *mm = current->mm;
        struct vm_area_struct * vma;
-       int fault;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        pr_debug("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
         */
 
        fault = handle_mm_fault(vma, address, flags);
-       pr_debug("handle_mm_fault returns %d\n", fault);
+       pr_debug("handle_mm_fault returns %x\n", fault);
 
        if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
                return 0;
 
        struct mm_struct *mm = current->mm;
        int code = SEGV_MAPERR;
        int is_write = error_code & ESR_S;
-       int fault;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        regs->ear = address;
 
        struct mm_struct *mm = tsk->mm;
        const int field = sizeof(unsigned long) * 2;
        int si_code;
-       int fault;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10);
 
        struct mm_struct *mm;
        struct vm_area_struct *vma;
        int si_code;
-       int fault;
+       vm_fault_t fault;
        unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
 
        struct task_struct *tsk = current;
        struct mm_struct *mm = tsk->mm;
        int code = SEGV_MAPERR;
-       int fault;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        cause >>= 2;
 
        struct mm_struct *mm;
        struct vm_area_struct *vma;
        int si_code;
-       int fault;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        tsk = current;
 
        struct task_struct *tsk;
        struct mm_struct *mm;
        unsigned long acc_type;
-       int fault = 0;
+       vm_fault_t fault = 0;
        unsigned int flags;
 
        if (faulthandler_disabled())
 
 #ifndef _ASM_POWERPC_COPRO_H
 #define _ASM_POWERPC_COPRO_H
 
+#include <linux/mm_types.h>
+
 struct copro_slb
 {
        u64 esid, vsid;
 };
 
 int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
-                         unsigned long dsisr, unsigned *flt);
+                         unsigned long dsisr, vm_fault_t *flt);
 
 int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb);
 
 
  * to handle fortunately.
  */
 int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
-               unsigned long dsisr, unsigned *flt)
+               unsigned long dsisr, vm_fault_t *flt)
 {
        struct vm_area_struct *vma;
        unsigned long is_write;
 
 }
 
 static int do_sigbus(struct pt_regs *regs, unsigned long address,
-                    unsigned int fault)
+                    vm_fault_t fault)
 {
        siginfo_t info;
        unsigned int lsb = 0;
        return 0;
 }
 
-static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
+static int mm_fault_error(struct pt_regs *regs, unsigned long addr,
+                               vm_fault_t fault)
 {
        /*
         * Kernel page fault interrupted by SIGKILL. We have no reason to
        int is_exec = TRAP(regs) == 0x400;
        int is_user = user_mode(regs);
        int is_write = page_fault_is_write(error_code);
-       int fault, major = 0;
+       vm_fault_t fault, major = 0;
        bool must_retry = false;
 
        if (notify_page_fault(regs))
 
 {
        u64 ea, dsisr, access;
        unsigned long flags;
-       unsigned flt = 0;
+       vm_fault_t flt = 0;
        int ret;
 
        /*
 
        struct mm_struct *mm;
        unsigned long addr, cause;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
-       int fault, code = SEGV_MAPERR;
+       int code = SEGV_MAPERR;
+       vm_fault_t fault;
 
        cause = regs->scause;
        addr = regs->sbadaddr;
 
        return -EACCES;
 }
 
-static noinline void do_fault_error(struct pt_regs *regs, int access, int fault)
+static noinline void do_fault_error(struct pt_regs *regs, int access,
+                                       vm_fault_t fault)
 {
        int si_code;
 
  *   11       Page translation     ->  Not present       (nullification)
  *   3b       Region third trans.  ->  Not present       (nullification)
  */
-static inline int do_exception(struct pt_regs *regs, int access)
+static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
 {
        struct gmap *gmap;
        struct task_struct *tsk;
        unsigned long trans_exc_code;
        unsigned long address;
        unsigned int flags;
-       int fault;
+       vm_fault_t fault;
 
        tsk = current;
        /*
 void do_protection_exception(struct pt_regs *regs)
 {
        unsigned long trans_exc_code;
-       int access, fault;
+       int access;
+       vm_fault_t fault;
 
        trans_exc_code = regs->int_parm_long;
        /*
 
 void do_dat_exception(struct pt_regs *regs)
 {
-       int access, fault;
+       int access;
+       vm_fault_t fault;
 
        access = VM_READ | VM_EXEC | VM_WRITE;
        fault = do_exception(regs, access);
 
 
 static noinline int
 mm_fault_error(struct pt_regs *regs, unsigned long error_code,
-              unsigned long address, unsigned int fault)
+              unsigned long address, vm_fault_t fault)
 {
        /*
         * Pagefault was interrupted by SIGKILL. We have no reason to
        struct task_struct *tsk;
        struct mm_struct *mm;
        struct vm_area_struct * vma;
-       int fault;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        tsk = current;
 
        unsigned int fixup;
        unsigned long g2;
        int from_user = !(regs->psr & PSR_PS);
-       int fault, code;
+       int code;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        if (text_fault)
 
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *vma;
        unsigned int insn = 0;
-       int si_code, fault_code, fault;
+       int si_code, fault_code;
+       vm_fault_t fault;
        unsigned long address, mm_rss;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
 
        }
 
        do {
-               int fault;
+               vm_fault_t fault;
 
                fault = handle_mm_fault(vma, address, flags);
 
 
        return vma->vm_flags & mask ? false : true;
 }
 
-static int __do_pf(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
-               unsigned int flags, struct task_struct *tsk)
+static vm_fault_t __do_pf(struct mm_struct *mm, unsigned long addr,
+               unsigned int fsr, unsigned int flags, struct task_struct *tsk)
 {
        struct vm_area_struct *vma;
-       int fault;
+       vm_fault_t fault;
 
        vma = find_vma(mm, addr);
        fault = VM_FAULT_BADMAP;
 {
        struct task_struct *tsk;
        struct mm_struct *mm;
-       int fault, sig, code;
+       int sig, code;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        tsk = current;
 
 #include <linux/prefetch.h>            /* prefetchw                    */
 #include <linux/context_tracking.h>    /* exception_enter(), ...       */
 #include <linux/uaccess.h>             /* faulthandler_disabled()      */
+#include <linux/mm_types.h>
 
 #include <asm/cpufeature.h>            /* boot_cpu_has, ...            */
 #include <asm/traps.h>                 /* dotraplinkage, ...           */
 
 static noinline void
 mm_fault_error(struct pt_regs *regs, unsigned long error_code,
-              unsigned long address, u32 *pkey, unsigned int fault)
+              unsigned long address, u32 *pkey, vm_fault_t fault)
 {
        if (fatal_signal_pending(current) && !(error_code & X86_PF_USER)) {
                no_context(regs, error_code, address, 0, 0);
        struct vm_area_struct *vma;
        struct task_struct *tsk;
        struct mm_struct *mm;
-       int fault, major = 0;
+       vm_fault_t fault, major = 0;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
        u32 pkey;
 
 
        int code;
 
        int is_write, is_exec;
-       int fault;
+       vm_fault_t fault;
        unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
        code = SEGV_MAPERR;
 
 {
        struct fault *fault = container_of(work, struct fault, work);
        struct vm_area_struct *vma;
-       int ret = VM_FAULT_ERROR;
+       vm_fault_t ret = VM_FAULT_ERROR;
        unsigned int flags = 0;
        struct mm_struct *mm;
        u64 address;
 
 #include <linux/pci-ats.h>
 #include <linux/dmar.h>
 #include <linux/interrupt.h>
+#include <linux/mm_types.h>
 #include <asm/page.h>
 
 #define PASID_ENTRY_P          BIT_ULL(0)
                struct vm_area_struct *vma;
                struct page_req_dsc *req;
                struct qi_desc resp;
-               int ret, result;
+               int result;
+               vm_fault_t ret;
                u64 address;
 
                handled = 1;
 
 
 int cxl_handle_mm_fault(struct mm_struct *mm, u64 dsisr, u64 dar)
 {
-       unsigned flt = 0;
+       vm_fault_t flt = 0;
        int result;
        unsigned long access, flags, inv_flags = 0;
 
 
 // Copyright 2017 IBM Corp.
 #include <linux/sched/mm.h>
 #include <linux/mutex.h>
+#include <linux/mm_types.h>
 #include <linux/mmu_context.h>
 #include <asm/copro.h>
 #include <asm/pnv-ocxl.h>
 
 static void xsl_fault_handler_bh(struct work_struct *fault_work)
 {
-       unsigned int flt = 0;
+       vm_fault_t flt = 0;
        unsigned long access, flags, inv_flags = 0;
        enum xsl_response r;
        struct xsl_fault *fault = container_of(fault_work, struct xsl_fault,
 
        struct hmm_vma_walk *hmm_vma_walk = walk->private;
        struct hmm_range *range = hmm_vma_walk->range;
        struct vm_area_struct *vma = walk->vma;
-       int r;
+       vm_fault_t ret;
 
        flags |= hmm_vma_walk->block ? 0 : FAULT_FLAG_ALLOW_RETRY;
        flags |= write_fault ? FAULT_FLAG_WRITE : 0;
-       r = handle_mm_fault(vma, addr, flags);
-       if (r & VM_FAULT_RETRY)
+       ret = handle_mm_fault(vma, addr, flags);
+       if (ret & VM_FAULT_RETRY)
                return -EBUSY;
-       if (r & VM_FAULT_ERROR) {
+       if (ret & VM_FAULT_ERROR) {
                *pfn = range->values[HMM_PFN_ERROR];
                return -EFAULT;
        }
 
 static int break_ksm(struct vm_area_struct *vma, unsigned long addr)
 {
        struct page *page;
-       int ret = 0;
+       vm_fault_t ret = 0;
 
        do {
                cond_resched();