diff options
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/file.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 99c73066b82f..010a51f59796 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -288,9 +288,32 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
288 | return VM_FAULT_NOPAGE; | 288 | return VM_FAULT_NOPAGE; |
289 | } | 289 | } |
290 | 290 | ||
291 | static int spufs_mem_mmap_access(struct vm_area_struct *vma, | ||
292 | unsigned long address, | ||
293 | void *buf, int len, int write) | ||
294 | { | ||
295 | struct spu_context *ctx = vma->vm_file->private_data; | ||
296 | unsigned long offset = address - vma->vm_start; | ||
297 | char *local_store; | ||
298 | |||
299 | if (write && !(vma->vm_flags & VM_WRITE)) | ||
300 | return -EACCES; | ||
301 | if (spu_acquire(ctx)) | ||
302 | return -EINTR; | ||
303 | if ((offset + len) > vma->vm_end) | ||
304 | len = vma->vm_end - offset; | ||
305 | local_store = ctx->ops->get_ls(ctx); | ||
306 | if (write) | ||
307 | memcpy_toio(local_store + offset, buf, len); | ||
308 | else | ||
309 | memcpy_fromio(buf, local_store + offset, len); | ||
310 | spu_release(ctx); | ||
311 | return len; | ||
312 | } | ||
291 | 313 | ||
292 | static struct vm_operations_struct spufs_mem_mmap_vmops = { | 314 | static struct vm_operations_struct spufs_mem_mmap_vmops = { |
293 | .fault = spufs_mem_mmap_fault, | 315 | .fault = spufs_mem_mmap_fault, |
316 | .access = spufs_mem_mmap_access, | ||
294 | }; | 317 | }; |
295 | 318 | ||
296 | static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma) | 319 | static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma) |