[POWERPC] spufs: Change %llx to 0x%llx.
[linux-2.6/linux-loongson.git] / arch / powerpc / platforms / cell / spufs / file.c
blob7f1262706671bf4016e9fee3f2356613a39ce90b
1 /*
2 * SPU file system -- file contents
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #undef DEBUG
25 #include <linux/fs.h>
26 #include <linux/ioctl.h>
27 #include <linux/module.h>
28 #include <linux/pagemap.h>
29 #include <linux/poll.h>
30 #include <linux/ptrace.h>
32 #include <asm/io.h>
33 #include <asm/semaphore.h>
34 #include <asm/spu.h>
35 #include <asm/uaccess.h>
37 #include "spufs.h"
39 #define SPUFS_MMAP_4K (PAGE_SIZE == 0x1000)
42 static int
43 spufs_mem_open(struct inode *inode, struct file *file)
45 struct spufs_inode_info *i = SPUFS_I(inode);
46 struct spu_context *ctx = i->i_ctx;
47 file->private_data = ctx;
48 file->f_mapping = inode->i_mapping;
49 ctx->local_store = inode->i_mapping;
50 return 0;
53 static ssize_t
54 spufs_mem_read(struct file *file, char __user *buffer,
55 size_t size, loff_t *pos)
57 struct spu_context *ctx = file->private_data;
58 char *local_store;
59 int ret;
61 spu_acquire(ctx);
63 local_store = ctx->ops->get_ls(ctx);
64 ret = simple_read_from_buffer(buffer, size, pos, local_store, LS_SIZE);
66 spu_release(ctx);
67 return ret;
70 static ssize_t
71 spufs_mem_write(struct file *file, const char __user *buffer,
72 size_t size, loff_t *pos)
74 struct spu_context *ctx = file->private_data;
75 char *local_store;
76 int ret;
78 size = min_t(ssize_t, LS_SIZE - *pos, size);
79 if (size <= 0)
80 return -EFBIG;
81 *pos += size;
83 spu_acquire(ctx);
85 local_store = ctx->ops->get_ls(ctx);
86 ret = copy_from_user(local_store + *pos - size,
87 buffer, size) ? -EFAULT : size;
89 spu_release(ctx);
90 return ret;
93 static struct page *
94 spufs_mem_mmap_nopage(struct vm_area_struct *vma,
95 unsigned long address, int *type)
97 struct page *page = NOPAGE_SIGBUS;
99 struct spu_context *ctx = vma->vm_file->private_data;
100 unsigned long offset = address - vma->vm_start;
101 offset += vma->vm_pgoff << PAGE_SHIFT;
103 spu_acquire(ctx);
105 if (ctx->state == SPU_STATE_SAVED) {
106 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
107 & ~(_PAGE_NO_CACHE | _PAGE_GUARDED));
108 page = vmalloc_to_page(ctx->csa.lscsa->ls + offset);
109 } else {
110 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
111 | _PAGE_NO_CACHE | _PAGE_GUARDED);
112 page = pfn_to_page((ctx->spu->local_store_phys + offset)
113 >> PAGE_SHIFT);
115 spu_release(ctx);
117 if (type)
118 *type = VM_FAULT_MINOR;
120 page_cache_get(page);
121 return page;
124 static struct vm_operations_struct spufs_mem_mmap_vmops = {
125 .nopage = spufs_mem_mmap_nopage,
128 static int
129 spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
131 if (!(vma->vm_flags & VM_SHARED))
132 return -EINVAL;
134 /* FIXME: */
135 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
136 | _PAGE_NO_CACHE);
138 vma->vm_ops = &spufs_mem_mmap_vmops;
139 return 0;
142 static struct file_operations spufs_mem_fops = {
143 .open = spufs_mem_open,
144 .read = spufs_mem_read,
145 .write = spufs_mem_write,
146 .llseek = generic_file_llseek,
147 .mmap = spufs_mem_mmap,
150 static struct page *spufs_ps_nopage(struct vm_area_struct *vma,
151 unsigned long address,
152 int *type, unsigned long ps_offs,
153 unsigned long ps_size)
155 struct page *page = NOPAGE_SIGBUS;
156 int fault_type = VM_FAULT_SIGBUS;
157 struct spu_context *ctx = vma->vm_file->private_data;
158 unsigned long offset = address - vma->vm_start;
159 unsigned long area;
160 int ret;
162 offset += vma->vm_pgoff << PAGE_SHIFT;
163 if (offset >= ps_size)
164 goto out;
166 ret = spu_acquire_runnable(ctx);
167 if (ret)
168 goto out;
170 area = ctx->spu->problem_phys + ps_offs;
171 page = pfn_to_page((area + offset) >> PAGE_SHIFT);
172 fault_type = VM_FAULT_MINOR;
173 page_cache_get(page);
175 spu_release(ctx);
177 out:
178 if (type)
179 *type = fault_type;
181 return page;
184 #if SPUFS_MMAP_4K
185 static struct page *spufs_cntl_mmap_nopage(struct vm_area_struct *vma,
186 unsigned long address, int *type)
188 return spufs_ps_nopage(vma, address, type, 0x4000, 0x1000);
191 static struct vm_operations_struct spufs_cntl_mmap_vmops = {
192 .nopage = spufs_cntl_mmap_nopage,
196 * mmap support for problem state control area [0x4000 - 0x4fff].
198 static int spufs_cntl_mmap(struct file *file, struct vm_area_struct *vma)
200 if (!(vma->vm_flags & VM_SHARED))
201 return -EINVAL;
203 vma->vm_flags |= VM_RESERVED;
204 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
205 | _PAGE_NO_CACHE | _PAGE_GUARDED);
207 vma->vm_ops = &spufs_cntl_mmap_vmops;
208 return 0;
210 #else /* SPUFS_MMAP_4K */
211 #define spufs_cntl_mmap NULL
212 #endif /* !SPUFS_MMAP_4K */
214 static u64 spufs_cntl_get(void *data)
216 struct spu_context *ctx = data;
217 u64 val;
219 spu_acquire(ctx);
220 val = ctx->ops->status_read(ctx);
221 spu_release(ctx);
223 return val;
226 static void spufs_cntl_set(void *data, u64 val)
228 struct spu_context *ctx = data;
230 spu_acquire(ctx);
231 ctx->ops->runcntl_write(ctx, val);
232 spu_release(ctx);
235 static int spufs_cntl_open(struct inode *inode, struct file *file)
237 struct spufs_inode_info *i = SPUFS_I(inode);
238 struct spu_context *ctx = i->i_ctx;
240 file->private_data = ctx;
241 file->f_mapping = inode->i_mapping;
242 ctx->cntl = inode->i_mapping;
243 return simple_attr_open(inode, file, spufs_cntl_get,
244 spufs_cntl_set, "0x%08lx");
247 static struct file_operations spufs_cntl_fops = {
248 .open = spufs_cntl_open,
249 .release = simple_attr_close,
250 .read = simple_attr_read,
251 .write = simple_attr_write,
252 .mmap = spufs_cntl_mmap,
255 static int
256 spufs_regs_open(struct inode *inode, struct file *file)
258 struct spufs_inode_info *i = SPUFS_I(inode);
259 file->private_data = i->i_ctx;
260 return 0;
263 static ssize_t
264 spufs_regs_read(struct file *file, char __user *buffer,
265 size_t size, loff_t *pos)
267 struct spu_context *ctx = file->private_data;
268 struct spu_lscsa *lscsa = ctx->csa.lscsa;
269 int ret;
271 spu_acquire_saved(ctx);
273 ret = simple_read_from_buffer(buffer, size, pos,
274 lscsa->gprs, sizeof lscsa->gprs);
276 spu_release(ctx);
277 return ret;
280 static ssize_t
281 spufs_regs_write(struct file *file, const char __user *buffer,
282 size_t size, loff_t *pos)
284 struct spu_context *ctx = file->private_data;
285 struct spu_lscsa *lscsa = ctx->csa.lscsa;
286 int ret;
288 size = min_t(ssize_t, sizeof lscsa->gprs - *pos, size);
289 if (size <= 0)
290 return -EFBIG;
291 *pos += size;
293 spu_acquire_saved(ctx);
295 ret = copy_from_user(lscsa->gprs + *pos - size,
296 buffer, size) ? -EFAULT : size;
298 spu_release(ctx);
299 return ret;
302 static struct file_operations spufs_regs_fops = {
303 .open = spufs_regs_open,
304 .read = spufs_regs_read,
305 .write = spufs_regs_write,
306 .llseek = generic_file_llseek,
309 static ssize_t
310 spufs_fpcr_read(struct file *file, char __user * buffer,
311 size_t size, loff_t * pos)
313 struct spu_context *ctx = file->private_data;
314 struct spu_lscsa *lscsa = ctx->csa.lscsa;
315 int ret;
317 spu_acquire_saved(ctx);
319 ret = simple_read_from_buffer(buffer, size, pos,
320 &lscsa->fpcr, sizeof(lscsa->fpcr));
322 spu_release(ctx);
323 return ret;
326 static ssize_t
327 spufs_fpcr_write(struct file *file, const char __user * buffer,
328 size_t size, loff_t * pos)
330 struct spu_context *ctx = file->private_data;
331 struct spu_lscsa *lscsa = ctx->csa.lscsa;
332 int ret;
334 size = min_t(ssize_t, sizeof(lscsa->fpcr) - *pos, size);
335 if (size <= 0)
336 return -EFBIG;
337 *pos += size;
339 spu_acquire_saved(ctx);
341 ret = copy_from_user((char *)&lscsa->fpcr + *pos - size,
342 buffer, size) ? -EFAULT : size;
344 spu_release(ctx);
345 return ret;
348 static struct file_operations spufs_fpcr_fops = {
349 .open = spufs_regs_open,
350 .read = spufs_fpcr_read,
351 .write = spufs_fpcr_write,
352 .llseek = generic_file_llseek,
355 /* generic open function for all pipe-like files */
356 static int spufs_pipe_open(struct inode *inode, struct file *file)
358 struct spufs_inode_info *i = SPUFS_I(inode);
359 file->private_data = i->i_ctx;
361 return nonseekable_open(inode, file);
365 * Read as many bytes from the mailbox as possible, until
366 * one of the conditions becomes true:
368 * - no more data available in the mailbox
369 * - end of the user provided buffer
370 * - end of the mapped area
372 static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
373 size_t len, loff_t *pos)
375 struct spu_context *ctx = file->private_data;
376 u32 mbox_data, __user *udata;
377 ssize_t count;
379 if (len < 4)
380 return -EINVAL;
382 if (!access_ok(VERIFY_WRITE, buf, len))
383 return -EFAULT;
385 udata = (void __user *)buf;
387 spu_acquire(ctx);
388 for (count = 0; (count + 4) <= len; count += 4, udata++) {
389 int ret;
390 ret = ctx->ops->mbox_read(ctx, &mbox_data);
391 if (ret == 0)
392 break;
395 * at the end of the mapped area, we can fault
396 * but still need to return the data we have
397 * read successfully so far.
399 ret = __put_user(mbox_data, udata);
400 if (ret) {
401 if (!count)
402 count = -EFAULT;
403 break;
406 spu_release(ctx);
408 if (!count)
409 count = -EAGAIN;
411 return count;
414 static struct file_operations spufs_mbox_fops = {
415 .open = spufs_pipe_open,
416 .read = spufs_mbox_read,
419 static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
420 size_t len, loff_t *pos)
422 struct spu_context *ctx = file->private_data;
423 u32 mbox_stat;
425 if (len < 4)
426 return -EINVAL;
428 spu_acquire(ctx);
430 mbox_stat = ctx->ops->mbox_stat_read(ctx) & 0xff;
432 spu_release(ctx);
434 if (copy_to_user(buf, &mbox_stat, sizeof mbox_stat))
435 return -EFAULT;
437 return 4;
440 static struct file_operations spufs_mbox_stat_fops = {
441 .open = spufs_pipe_open,
442 .read = spufs_mbox_stat_read,
445 /* low-level ibox access function */
446 size_t spu_ibox_read(struct spu_context *ctx, u32 *data)
448 return ctx->ops->ibox_read(ctx, data);
451 static int spufs_ibox_fasync(int fd, struct file *file, int on)
453 struct spu_context *ctx = file->private_data;
455 return fasync_helper(fd, file, on, &ctx->ibox_fasync);
458 /* interrupt-level ibox callback function. */
459 void spufs_ibox_callback(struct spu *spu)
461 struct spu_context *ctx = spu->ctx;
463 wake_up_all(&ctx->ibox_wq);
464 kill_fasync(&ctx->ibox_fasync, SIGIO, POLLIN);
468 * Read as many bytes from the interrupt mailbox as possible, until
469 * one of the conditions becomes true:
471 * - no more data available in the mailbox
472 * - end of the user provided buffer
473 * - end of the mapped area
475 * If the file is opened without O_NONBLOCK, we wait here until
476 * any data is available, but return when we have been able to
477 * read something.
479 static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
480 size_t len, loff_t *pos)
482 struct spu_context *ctx = file->private_data;
483 u32 ibox_data, __user *udata;
484 ssize_t count;
486 if (len < 4)
487 return -EINVAL;
489 if (!access_ok(VERIFY_WRITE, buf, len))
490 return -EFAULT;
492 udata = (void __user *)buf;
494 spu_acquire(ctx);
496 /* wait only for the first element */
497 count = 0;
498 if (file->f_flags & O_NONBLOCK) {
499 if (!spu_ibox_read(ctx, &ibox_data))
500 count = -EAGAIN;
501 } else {
502 count = spufs_wait(ctx->ibox_wq, spu_ibox_read(ctx, &ibox_data));
504 if (count)
505 goto out;
507 /* if we can't write at all, return -EFAULT */
508 count = __put_user(ibox_data, udata);
509 if (count)
510 goto out;
512 for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) {
513 int ret;
514 ret = ctx->ops->ibox_read(ctx, &ibox_data);
515 if (ret == 0)
516 break;
518 * at the end of the mapped area, we can fault
519 * but still need to return the data we have
520 * read successfully so far.
522 ret = __put_user(ibox_data, udata);
523 if (ret)
524 break;
527 out:
528 spu_release(ctx);
530 return count;
533 static unsigned int spufs_ibox_poll(struct file *file, poll_table *wait)
535 struct spu_context *ctx = file->private_data;
536 unsigned int mask;
538 poll_wait(file, &ctx->ibox_wq, wait);
540 spu_acquire(ctx);
541 mask = ctx->ops->mbox_stat_poll(ctx, POLLIN | POLLRDNORM);
542 spu_release(ctx);
544 return mask;
547 static struct file_operations spufs_ibox_fops = {
548 .open = spufs_pipe_open,
549 .read = spufs_ibox_read,
550 .poll = spufs_ibox_poll,
551 .fasync = spufs_ibox_fasync,
554 static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
555 size_t len, loff_t *pos)
557 struct spu_context *ctx = file->private_data;
558 u32 ibox_stat;
560 if (len < 4)
561 return -EINVAL;
563 spu_acquire(ctx);
564 ibox_stat = (ctx->ops->mbox_stat_read(ctx) >> 16) & 0xff;
565 spu_release(ctx);
567 if (copy_to_user(buf, &ibox_stat, sizeof ibox_stat))
568 return -EFAULT;
570 return 4;
573 static struct file_operations spufs_ibox_stat_fops = {
574 .open = spufs_pipe_open,
575 .read = spufs_ibox_stat_read,
578 /* low-level mailbox write */
579 size_t spu_wbox_write(struct spu_context *ctx, u32 data)
581 return ctx->ops->wbox_write(ctx, data);
584 static int spufs_wbox_fasync(int fd, struct file *file, int on)
586 struct spu_context *ctx = file->private_data;
587 int ret;
589 ret = fasync_helper(fd, file, on, &ctx->wbox_fasync);
591 return ret;
594 /* interrupt-level wbox callback function. */
595 void spufs_wbox_callback(struct spu *spu)
597 struct spu_context *ctx = spu->ctx;
599 wake_up_all(&ctx->wbox_wq);
600 kill_fasync(&ctx->wbox_fasync, SIGIO, POLLOUT);
604 * Write as many bytes to the interrupt mailbox as possible, until
605 * one of the conditions becomes true:
607 * - the mailbox is full
608 * - end of the user provided buffer
609 * - end of the mapped area
611 * If the file is opened without O_NONBLOCK, we wait here until
612 * space is availabyl, but return when we have been able to
613 * write something.
615 static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
616 size_t len, loff_t *pos)
618 struct spu_context *ctx = file->private_data;
619 u32 wbox_data, __user *udata;
620 ssize_t count;
622 if (len < 4)
623 return -EINVAL;
625 udata = (void __user *)buf;
626 if (!access_ok(VERIFY_READ, buf, len))
627 return -EFAULT;
629 if (__get_user(wbox_data, udata))
630 return -EFAULT;
632 spu_acquire(ctx);
635 * make sure we can at least write one element, by waiting
636 * in case of !O_NONBLOCK
638 count = 0;
639 if (file->f_flags & O_NONBLOCK) {
640 if (!spu_wbox_write(ctx, wbox_data))
641 count = -EAGAIN;
642 } else {
643 count = spufs_wait(ctx->wbox_wq, spu_wbox_write(ctx, wbox_data));
646 if (count)
647 goto out;
649 /* write aѕ much as possible */
650 for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) {
651 int ret;
652 ret = __get_user(wbox_data, udata);
653 if (ret)
654 break;
656 ret = spu_wbox_write(ctx, wbox_data);
657 if (ret == 0)
658 break;
661 out:
662 spu_release(ctx);
663 return count;
666 static unsigned int spufs_wbox_poll(struct file *file, poll_table *wait)
668 struct spu_context *ctx = file->private_data;
669 unsigned int mask;
671 poll_wait(file, &ctx->wbox_wq, wait);
673 spu_acquire(ctx);
674 mask = ctx->ops->mbox_stat_poll(ctx, POLLOUT | POLLWRNORM);
675 spu_release(ctx);
677 return mask;
680 static struct file_operations spufs_wbox_fops = {
681 .open = spufs_pipe_open,
682 .write = spufs_wbox_write,
683 .poll = spufs_wbox_poll,
684 .fasync = spufs_wbox_fasync,
687 static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
688 size_t len, loff_t *pos)
690 struct spu_context *ctx = file->private_data;
691 u32 wbox_stat;
693 if (len < 4)
694 return -EINVAL;
696 spu_acquire(ctx);
697 wbox_stat = (ctx->ops->mbox_stat_read(ctx) >> 8) & 0xff;
698 spu_release(ctx);
700 if (copy_to_user(buf, &wbox_stat, sizeof wbox_stat))
701 return -EFAULT;
703 return 4;
706 static struct file_operations spufs_wbox_stat_fops = {
707 .open = spufs_pipe_open,
708 .read = spufs_wbox_stat_read,
711 static int spufs_signal1_open(struct inode *inode, struct file *file)
713 struct spufs_inode_info *i = SPUFS_I(inode);
714 struct spu_context *ctx = i->i_ctx;
715 file->private_data = ctx;
716 file->f_mapping = inode->i_mapping;
717 ctx->signal1 = inode->i_mapping;
718 return nonseekable_open(inode, file);
721 static ssize_t spufs_signal1_read(struct file *file, char __user *buf,
722 size_t len, loff_t *pos)
724 struct spu_context *ctx = file->private_data;
725 u32 data;
727 if (len < 4)
728 return -EINVAL;
730 spu_acquire(ctx);
731 data = ctx->ops->signal1_read(ctx);
732 spu_release(ctx);
734 if (copy_to_user(buf, &data, 4))
735 return -EFAULT;
737 return 4;
740 static ssize_t spufs_signal1_write(struct file *file, const char __user *buf,
741 size_t len, loff_t *pos)
743 struct spu_context *ctx;
744 u32 data;
746 ctx = file->private_data;
748 if (len < 4)
749 return -EINVAL;
751 if (copy_from_user(&data, buf, 4))
752 return -EFAULT;
754 spu_acquire(ctx);
755 ctx->ops->signal1_write(ctx, data);
756 spu_release(ctx);
758 return 4;
761 static struct page *spufs_signal1_mmap_nopage(struct vm_area_struct *vma,
762 unsigned long address, int *type)
764 #if PAGE_SIZE == 0x1000
765 return spufs_ps_nopage(vma, address, type, 0x14000, 0x1000);
766 #elif PAGE_SIZE == 0x10000
767 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole
768 * signal 1 and 2 area
770 return spufs_ps_nopage(vma, address, type, 0x10000, 0x10000);
771 #else
772 #error unsupported page size
773 #endif
776 static struct vm_operations_struct spufs_signal1_mmap_vmops = {
777 .nopage = spufs_signal1_mmap_nopage,
780 static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
782 if (!(vma->vm_flags & VM_SHARED))
783 return -EINVAL;
785 vma->vm_flags |= VM_RESERVED;
786 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
787 | _PAGE_NO_CACHE | _PAGE_GUARDED);
789 vma->vm_ops = &spufs_signal1_mmap_vmops;
790 return 0;
793 static struct file_operations spufs_signal1_fops = {
794 .open = spufs_signal1_open,
795 .read = spufs_signal1_read,
796 .write = spufs_signal1_write,
797 .mmap = spufs_signal1_mmap,
800 static int spufs_signal2_open(struct inode *inode, struct file *file)
802 struct spufs_inode_info *i = SPUFS_I(inode);
803 struct spu_context *ctx = i->i_ctx;
804 file->private_data = ctx;
805 file->f_mapping = inode->i_mapping;
806 ctx->signal2 = inode->i_mapping;
807 return nonseekable_open(inode, file);
810 static ssize_t spufs_signal2_read(struct file *file, char __user *buf,
811 size_t len, loff_t *pos)
813 struct spu_context *ctx;
814 u32 data;
816 ctx = file->private_data;
818 if (len < 4)
819 return -EINVAL;
821 spu_acquire(ctx);
822 data = ctx->ops->signal2_read(ctx);
823 spu_release(ctx);
825 if (copy_to_user(buf, &data, 4))
826 return -EFAULT;
828 return 4;
831 static ssize_t spufs_signal2_write(struct file *file, const char __user *buf,
832 size_t len, loff_t *pos)
834 struct spu_context *ctx;
835 u32 data;
837 ctx = file->private_data;
839 if (len < 4)
840 return -EINVAL;
842 if (copy_from_user(&data, buf, 4))
843 return -EFAULT;
845 spu_acquire(ctx);
846 ctx->ops->signal2_write(ctx, data);
847 spu_release(ctx);
849 return 4;
852 #if SPUFS_MMAP_4K
853 static struct page *spufs_signal2_mmap_nopage(struct vm_area_struct *vma,
854 unsigned long address, int *type)
856 #if PAGE_SIZE == 0x1000
857 return spufs_ps_nopage(vma, address, type, 0x1c000, 0x1000);
858 #elif PAGE_SIZE == 0x10000
859 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole
860 * signal 1 and 2 area
862 return spufs_ps_nopage(vma, address, type, 0x10000, 0x10000);
863 #else
864 #error unsupported page size
865 #endif
868 static struct vm_operations_struct spufs_signal2_mmap_vmops = {
869 .nopage = spufs_signal2_mmap_nopage,
872 static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
874 if (!(vma->vm_flags & VM_SHARED))
875 return -EINVAL;
877 /* FIXME: */
878 vma->vm_flags |= VM_RESERVED;
879 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
880 | _PAGE_NO_CACHE | _PAGE_GUARDED);
882 vma->vm_ops = &spufs_signal2_mmap_vmops;
883 return 0;
885 #else /* SPUFS_MMAP_4K */
886 #define spufs_signal2_mmap NULL
887 #endif /* !SPUFS_MMAP_4K */
889 static struct file_operations spufs_signal2_fops = {
890 .open = spufs_signal2_open,
891 .read = spufs_signal2_read,
892 .write = spufs_signal2_write,
893 .mmap = spufs_signal2_mmap,
896 static void spufs_signal1_type_set(void *data, u64 val)
898 struct spu_context *ctx = data;
900 spu_acquire(ctx);
901 ctx->ops->signal1_type_set(ctx, val);
902 spu_release(ctx);
905 static u64 spufs_signal1_type_get(void *data)
907 struct spu_context *ctx = data;
908 u64 ret;
910 spu_acquire(ctx);
911 ret = ctx->ops->signal1_type_get(ctx);
912 spu_release(ctx);
914 return ret;
916 DEFINE_SIMPLE_ATTRIBUTE(spufs_signal1_type, spufs_signal1_type_get,
917 spufs_signal1_type_set, "%llu");
919 static void spufs_signal2_type_set(void *data, u64 val)
921 struct spu_context *ctx = data;
923 spu_acquire(ctx);
924 ctx->ops->signal2_type_set(ctx, val);
925 spu_release(ctx);
928 static u64 spufs_signal2_type_get(void *data)
930 struct spu_context *ctx = data;
931 u64 ret;
933 spu_acquire(ctx);
934 ret = ctx->ops->signal2_type_get(ctx);
935 spu_release(ctx);
937 return ret;
939 DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
940 spufs_signal2_type_set, "%llu");
942 #if SPUFS_MMAP_4K
943 static struct page *spufs_mss_mmap_nopage(struct vm_area_struct *vma,
944 unsigned long address, int *type)
946 return spufs_ps_nopage(vma, address, type, 0x0000, 0x1000);
949 static struct vm_operations_struct spufs_mss_mmap_vmops = {
950 .nopage = spufs_mss_mmap_nopage,
954 * mmap support for problem state MFC DMA area [0x0000 - 0x0fff].
956 static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma)
958 if (!(vma->vm_flags & VM_SHARED))
959 return -EINVAL;
961 vma->vm_flags |= VM_RESERVED;
962 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
963 | _PAGE_NO_CACHE | _PAGE_GUARDED);
965 vma->vm_ops = &spufs_mss_mmap_vmops;
966 return 0;
968 #else /* SPUFS_MMAP_4K */
969 #define spufs_mss_mmap NULL
970 #endif /* !SPUFS_MMAP_4K */
972 static int spufs_mss_open(struct inode *inode, struct file *file)
974 struct spufs_inode_info *i = SPUFS_I(inode);
976 file->private_data = i->i_ctx;
977 return nonseekable_open(inode, file);
980 static struct file_operations spufs_mss_fops = {
981 .open = spufs_mss_open,
982 .mmap = spufs_mss_mmap,
985 static struct page *spufs_psmap_mmap_nopage(struct vm_area_struct *vma,
986 unsigned long address, int *type)
988 return spufs_ps_nopage(vma, address, type, 0x0000, 0x20000);
991 static struct vm_operations_struct spufs_psmap_mmap_vmops = {
992 .nopage = spufs_psmap_mmap_nopage,
996 * mmap support for full problem state area [0x00000 - 0x1ffff].
998 static int spufs_psmap_mmap(struct file *file, struct vm_area_struct *vma)
1000 if (!(vma->vm_flags & VM_SHARED))
1001 return -EINVAL;
1003 vma->vm_flags |= VM_RESERVED;
1004 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
1005 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1007 vma->vm_ops = &spufs_psmap_mmap_vmops;
1008 return 0;
1011 static int spufs_psmap_open(struct inode *inode, struct file *file)
1013 struct spufs_inode_info *i = SPUFS_I(inode);
1015 file->private_data = i->i_ctx;
1016 return nonseekable_open(inode, file);
1019 static struct file_operations spufs_psmap_fops = {
1020 .open = spufs_psmap_open,
1021 .mmap = spufs_psmap_mmap,
1025 #if SPUFS_MMAP_4K
1026 static struct page *spufs_mfc_mmap_nopage(struct vm_area_struct *vma,
1027 unsigned long address, int *type)
1029 return spufs_ps_nopage(vma, address, type, 0x3000, 0x1000);
1032 static struct vm_operations_struct spufs_mfc_mmap_vmops = {
1033 .nopage = spufs_mfc_mmap_nopage,
1037 * mmap support for problem state MFC DMA area [0x0000 - 0x0fff].
1039 static int spufs_mfc_mmap(struct file *file, struct vm_area_struct *vma)
1041 if (!(vma->vm_flags & VM_SHARED))
1042 return -EINVAL;
1044 vma->vm_flags |= VM_RESERVED;
1045 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
1046 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1048 vma->vm_ops = &spufs_mfc_mmap_vmops;
1049 return 0;
1051 #else /* SPUFS_MMAP_4K */
1052 #define spufs_mfc_mmap NULL
1053 #endif /* !SPUFS_MMAP_4K */
1055 static int spufs_mfc_open(struct inode *inode, struct file *file)
1057 struct spufs_inode_info *i = SPUFS_I(inode);
1058 struct spu_context *ctx = i->i_ctx;
1060 /* we don't want to deal with DMA into other processes */
1061 if (ctx->owner != current->mm)
1062 return -EINVAL;
1064 if (atomic_read(&inode->i_count) != 1)
1065 return -EBUSY;
1067 file->private_data = ctx;
1068 return nonseekable_open(inode, file);
1071 /* interrupt-level mfc callback function. */
1072 void spufs_mfc_callback(struct spu *spu)
1074 struct spu_context *ctx = spu->ctx;
1076 wake_up_all(&ctx->mfc_wq);
1078 pr_debug("%s %s\n", __FUNCTION__, spu->name);
1079 if (ctx->mfc_fasync) {
1080 u32 free_elements, tagstatus;
1081 unsigned int mask;
1083 /* no need for spu_acquire in interrupt context */
1084 free_elements = ctx->ops->get_mfc_free_elements(ctx);
1085 tagstatus = ctx->ops->read_mfc_tagstatus(ctx);
1087 mask = 0;
1088 if (free_elements & 0xffff)
1089 mask |= POLLOUT;
1090 if (tagstatus & ctx->tagwait)
1091 mask |= POLLIN;
1093 kill_fasync(&ctx->mfc_fasync, SIGIO, mask);
1097 static int spufs_read_mfc_tagstatus(struct spu_context *ctx, u32 *status)
1099 /* See if there is one tag group is complete */
1100 /* FIXME we need locking around tagwait */
1101 *status = ctx->ops->read_mfc_tagstatus(ctx) & ctx->tagwait;
1102 ctx->tagwait &= ~*status;
1103 if (*status)
1104 return 1;
1106 /* enable interrupt waiting for any tag group,
1107 may silently fail if interrupts are already enabled */
1108 ctx->ops->set_mfc_query(ctx, ctx->tagwait, 1);
1109 return 0;
1112 static ssize_t spufs_mfc_read(struct file *file, char __user *buffer,
1113 size_t size, loff_t *pos)
1115 struct spu_context *ctx = file->private_data;
1116 int ret = -EINVAL;
1117 u32 status;
1119 if (size != 4)
1120 goto out;
1122 spu_acquire(ctx);
1123 if (file->f_flags & O_NONBLOCK) {
1124 status = ctx->ops->read_mfc_tagstatus(ctx);
1125 if (!(status & ctx->tagwait))
1126 ret = -EAGAIN;
1127 else
1128 ctx->tagwait &= ~status;
1129 } else {
1130 ret = spufs_wait(ctx->mfc_wq,
1131 spufs_read_mfc_tagstatus(ctx, &status));
1133 spu_release(ctx);
1135 if (ret)
1136 goto out;
1138 ret = 4;
1139 if (copy_to_user(buffer, &status, 4))
1140 ret = -EFAULT;
1142 out:
1143 return ret;
1146 static int spufs_check_valid_dma(struct mfc_dma_command *cmd)
1148 pr_debug("queueing DMA %x %lx %x %x %x\n", cmd->lsa,
1149 cmd->ea, cmd->size, cmd->tag, cmd->cmd);
1151 switch (cmd->cmd) {
1152 case MFC_PUT_CMD:
1153 case MFC_PUTF_CMD:
1154 case MFC_PUTB_CMD:
1155 case MFC_GET_CMD:
1156 case MFC_GETF_CMD:
1157 case MFC_GETB_CMD:
1158 break;
1159 default:
1160 pr_debug("invalid DMA opcode %x\n", cmd->cmd);
1161 return -EIO;
1164 if ((cmd->lsa & 0xf) != (cmd->ea &0xf)) {
1165 pr_debug("invalid DMA alignment, ea %lx lsa %x\n",
1166 cmd->ea, cmd->lsa);
1167 return -EIO;
1170 switch (cmd->size & 0xf) {
1171 case 1:
1172 break;
1173 case 2:
1174 if (cmd->lsa & 1)
1175 goto error;
1176 break;
1177 case 4:
1178 if (cmd->lsa & 3)
1179 goto error;
1180 break;
1181 case 8:
1182 if (cmd->lsa & 7)
1183 goto error;
1184 break;
1185 case 0:
1186 if (cmd->lsa & 15)
1187 goto error;
1188 break;
1189 error:
1190 default:
1191 pr_debug("invalid DMA alignment %x for size %x\n",
1192 cmd->lsa & 0xf, cmd->size);
1193 return -EIO;
1196 if (cmd->size > 16 * 1024) {
1197 pr_debug("invalid DMA size %x\n", cmd->size);
1198 return -EIO;
1201 if (cmd->tag & 0xfff0) {
1202 /* we reserve the higher tag numbers for kernel use */
1203 pr_debug("invalid DMA tag\n");
1204 return -EIO;
1207 if (cmd->class) {
1208 /* not supported in this version */
1209 pr_debug("invalid DMA class\n");
1210 return -EIO;
1213 return 0;
1216 static int spu_send_mfc_command(struct spu_context *ctx,
1217 struct mfc_dma_command cmd,
1218 int *error)
1220 *error = ctx->ops->send_mfc_command(ctx, &cmd);
1221 if (*error == -EAGAIN) {
1222 /* wait for any tag group to complete
1223 so we have space for the new command */
1224 ctx->ops->set_mfc_query(ctx, ctx->tagwait, 1);
1225 /* try again, because the queue might be
1226 empty again */
1227 *error = ctx->ops->send_mfc_command(ctx, &cmd);
1228 if (*error == -EAGAIN)
1229 return 0;
1231 return 1;
1234 static ssize_t spufs_mfc_write(struct file *file, const char __user *buffer,
1235 size_t size, loff_t *pos)
1237 struct spu_context *ctx = file->private_data;
1238 struct mfc_dma_command cmd;
1239 int ret = -EINVAL;
1241 if (size != sizeof cmd)
1242 goto out;
1244 ret = -EFAULT;
1245 if (copy_from_user(&cmd, buffer, sizeof cmd))
1246 goto out;
1248 ret = spufs_check_valid_dma(&cmd);
1249 if (ret)
1250 goto out;
1252 spu_acquire_runnable(ctx);
1253 if (file->f_flags & O_NONBLOCK) {
1254 ret = ctx->ops->send_mfc_command(ctx, &cmd);
1255 } else {
1256 int status;
1257 ret = spufs_wait(ctx->mfc_wq,
1258 spu_send_mfc_command(ctx, cmd, &status));
1259 if (status)
1260 ret = status;
1262 spu_release(ctx);
1264 if (ret)
1265 goto out;
1267 ctx->tagwait |= 1 << cmd.tag;
1269 out:
1270 return ret;
1273 static unsigned int spufs_mfc_poll(struct file *file,poll_table *wait)
1275 struct spu_context *ctx = file->private_data;
1276 u32 free_elements, tagstatus;
1277 unsigned int mask;
1279 spu_acquire(ctx);
1280 ctx->ops->set_mfc_query(ctx, ctx->tagwait, 2);
1281 free_elements = ctx->ops->get_mfc_free_elements(ctx);
1282 tagstatus = ctx->ops->read_mfc_tagstatus(ctx);
1283 spu_release(ctx);
1285 poll_wait(file, &ctx->mfc_wq, wait);
1287 mask = 0;
1288 if (free_elements & 0xffff)
1289 mask |= POLLOUT | POLLWRNORM;
1290 if (tagstatus & ctx->tagwait)
1291 mask |= POLLIN | POLLRDNORM;
1293 pr_debug("%s: free %d tagstatus %d tagwait %d\n", __FUNCTION__,
1294 free_elements, tagstatus, ctx->tagwait);
1296 return mask;
1299 static int spufs_mfc_flush(struct file *file, fl_owner_t id)
1301 struct spu_context *ctx = file->private_data;
1302 int ret;
1304 spu_acquire(ctx);
1305 #if 0
1306 /* this currently hangs */
1307 ret = spufs_wait(ctx->mfc_wq,
1308 ctx->ops->set_mfc_query(ctx, ctx->tagwait, 2));
1309 if (ret)
1310 goto out;
1311 ret = spufs_wait(ctx->mfc_wq,
1312 ctx->ops->read_mfc_tagstatus(ctx) == ctx->tagwait);
1313 out:
1314 #else
1315 ret = 0;
1316 #endif
1317 spu_release(ctx);
1319 return ret;
1322 static int spufs_mfc_fsync(struct file *file, struct dentry *dentry,
1323 int datasync)
1325 return spufs_mfc_flush(file, NULL);
1328 static int spufs_mfc_fasync(int fd, struct file *file, int on)
1330 struct spu_context *ctx = file->private_data;
1332 return fasync_helper(fd, file, on, &ctx->mfc_fasync);
1335 static struct file_operations spufs_mfc_fops = {
1336 .open = spufs_mfc_open,
1337 .read = spufs_mfc_read,
1338 .write = spufs_mfc_write,
1339 .poll = spufs_mfc_poll,
1340 .flush = spufs_mfc_flush,
1341 .fsync = spufs_mfc_fsync,
1342 .fasync = spufs_mfc_fasync,
1343 .mmap = spufs_mfc_mmap,
1347 static int spufs_recycle_open(struct inode *inode, struct file *file)
1349 file->private_data = SPUFS_I(inode)->i_ctx;
1350 return nonseekable_open(inode, file);
1353 static ssize_t spufs_recycle_write(struct file *file,
1354 const char __user *buffer, size_t size, loff_t *pos)
1356 struct spu_context *ctx = file->private_data;
1357 int ret;
1359 if (!(ctx->flags & SPU_CREATE_ISOLATE))
1360 return -EINVAL;
1362 if (size < 1)
1363 return -EINVAL;
1365 ret = spu_recycle_isolated(ctx);
1367 if (ret)
1368 return ret;
1369 return size;
1372 static struct file_operations spufs_recycle_fops = {
1373 .open = spufs_recycle_open,
1374 .write = spufs_recycle_write,
1377 static void spufs_npc_set(void *data, u64 val)
1379 struct spu_context *ctx = data;
1380 spu_acquire(ctx);
1381 ctx->ops->npc_write(ctx, val);
1382 spu_release(ctx);
1385 static u64 spufs_npc_get(void *data)
1387 struct spu_context *ctx = data;
1388 u64 ret;
1389 spu_acquire(ctx);
1390 ret = ctx->ops->npc_read(ctx);
1391 spu_release(ctx);
1392 return ret;
1394 DEFINE_SIMPLE_ATTRIBUTE(spufs_npc_ops, spufs_npc_get, spufs_npc_set,
1395 "0x%llx\n")
1397 static void spufs_decr_set(void *data, u64 val)
1399 struct spu_context *ctx = data;
1400 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1401 spu_acquire_saved(ctx);
1402 lscsa->decr.slot[0] = (u32) val;
1403 spu_release(ctx);
1406 static u64 spufs_decr_get(void *data)
1408 struct spu_context *ctx = data;
1409 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1410 u64 ret;
1411 spu_acquire_saved(ctx);
1412 ret = lscsa->decr.slot[0];
1413 spu_release(ctx);
1414 return ret;
1416 DEFINE_SIMPLE_ATTRIBUTE(spufs_decr_ops, spufs_decr_get, spufs_decr_set,
1417 "0x%llx\n")
1419 static void spufs_decr_status_set(void *data, u64 val)
1421 struct spu_context *ctx = data;
1422 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1423 spu_acquire_saved(ctx);
1424 lscsa->decr_status.slot[0] = (u32) val;
1425 spu_release(ctx);
1428 static u64 spufs_decr_status_get(void *data)
1430 struct spu_context *ctx = data;
1431 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1432 u64 ret;
1433 spu_acquire_saved(ctx);
1434 ret = lscsa->decr_status.slot[0];
1435 spu_release(ctx);
1436 return ret;
1438 DEFINE_SIMPLE_ATTRIBUTE(spufs_decr_status_ops, spufs_decr_status_get,
1439 spufs_decr_status_set, "0x%llx\n")
1441 static void spufs_spu_tag_mask_set(void *data, u64 val)
1443 struct spu_context *ctx = data;
1444 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1445 spu_acquire_saved(ctx);
1446 lscsa->tag_mask.slot[0] = (u32) val;
1447 spu_release(ctx);
1450 static u64 spufs_spu_tag_mask_get(void *data)
1452 struct spu_context *ctx = data;
1453 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1454 u64 ret;
1455 spu_acquire_saved(ctx);
1456 ret = lscsa->tag_mask.slot[0];
1457 spu_release(ctx);
1458 return ret;
1460 DEFINE_SIMPLE_ATTRIBUTE(spufs_spu_tag_mask_ops, spufs_spu_tag_mask_get,
1461 spufs_spu_tag_mask_set, "0x%llx\n")
1463 static void spufs_event_mask_set(void *data, u64 val)
1465 struct spu_context *ctx = data;
1466 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1467 spu_acquire_saved(ctx);
1468 lscsa->event_mask.slot[0] = (u32) val;
1469 spu_release(ctx);
1472 static u64 spufs_event_mask_get(void *data)
1474 struct spu_context *ctx = data;
1475 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1476 u64 ret;
1477 spu_acquire_saved(ctx);
1478 ret = lscsa->event_mask.slot[0];
1479 spu_release(ctx);
1480 return ret;
1482 DEFINE_SIMPLE_ATTRIBUTE(spufs_event_mask_ops, spufs_event_mask_get,
1483 spufs_event_mask_set, "0x%llx\n")
1485 static void spufs_srr0_set(void *data, u64 val)
1487 struct spu_context *ctx = data;
1488 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1489 spu_acquire_saved(ctx);
1490 lscsa->srr0.slot[0] = (u32) val;
1491 spu_release(ctx);
1494 static u64 spufs_srr0_get(void *data)
1496 struct spu_context *ctx = data;
1497 struct spu_lscsa *lscsa = ctx->csa.lscsa;
1498 u64 ret;
1499 spu_acquire_saved(ctx);
1500 ret = lscsa->srr0.slot[0];
1501 spu_release(ctx);
1502 return ret;
1504 DEFINE_SIMPLE_ATTRIBUTE(spufs_srr0_ops, spufs_srr0_get, spufs_srr0_set,
1505 "0x%llx\n")
1507 static u64 spufs_id_get(void *data)
1509 struct spu_context *ctx = data;
1510 u64 num;
1512 spu_acquire(ctx);
1513 if (ctx->state == SPU_STATE_RUNNABLE)
1514 num = ctx->spu->number;
1515 else
1516 num = (unsigned int)-1;
1517 spu_release(ctx);
1519 return num;
1521 DEFINE_SIMPLE_ATTRIBUTE(spufs_id_ops, spufs_id_get, NULL, "0x%llx\n")
1523 static u64 spufs_object_id_get(void *data)
1525 struct spu_context *ctx = data;
1526 return ctx->object_id;
1529 static void spufs_object_id_set(void *data, u64 id)
1531 struct spu_context *ctx = data;
1532 ctx->object_id = id;
1535 DEFINE_SIMPLE_ATTRIBUTE(spufs_object_id_ops, spufs_object_id_get,
1536 spufs_object_id_set, "0x%llx\n");
1538 struct tree_descr spufs_dir_contents[] = {
1539 { "mem", &spufs_mem_fops, 0666, },
1540 { "regs", &spufs_regs_fops, 0666, },
1541 { "mbox", &spufs_mbox_fops, 0444, },
1542 { "ibox", &spufs_ibox_fops, 0444, },
1543 { "wbox", &spufs_wbox_fops, 0222, },
1544 { "mbox_stat", &spufs_mbox_stat_fops, 0444, },
1545 { "ibox_stat", &spufs_ibox_stat_fops, 0444, },
1546 { "wbox_stat", &spufs_wbox_stat_fops, 0444, },
1547 { "signal1", &spufs_signal1_fops, 0666, },
1548 { "signal2", &spufs_signal2_fops, 0666, },
1549 { "signal1_type", &spufs_signal1_type, 0666, },
1550 { "signal2_type", &spufs_signal2_type, 0666, },
1551 { "mss", &spufs_mss_fops, 0666, },
1552 { "mfc", &spufs_mfc_fops, 0666, },
1553 { "cntl", &spufs_cntl_fops, 0666, },
1554 { "npc", &spufs_npc_ops, 0666, },
1555 { "fpcr", &spufs_fpcr_fops, 0666, },
1556 { "decr", &spufs_decr_ops, 0666, },
1557 { "decr_status", &spufs_decr_status_ops, 0666, },
1558 { "spu_tag_mask", &spufs_spu_tag_mask_ops, 0666, },
1559 { "event_mask", &spufs_event_mask_ops, 0666, },
1560 { "srr0", &spufs_srr0_ops, 0666, },
1561 { "psmap", &spufs_psmap_fops, 0666, },
1562 { "phys-id", &spufs_id_ops, 0666, },
1563 { "object-id", &spufs_object_id_ops, 0666, },
1567 struct tree_descr spufs_dir_nosched_contents[] = {
1568 { "mem", &spufs_mem_fops, 0666, },
1569 { "mbox", &spufs_mbox_fops, 0444, },
1570 { "ibox", &spufs_ibox_fops, 0444, },
1571 { "wbox", &spufs_wbox_fops, 0222, },
1572 { "mbox_stat", &spufs_mbox_stat_fops, 0444, },
1573 { "ibox_stat", &spufs_ibox_stat_fops, 0444, },
1574 { "wbox_stat", &spufs_wbox_stat_fops, 0444, },
1575 { "signal1", &spufs_signal1_fops, 0666, },
1576 { "signal2", &spufs_signal2_fops, 0666, },
1577 { "signal1_type", &spufs_signal1_type, 0666, },
1578 { "signal2_type", &spufs_signal2_type, 0666, },
1579 { "mss", &spufs_mss_fops, 0666, },
1580 { "mfc", &spufs_mfc_fops, 0666, },
1581 { "cntl", &spufs_cntl_fops, 0666, },
1582 { "npc", &spufs_npc_ops, 0666, },
1583 { "psmap", &spufs_psmap_fops, 0666, },
1584 { "phys-id", &spufs_id_ops, 0666, },
1585 { "object-id", &spufs_object_id_ops, 0666, },
1586 { "recycle", &spufs_recycle_fops, 0222, },