aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/fault.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2007-12-20 02:39:59 -0500
committerPaul Mackerras <paulus@samba.org>2007-12-21 03:46:19 -0500
commit7cd58e43810852eeb7af5a0c803f3890bd08b581 (patch)
treed9ea5c0102d70c26c4a9b18aaf4db4e3b6d48fc1 /arch/powerpc/platforms/cell/spufs/fault.c
parent9b1d21f858e8bad750ab19cac23dcbf79d099be3 (diff)
[POWERPC] spufs: move fault, lscsa_alloc and switch code to spufs module
Currently, part of the spufs code (switch.o, lscsa_alloc.o and fault.o) is compiled directly into the kernel. This change moves these components of spufs into the kernel. The lscsa and switch objects are fairly straightforward to move in. For the fault.o module, we split the fault-handling code into two parts: a/p/p/c/spu_fault.c and a/p/p/c/spufs/fault.c. The former is for the in-kernel spu_handle_mm_fault function, and we move the rest of the fault-handling code into spufs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/fault.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/fault.c71
1 files changed, 0 insertions, 71 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c
index 917eab4be48..0635f292ae1 100644
--- a/arch/powerpc/platforms/cell/spufs/fault.c
+++ b/arch/powerpc/platforms/cell/spufs/fault.c
@@ -28,75 +28,6 @@
28 28
29#include "spufs.h" 29#include "spufs.h"
30 30
31/*
32 * This ought to be kept in sync with the powerpc specific do_page_fault
33 * function. Currently, there are a few corner cases that we haven't had
34 * to handle fortunately.
35 */
36static int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
37 unsigned long dsisr, unsigned *flt)
38{
39 struct vm_area_struct *vma;
40 unsigned long is_write;
41 int ret;
42
43#if 0
44 if (!IS_VALID_EA(ea)) {
45 return -EFAULT;
46 }
47#endif /* XXX */
48 if (mm == NULL) {
49 return -EFAULT;
50 }
51 if (mm->pgd == NULL) {
52 return -EFAULT;
53 }
54
55 down_read(&mm->mmap_sem);
56 vma = find_vma(mm, ea);
57 if (!vma)
58 goto bad_area;
59 if (vma->vm_start <= ea)
60 goto good_area;
61 if (!(vma->vm_flags & VM_GROWSDOWN))
62 goto bad_area;
63 if (expand_stack(vma, ea))
64 goto bad_area;
65good_area:
66 is_write = dsisr & MFC_DSISR_ACCESS_PUT;
67 if (is_write) {
68 if (!(vma->vm_flags & VM_WRITE))
69 goto bad_area;
70 } else {
71 if (dsisr & MFC_DSISR_ACCESS_DENIED)
72 goto bad_area;
73 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
74 goto bad_area;
75 }
76 ret = 0;
77 *flt = handle_mm_fault(mm, vma, ea, is_write);
78 if (unlikely(*flt & VM_FAULT_ERROR)) {
79 if (*flt & VM_FAULT_OOM) {
80 ret = -ENOMEM;
81 goto bad_area;
82 } else if (*flt & VM_FAULT_SIGBUS) {
83 ret = -EFAULT;
84 goto bad_area;
85 }
86 BUG();
87 }
88 if (*flt & VM_FAULT_MAJOR)
89 current->maj_flt++;
90 else
91 current->min_flt++;
92 up_read(&mm->mmap_sem);
93 return ret;
94
95bad_area:
96 up_read(&mm->mmap_sem);
97 return -EFAULT;
98}
99
100static void spufs_handle_dma_error(struct spu_context *ctx, 31static void spufs_handle_dma_error(struct spu_context *ctx,
101 unsigned long ea, int type) 32 unsigned long ea, int type)
102{ 33{
@@ -138,7 +69,6 @@ void spufs_dma_callback(struct spu *spu, int type)
138{ 69{
139 spufs_handle_dma_error(spu->ctx, spu->dar, type); 70 spufs_handle_dma_error(spu->ctx, spu->dar, type);
140} 71}
141EXPORT_SYMBOL_GPL(spufs_dma_callback);
142 72
143/* 73/*
144 * bottom half handler for page faults, we can't do this from 74 * bottom half handler for page faults, we can't do this from
@@ -227,4 +157,3 @@ int spufs_handle_class1(struct spu_context *ctx)
227 spuctx_switch_state(ctx, SPU_UTIL_SYSTEM); 157 spuctx_switch_state(ctx, SPU_UTIL_SYSTEM);
228 return ret; 158 return ret;
229} 159}
230EXPORT_SYMBOL_GPL(spufs_handle_class1);