aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-06-04 01:15:38 -0400
committerPaul Mackerras <paulus@samba.org>2007-06-14 08:29:56 -0400
commitcbe709c1683dd54a2ec2981c9e8415cb3176f4e0 (patch)
tree4ad97fdc692cabe2dae53dd3f7d2c19ca2b60996 /arch/powerpc/platforms/cell
parent05169237b55058a3993fb4804d00b65dfa3e4a0c (diff)
[POWERPC] spufs: Add a "capabilities" file to spu contexts
This adds a "capabilities" file to spu contexts consisting of a list of linefeed separated capability names. The current exposed capabilities are "sched" (the context is scheduleable) and "step" (the context supports single stepping). Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell')
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index b1e7e2f8a2e9..f1cecaaad984 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -28,6 +28,7 @@
28#include <linux/pagemap.h> 28#include <linux/pagemap.h>
29#include <linux/poll.h> 29#include <linux/poll.h>
30#include <linux/ptrace.h> 30#include <linux/ptrace.h>
31#include <linux/seq_file.h>
31 32
32#include <asm/io.h> 33#include <asm/io.h>
33#include <asm/semaphore.h> 34#include <asm/semaphore.h>
@@ -39,6 +40,7 @@
39 40
40#define SPUFS_MMAP_4K (PAGE_SIZE == 0x1000) 41#define SPUFS_MMAP_4K (PAGE_SIZE == 0x1000)
41 42
43
42static int 44static int
43spufs_mem_open(struct inode *inode, struct file *file) 45spufs_mem_open(struct inode *inode, struct file *file)
44{ 46{
@@ -1797,6 +1799,29 @@ static int spufs_info_open(struct inode *inode, struct file *file)
1797 return 0; 1799 return 0;
1798} 1800}
1799 1801
1802static int spufs_caps_show(struct seq_file *s, void *private)
1803{
1804 struct spu_context *ctx = s->private;
1805
1806 if (!(ctx->flags & SPU_CREATE_NOSCHED))
1807 seq_puts(s, "sched\n");
1808 if (!(ctx->flags & SPU_CREATE_ISOLATE))
1809 seq_puts(s, "step\n");
1810 return 0;
1811}
1812
1813static int spufs_caps_open(struct inode *inode, struct file *file)
1814{
1815 return single_open(file, spufs_caps_show, SPUFS_I(inode)->i_ctx);
1816}
1817
1818static const struct file_operations spufs_caps_fops = {
1819 .open = spufs_caps_open,
1820 .read = seq_read,
1821 .llseek = seq_lseek,
1822 .release = single_release,
1823};
1824
1800static ssize_t __spufs_mbox_info_read(struct spu_context *ctx, 1825static ssize_t __spufs_mbox_info_read(struct spu_context *ctx,
1801 char __user *buf, size_t len, loff_t *pos) 1826 char __user *buf, size_t len, loff_t *pos)
1802{ 1827{
@@ -2015,6 +2040,7 @@ static const struct file_operations spufs_proxydma_info_fops = {
2015}; 2040};
2016 2041
2017struct tree_descr spufs_dir_contents[] = { 2042struct tree_descr spufs_dir_contents[] = {
2043 { "capabilities", &spufs_caps_fops, 0444, },
2018 { "mem", &spufs_mem_fops, 0666, }, 2044 { "mem", &spufs_mem_fops, 0666, },
2019 { "regs", &spufs_regs_fops, 0666, }, 2045 { "regs", &spufs_regs_fops, 0666, },
2020 { "mbox", &spufs_mbox_fops, 0444, }, 2046 { "mbox", &spufs_mbox_fops, 0444, },
@@ -2050,6 +2076,7 @@ struct tree_descr spufs_dir_contents[] = {
2050}; 2076};
2051 2077
2052struct tree_descr spufs_dir_nosched_contents[] = { 2078struct tree_descr spufs_dir_nosched_contents[] = {
2079 { "capabilities", &spufs_caps_fops, 0444, },
2053 { "mem", &spufs_mem_fops, 0666, }, 2080 { "mem", &spufs_mem_fops, 0666, },
2054 { "mbox", &spufs_mbox_fops, 0444, }, 2081 { "mbox", &spufs_mbox_fops, 0444, },
2055 { "ibox", &spufs_ibox_fops, 0444, }, 2082 { "ibox", &spufs_ibox_fops, 0444, },