aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/file.c
diff options
context:
space:
mode:
authorarnd@arndb.de <arnd@arndb.de>2006-06-19 14:33:21 -0400
committerPaul Mackerras <paulus@samba.org>2006-06-21 01:01:30 -0400
commitd9379c4bcee7046182edf45eeab349334421416e (patch)
treeda337ebe3f683b5717a591175376e4426f908072 /arch/powerpc/platforms/cell/spufs/file.c
parent91edfa49b97f0b0fafac5c8d5f171fc183782ce6 (diff)
[POWERPC] spufs: restore mapping of mssync register
A recent change to the way that the mfc file gets mapped made it impossible to map the SPE Multi-Source Synchronization register into user space, but that may be needed by some applications. This restores the missing functionality. Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/file.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 366185e92667..3bc00913fe18 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -825,6 +825,55 @@ DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
825 spufs_signal2_type_set, "%llu"); 825 spufs_signal2_type_set, "%llu");
826 826
827#ifdef CONFIG_SPUFS_MMAP 827#ifdef CONFIG_SPUFS_MMAP
828static struct page *spufs_mss_mmap_nopage(struct vm_area_struct *vma,
829 unsigned long address, int *type)
830{
831 return spufs_ps_nopage(vma, address, type, 0x0000);
832}
833
834static struct vm_operations_struct spufs_mss_mmap_vmops = {
835 .nopage = spufs_mss_mmap_nopage,
836};
837
838/*
839 * mmap support for problem state MFC DMA area [0x0000 - 0x0fff].
840 * Mapping this area requires that the application have CAP_SYS_RAWIO,
841 * as these registers require special care when read/writing.
842 */
843static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma)
844{
845 if (!(vma->vm_flags & VM_SHARED))
846 return -EINVAL;
847
848 if (!capable(CAP_SYS_RAWIO))
849 return -EPERM;
850
851 vma->vm_flags |= VM_RESERVED;
852 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
853 | _PAGE_NO_CACHE);
854
855 vma->vm_ops = &spufs_mss_mmap_vmops;
856 return 0;
857}
858#endif
859
860static int spufs_mss_open(struct inode *inode, struct file *file)
861{
862 struct spufs_inode_info *i = SPUFS_I(inode);
863
864 file->private_data = i->i_ctx;
865 return nonseekable_open(inode, file);
866}
867
868static struct file_operations spufs_mss_fops = {
869 .open = spufs_mss_open,
870#ifdef CONFIG_SPUFS_MMAP
871 .mmap = spufs_mss_mmap,
872#endif
873};
874
875
876#ifdef CONFIG_SPUFS_MMAP
828static struct page *spufs_mfc_mmap_nopage(struct vm_area_struct *vma, 877static struct page *spufs_mfc_mmap_nopage(struct vm_area_struct *vma,
829 unsigned long address, int *type) 878 unsigned long address, int *type)
830{ 879{
@@ -1292,6 +1341,7 @@ struct tree_descr spufs_dir_contents[] = {
1292 { "signal2", &spufs_signal2_fops, 0666, }, 1341 { "signal2", &spufs_signal2_fops, 0666, },
1293 { "signal1_type", &spufs_signal1_type, 0666, }, 1342 { "signal1_type", &spufs_signal1_type, 0666, },
1294 { "signal2_type", &spufs_signal2_type, 0666, }, 1343 { "signal2_type", &spufs_signal2_type, 0666, },
1344 { "mss", &spufs_mss_fops, 0666, },
1295 { "mfc", &spufs_mfc_fops, 0666, }, 1345 { "mfc", &spufs_mfc_fops, 0666, },
1296 { "cntl", &spufs_cntl_fops, 0666, }, 1346 { "cntl", &spufs_cntl_fops, 0666, },
1297 { "npc", &spufs_npc_ops, 0666, }, 1347 { "npc", &spufs_npc_ops, 0666, },