From: Arnd Bergmann <arnd@arndb.de>
To: Paul Mackerras <paulus@samba.org>
Cc: Arnd Bergmann <arnd.bergmann@de.ibm.com>,
linuxppc-dev@ozlabs.org, cbe-oss-dev@ozlabs.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 09/14] spufs: add support for read/write on cntl
Date: Wed, 04 Oct 2006 17:26:19 +0200 [thread overview]
Message-ID: <20061004161506.496172000@arndb.de> (raw)
In-Reply-To: 20061004152610.151599000@dyn-9-152-242-103.boeblingen.de.ibm.com
Writing to cntl can be used to stop execution on the
spu and to restart it, reading from cntl gives the
contents of the current status register.
The access is always in ascii, as for most other files.
This was always meant to be there, but we had a little
problem with writing to runctl so it was left out so
far.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linux-2.6/arch/powerpc/platforms/cell/spufs/file.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/file.c
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/file.c
@@ -211,37 +211,43 @@ static int spufs_cntl_mmap(struct file *
#define spufs_cntl_mmap NULL
#endif /* !SPUFS_MMAP_4K */
-static int spufs_cntl_open(struct inode *inode, struct file *file)
+static u64 spufs_cntl_get(void *data)
{
- struct spufs_inode_info *i = SPUFS_I(inode);
- struct spu_context *ctx = i->i_ctx;
+ struct spu_context *ctx = data;
+ u64 val;
- file->private_data = ctx;
- file->f_mapping = inode->i_mapping;
- ctx->cntl = inode->i_mapping;
- return 0;
+ spu_acquire(ctx);
+ val = ctx->ops->status_read(ctx);
+ spu_release(ctx);
+
+ return val;
}
-static ssize_t
-spufs_cntl_read(struct file *file, char __user *buffer,
- size_t size, loff_t *pos)
+static void spufs_cntl_set(void *data, u64 val)
{
- /* FIXME: read from spu status */
- return -EINVAL;
+ struct spu_context *ctx = data;
+
+ spu_acquire(ctx);
+ ctx->ops->runcntl_write(ctx, val);
+ spu_release(ctx);
}
-static ssize_t
-spufs_cntl_write(struct file *file, const char __user *buffer,
- size_t size, loff_t *pos)
+static int spufs_cntl_open(struct inode *inode, struct file *file)
{
- /* FIXME: write to runctl bit */
- return -EINVAL;
+ struct spufs_inode_info *i = SPUFS_I(inode);
+ struct spu_context *ctx = i->i_ctx;
+
+ file->private_data = ctx;
+ file->f_mapping = inode->i_mapping;
+ ctx->cntl = inode->i_mapping;
+ return simple_attr_open(inode, file, spufs_cntl_get,
+ spufs_cntl_set, "0x%08lx");
}
static struct file_operations spufs_cntl_fops = {
.open = spufs_cntl_open,
- .read = spufs_cntl_read,
- .write = spufs_cntl_write,
+ .read = simple_attr_read,
+ .write = simple_attr_write,
.mmap = spufs_cntl_mmap,
};
--
next prev parent reply other threads:[~2006-10-04 15:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-04 15:26 [PATCH 00/14] spufs/cell updates for 2.6.19 Arnd Bergmann
2006-10-04 15:26 ` [PATCH 01/14] spufs: cell spu problem state mapping updates Arnd Bergmann
2006-10-04 15:26 ` [PATCH 02/14] spufs: scheduler support for NUMA Arnd Bergmann
2006-10-04 15:26 ` [PATCH 03/14] spufs: fix context switch during page fault Arnd Bergmann
2006-10-04 15:26 ` [PATCH 04/14] spufs: implement error event delivery to user space Arnd Bergmann
2006-10-04 15:26 ` [PATCH 05/14] spufs: Add infrastructure needed for gang scheduling Arnd Bergmann
2006-10-04 15:26 ` [PATCH 06/14] spufs: use correct pg_prot for mapping spu LS Arnd Bergmann
2006-10-04 15:26 ` [PATCH 07/14] spufs: make mailbox functions handle multiple elements Arnd Bergmann
2006-10-04 15:26 ` [PATCH 08/14] spufs: remove support for ancient firmware Arnd Bergmann
2006-10-04 15:26 ` Arnd Bergmann [this message]
2006-10-04 15:26 ` [PATCH 10/14] spufs: support new OF device tree format Arnd Bergmann
2006-10-04 15:26 ` [PATCH 11/14] spufs: add infrastructure for finding elf objects Arnd Bergmann
2006-10-04 15:26 ` [PATCH 12/14] powerpc: update cell_defconfig Arnd Bergmann
2006-10-04 15:26 ` [PATCH 13/14] spiderpic: enable new style devtree support Arnd Bergmann
2006-10-04 15:26 ` [PATCH 14/14] cell: fix bugs found by sparse Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061004161506.496172000@arndb.de \
--to=arnd@arndb.de \
--cc=arnd.bergmann@de.ibm.com \
--cc=cbe-oss-dev@ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).