aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/spufs.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/spufs.h')
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h52
1 files changed, 36 insertions, 16 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 70fb13395c04..0c437891dfd5 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -23,7 +23,7 @@
23#define SPUFS_H 23#define SPUFS_H
24 24
25#include <linux/kref.h> 25#include <linux/kref.h>
26#include <linux/rwsem.h> 26#include <linux/mutex.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/fs.h> 28#include <linux/fs.h>
29 29
@@ -37,11 +37,13 @@ enum {
37}; 37};
38 38
39struct spu_context_ops; 39struct spu_context_ops;
40
41#define SPU_CONTEXT_PREEMPT 0UL
42
43struct spu_gang; 40struct spu_gang;
44 41
42/* ctx->sched_flags */
43enum {
44 SPU_SCHED_WAKE = 0,
45};
46
45struct spu_context { 47struct spu_context {
46 struct spu *spu; /* pointer to a physical SPU */ 48 struct spu *spu; /* pointer to a physical SPU */
47 struct spu_state csa; /* SPU context save area. */ 49 struct spu_state csa; /* SPU context save area. */
@@ -51,10 +53,12 @@ struct spu_context {
51 struct address_space *cntl; /* 'control' area mappings. */ 53 struct address_space *cntl; /* 'control' area mappings. */
52 struct address_space *signal1; /* 'signal1' area mappings. */ 54 struct address_space *signal1; /* 'signal1' area mappings. */
53 struct address_space *signal2; /* 'signal2' area mappings. */ 55 struct address_space *signal2; /* 'signal2' area mappings. */
56 struct address_space *mss; /* 'mss' area mappings. */
57 struct address_space *psmap; /* 'psmap' area mappings. */
54 u64 object_id; /* user space pointer for oprofile */ 58 u64 object_id; /* user space pointer for oprofile */
55 59
56 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; 60 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
57 struct rw_semaphore state_sema; 61 struct mutex state_mutex;
58 struct semaphore run_sema; 62 struct semaphore run_sema;
59 63
60 struct mm_struct *owner; 64 struct mm_struct *owner;
@@ -75,6 +79,14 @@ struct spu_context {
75 79
76 struct list_head gang_list; 80 struct list_head gang_list;
77 struct spu_gang *gang; 81 struct spu_gang *gang;
82
83 /* scheduler fields */
84 struct list_head rq;
85 struct delayed_work sched_work;
86 unsigned long sched_flags;
87 unsigned long rt_priority;
88 int policy;
89 int prio;
78}; 90};
79 91
80struct spu_gang { 92struct spu_gang {
@@ -149,7 +161,7 @@ long spufs_run_spu(struct file *file,
149 struct spu_context *ctx, u32 *npc, u32 *status); 161 struct spu_context *ctx, u32 *npc, u32 *status);
150long spufs_create(struct nameidata *nd, 162long spufs_create(struct nameidata *nd,
151 unsigned int flags, mode_t mode); 163 unsigned int flags, mode_t mode);
152extern struct file_operations spufs_context_fops; 164extern const struct file_operations spufs_context_fops;
153 165
154/* gang management */ 166/* gang management */
155struct spu_gang *alloc_spu_gang(void); 167struct spu_gang *alloc_spu_gang(void);
@@ -159,6 +171,16 @@ void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx);
159void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx); 171void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx);
160 172
161/* context management */ 173/* context management */
174static inline void spu_acquire(struct spu_context *ctx)
175{
176 mutex_lock(&ctx->state_mutex);
177}
178
179static inline void spu_release(struct spu_context *ctx)
180{
181 mutex_unlock(&ctx->state_mutex);
182}
183
162struct spu_context * alloc_spu_context(struct spu_gang *gang); 184struct spu_context * alloc_spu_context(struct spu_gang *gang);
163void destroy_spu_context(struct kref *kref); 185void destroy_spu_context(struct kref *kref);
164struct spu_context * get_spu_context(struct spu_context *ctx); 186struct spu_context * get_spu_context(struct spu_context *ctx);
@@ -166,20 +188,18 @@ int put_spu_context(struct spu_context *ctx);
166void spu_unmap_mappings(struct spu_context *ctx); 188void spu_unmap_mappings(struct spu_context *ctx);
167 189
168void spu_forget(struct spu_context *ctx); 190void spu_forget(struct spu_context *ctx);
169void spu_acquire(struct spu_context *ctx); 191int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags);
170void spu_release(struct spu_context *ctx);
171int spu_acquire_runnable(struct spu_context *ctx);
172void spu_acquire_saved(struct spu_context *ctx); 192void spu_acquire_saved(struct spu_context *ctx);
173int spu_acquire_exclusive(struct spu_context *ctx); 193int spu_acquire_exclusive(struct spu_context *ctx);
174 194enum {
175static inline void spu_release_exclusive(struct spu_context *ctx) 195 SPU_ACTIVATE_NOWAKE = 1,
176{ 196};
177 up_write(&ctx->state_sema); 197int spu_activate(struct spu_context *ctx, unsigned long flags);
178}
179
180int spu_activate(struct spu_context *ctx, u64 flags);
181void spu_deactivate(struct spu_context *ctx); 198void spu_deactivate(struct spu_context *ctx);
182void spu_yield(struct spu_context *ctx); 199void spu_yield(struct spu_context *ctx);
200void spu_start_tick(struct spu_context *ctx);
201void spu_stop_tick(struct spu_context *ctx);
202void spu_sched_tick(struct work_struct *work);
183int __init spu_sched_init(void); 203int __init spu_sched_init(void);
184void __exit spu_sched_exit(void); 204void __exit spu_sched_exit(void);
185 205