summaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/cell/spu_fault.c
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2014-10-08 19:54:50 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2014-10-08 20:14:54 +1100
commite83d01697583d8610d1d62279758c2a881e3396f (patch)
tree167a30304a5b48debcb66955efdf5f68808c1998 /arch/powerpc/platforms/cell/spu_fault.c
parent60666de2dac99777631d0df64257d7fd6a5118fe (diff)
powerpc/cell: Move spu_handle_mm_fault() out of cell platform
Currently spu_handle_mm_fault() is in the cell platform. This code is generically useful for other non-cell co-processors on powerpc. This patch moves this function out of the cell platform into arch/powerpc/mm so that others may use it. Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/cell/spu_fault.c')
-rw-r--r--arch/powerpc/platforms/cell/spu_fault.c94
1 files changed, 0 insertions, 94 deletions
diff --git a/arch/powerpc/platforms/cell/spu_fault.c b/arch/powerpc/platforms/cell/spu_fault.c
deleted file mode 100644
index 641e7273d75a..000000000000
--- a/arch/powerpc/platforms/cell/spu_fault.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SPU mm fault handler
- *
- * (C) Copyright IBM Deutschland Entwicklung GmbH 2007
- *
- * Author: Arnd Bergmann <arndb@de.ibm.com>
- * Author: Jeremy Kerr <jk@ozlabs.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/export.h>
-
-#include <asm/spu.h>
-#include <asm/spu_csa.h>
-
-/*
- * This ought to be kept in sync with the powerpc specific do_page_fault
- * function. Currently, there are a few corner cases that we haven't had
- * to handle fortunately.
- */
-int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
- unsigned long dsisr, unsigned *flt)
-{
- struct vm_area_struct *vma;
- unsigned long is_write;
- int ret;
-
- if (mm == NULL)
- return -EFAULT;
-
- if (mm->pgd == NULL)
- return -EFAULT;
-
- down_read(&mm->mmap_sem);
- ret = -EFAULT;
- vma = find_vma(mm, ea);
- if (!vma)
- goto out_unlock;
-
- if (ea < vma->vm_start) {
- if (!(vma->vm_flags & VM_GROWSDOWN))
- goto out_unlock;
- if (expand_stack(vma, ea))
- goto out_unlock;
- }
-
- is_write = dsisr & MFC_DSISR_ACCESS_PUT;
- if (is_write) {
- if (!(vma->vm_flags & VM_WRITE))
- goto out_unlock;
- } else {
- if (dsisr & MFC_DSISR_ACCESS_DENIED)
- goto out_unlock;
- if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
- goto out_unlock;
- }
-
- ret = 0;
- *flt = handle_mm_fault(mm, vma, ea, is_write ? FAULT_FLAG_WRITE : 0);
- if (unlikely(*flt & VM_FAULT_ERROR)) {
- if (*flt & VM_FAULT_OOM) {
- ret = -ENOMEM;
- goto out_unlock;
- } else if (*flt & VM_FAULT_SIGBUS) {
- ret = -EFAULT;
- goto out_unlock;
- }
- BUG();
- }
-
- if (*flt & VM_FAULT_MAJOR)
- current->maj_flt++;
- else
- current->min_flt++;
-
-out_unlock:
- up_read(&mm->mmap_sem);
- return ret;
-}
-EXPORT_SYMBOL_GPL(spu_handle_mm_fault);