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)
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.
25 #include <linux/kref.h>
26 #include <linux/rwsem.h>
27 #include <linux/spinlock.h>
31 #include <asm/spu_csa.h>
33 /* The magic number for our file system */
35 SPUFS_MAGIC = 0x23c9b64e,
39 struct spu *spu; /* pointer to a physical SPU */
40 struct spu_state csa; /* SPU context save area. */
41 struct rw_semaphore backing_sema; /* protects the above */
42 spinlock_t mmio_lock; /* protects mmio access */
47 struct spufs_inode_info {
48 struct spu_context *i_ctx;
49 struct inode vfs_inode;
51 #define SPUFS_I(inode) \
52 container_of(inode, struct spufs_inode_info, vfs_inode)
54 extern struct tree_descr spufs_dir_contents[];
56 /* system call implementation */
57 long spufs_run_spu(struct file *file,
58 struct spu_context *ctx, u32 *npc, u32 *status);
59 long spufs_create_thread(struct nameidata *nd, const char *name,
60 unsigned int flags, mode_t mode);
62 /* context management */
63 struct spu_context * alloc_spu_context(void);
64 void destroy_spu_context(struct kref *kref);
65 struct spu_context * get_spu_context(struct spu_context *ctx);
66 int put_spu_context(struct spu_context *ctx);
68 void spu_acquire(struct spu_context *ctx);
69 void spu_release(struct spu_context *ctx);
70 void spu_acquire_runnable(struct spu_context *ctx);
71 void spu_acquire_saved(struct spu_context *ctx);