diff options
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/spufs.h')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/spufs.h | 52 |
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 | ||
39 | struct spu_context_ops; | 39 | struct spu_context_ops; |
40 | |||
41 | #define SPU_CONTEXT_PREEMPT 0UL | ||
42 | |||
43 | struct spu_gang; | 40 | struct spu_gang; |
44 | 41 | ||
42 | /* ctx->sched_flags */ | ||
43 | enum { | ||
44 | SPU_SCHED_WAKE = 0, | ||
45 | }; | ||
46 | |||
45 | struct spu_context { | 47 | struct 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 | ||
80 | struct spu_gang { | 92 | struct 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); |
150 | long spufs_create(struct nameidata *nd, | 162 | long spufs_create(struct nameidata *nd, |
151 | unsigned int flags, mode_t mode); | 163 | unsigned int flags, mode_t mode); |
152 | extern struct file_operations spufs_context_fops; | 164 | extern const struct file_operations spufs_context_fops; |
153 | 165 | ||
154 | /* gang management */ | 166 | /* gang management */ |
155 | struct spu_gang *alloc_spu_gang(void); | 167 | struct spu_gang *alloc_spu_gang(void); |
@@ -159,6 +171,16 @@ void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx); | |||
159 | void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx); | 171 | void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx); |
160 | 172 | ||
161 | /* context management */ | 173 | /* context management */ |
174 | static inline void spu_acquire(struct spu_context *ctx) | ||
175 | { | ||
176 | mutex_lock(&ctx->state_mutex); | ||
177 | } | ||
178 | |||
179 | static inline void spu_release(struct spu_context *ctx) | ||
180 | { | ||
181 | mutex_unlock(&ctx->state_mutex); | ||
182 | } | ||
183 | |||
162 | struct spu_context * alloc_spu_context(struct spu_gang *gang); | 184 | struct spu_context * alloc_spu_context(struct spu_gang *gang); |
163 | void destroy_spu_context(struct kref *kref); | 185 | void destroy_spu_context(struct kref *kref); |
164 | struct spu_context * get_spu_context(struct spu_context *ctx); | 186 | struct spu_context * get_spu_context(struct spu_context *ctx); |
@@ -166,20 +188,18 @@ int put_spu_context(struct spu_context *ctx); | |||
166 | void spu_unmap_mappings(struct spu_context *ctx); | 188 | void spu_unmap_mappings(struct spu_context *ctx); |
167 | 189 | ||
168 | void spu_forget(struct spu_context *ctx); | 190 | void spu_forget(struct spu_context *ctx); |
169 | void spu_acquire(struct spu_context *ctx); | 191 | int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags); |
170 | void spu_release(struct spu_context *ctx); | ||
171 | int spu_acquire_runnable(struct spu_context *ctx); | ||
172 | void spu_acquire_saved(struct spu_context *ctx); | 192 | void spu_acquire_saved(struct spu_context *ctx); |
173 | int spu_acquire_exclusive(struct spu_context *ctx); | 193 | int spu_acquire_exclusive(struct spu_context *ctx); |
174 | 194 | enum { | |
175 | static inline void spu_release_exclusive(struct spu_context *ctx) | 195 | SPU_ACTIVATE_NOWAKE = 1, |
176 | { | 196 | }; |
177 | up_write(&ctx->state_sema); | 197 | int spu_activate(struct spu_context *ctx, unsigned long flags); |
178 | } | ||
179 | |||
180 | int spu_activate(struct spu_context *ctx, u64 flags); | ||
181 | void spu_deactivate(struct spu_context *ctx); | 198 | void spu_deactivate(struct spu_context *ctx); |
182 | void spu_yield(struct spu_context *ctx); | 199 | void spu_yield(struct spu_context *ctx); |
200 | void spu_start_tick(struct spu_context *ctx); | ||
201 | void spu_stop_tick(struct spu_context *ctx); | ||
202 | void spu_sched_tick(struct work_struct *work); | ||
183 | int __init spu_sched_init(void); | 203 | int __init spu_sched_init(void); |
184 | void __exit spu_sched_exit(void); | 204 | void __exit spu_sched_exit(void); |
185 | 205 | ||