diff options
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/spufs.h')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/spufs.h | 64 |
1 files changed, 23 insertions, 41 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index ca47b991bda5..0e114038ea6f 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h | |||
@@ -71,6 +71,7 @@ struct spu_context { | |||
71 | wait_queue_head_t wbox_wq; | 71 | wait_queue_head_t wbox_wq; |
72 | wait_queue_head_t stop_wq; | 72 | wait_queue_head_t stop_wq; |
73 | wait_queue_head_t mfc_wq; | 73 | wait_queue_head_t mfc_wq; |
74 | wait_queue_head_t run_wq; | ||
74 | struct fasync_struct *ibox_fasync; | 75 | struct fasync_struct *ibox_fasync; |
75 | struct fasync_struct *wbox_fasync; | 76 | struct fasync_struct *wbox_fasync; |
76 | struct fasync_struct *mfc_fasync; | 77 | struct fasync_struct *mfc_fasync; |
@@ -168,8 +169,10 @@ struct spu_context_ops { | |||
168 | void (*npc_write) (struct spu_context * ctx, u32 data); | 169 | void (*npc_write) (struct spu_context * ctx, u32 data); |
169 | u32(*status_read) (struct spu_context * ctx); | 170 | u32(*status_read) (struct spu_context * ctx); |
170 | char*(*get_ls) (struct spu_context * ctx); | 171 | char*(*get_ls) (struct spu_context * ctx); |
172 | void (*privcntl_write) (struct spu_context *ctx, u64 data); | ||
171 | u32 (*runcntl_read) (struct spu_context * ctx); | 173 | u32 (*runcntl_read) (struct spu_context * ctx); |
172 | void (*runcntl_write) (struct spu_context * ctx, u32 data); | 174 | void (*runcntl_write) (struct spu_context * ctx, u32 data); |
175 | void (*runcntl_stop) (struct spu_context * ctx); | ||
173 | void (*master_start) (struct spu_context * ctx); | 176 | void (*master_start) (struct spu_context * ctx); |
174 | void (*master_stop) (struct spu_context * ctx); | 177 | void (*master_stop) (struct spu_context * ctx); |
175 | int (*set_mfc_query)(struct spu_context * ctx, u32 mask, u32 mode); | 178 | int (*set_mfc_query)(struct spu_context * ctx, u32 mask, u32 mode); |
@@ -219,15 +222,16 @@ void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx); | |||
219 | 222 | ||
220 | /* fault handling */ | 223 | /* fault handling */ |
221 | int spufs_handle_class1(struct spu_context *ctx); | 224 | int spufs_handle_class1(struct spu_context *ctx); |
225 | int spufs_handle_class0(struct spu_context *ctx); | ||
222 | 226 | ||
223 | /* affinity */ | 227 | /* affinity */ |
224 | struct spu *affinity_check(struct spu_context *ctx); | 228 | struct spu *affinity_check(struct spu_context *ctx); |
225 | 229 | ||
226 | /* context management */ | 230 | /* context management */ |
227 | extern atomic_t nr_spu_contexts; | 231 | extern atomic_t nr_spu_contexts; |
228 | static inline void spu_acquire(struct spu_context *ctx) | 232 | static inline int __must_check spu_acquire(struct spu_context *ctx) |
229 | { | 233 | { |
230 | mutex_lock(&ctx->state_mutex); | 234 | return mutex_lock_interruptible(&ctx->state_mutex); |
231 | } | 235 | } |
232 | 236 | ||
233 | static inline void spu_release(struct spu_context *ctx) | 237 | static inline void spu_release(struct spu_context *ctx) |
@@ -242,10 +246,11 @@ int put_spu_context(struct spu_context *ctx); | |||
242 | void spu_unmap_mappings(struct spu_context *ctx); | 246 | void spu_unmap_mappings(struct spu_context *ctx); |
243 | 247 | ||
244 | void spu_forget(struct spu_context *ctx); | 248 | void spu_forget(struct spu_context *ctx); |
245 | int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags); | 249 | int __must_check spu_acquire_saved(struct spu_context *ctx); |
246 | void spu_acquire_saved(struct spu_context *ctx); | ||
247 | void spu_release_saved(struct spu_context *ctx); | 250 | void spu_release_saved(struct spu_context *ctx); |
248 | 251 | ||
252 | int spu_stopped(struct spu_context *ctx, u32 * stat); | ||
253 | void spu_del_from_rq(struct spu_context *ctx); | ||
249 | int spu_activate(struct spu_context *ctx, unsigned long flags); | 254 | int spu_activate(struct spu_context *ctx, unsigned long flags); |
250 | void spu_deactivate(struct spu_context *ctx); | 255 | void spu_deactivate(struct spu_context *ctx); |
251 | void spu_yield(struct spu_context *ctx); | 256 | void spu_yield(struct spu_context *ctx); |
@@ -279,7 +284,9 @@ extern char *isolated_loader; | |||
279 | } \ | 284 | } \ |
280 | spu_release(ctx); \ | 285 | spu_release(ctx); \ |
281 | schedule(); \ | 286 | schedule(); \ |
282 | spu_acquire(ctx); \ | 287 | __ret = spu_acquire(ctx); \ |
288 | if (__ret) \ | ||
289 | break; \ | ||
283 | } \ | 290 | } \ |
284 | finish_wait(&(wq), &__wait); \ | 291 | finish_wait(&(wq), &__wait); \ |
285 | __ret; \ | 292 | __ret; \ |
@@ -306,41 +313,16 @@ struct spufs_coredump_reader { | |||
306 | extern struct spufs_coredump_reader spufs_coredump_read[]; | 313 | extern struct spufs_coredump_reader spufs_coredump_read[]; |
307 | extern int spufs_coredump_num_notes; | 314 | extern int spufs_coredump_num_notes; |
308 | 315 | ||
309 | /* | 316 | extern int spu_init_csa(struct spu_state *csa); |
310 | * This function is a little bit too large for an inline, but | 317 | extern void spu_fini_csa(struct spu_state *csa); |
311 | * as fault.c is built into the kernel we can't move it out of | 318 | extern int spu_save(struct spu_state *prev, struct spu *spu); |
312 | * line. | 319 | extern int spu_restore(struct spu_state *new, struct spu *spu); |
313 | */ | 320 | extern int spu_switch(struct spu_state *prev, struct spu_state *new, |
314 | static inline void spuctx_switch_state(struct spu_context *ctx, | 321 | struct spu *spu); |
315 | enum spu_utilization_state new_state) | 322 | extern int spu_alloc_lscsa(struct spu_state *csa); |
316 | { | 323 | extern void spu_free_lscsa(struct spu_state *csa); |
317 | unsigned long long curtime; | 324 | |
318 | signed long long delta; | 325 | extern void spuctx_switch_state(struct spu_context *ctx, |
319 | struct timespec ts; | 326 | enum spu_utilization_state new_state); |
320 | struct spu *spu; | ||
321 | enum spu_utilization_state old_state; | ||
322 | |||
323 | ktime_get_ts(&ts); | ||
324 | curtime = timespec_to_ns(&ts); | ||
325 | delta = curtime - ctx->stats.tstamp; | ||
326 | |||
327 | WARN_ON(!mutex_is_locked(&ctx->state_mutex)); | ||
328 | WARN_ON(delta < 0); | ||
329 | |||
330 | spu = ctx->spu; | ||
331 | old_state = ctx->stats.util_state; | ||
332 | ctx->stats.util_state = new_state; | ||
333 | ctx->stats.tstamp = curtime; | ||
334 | |||
335 | /* | ||
336 | * Update the physical SPU utilization statistics. | ||
337 | */ | ||
338 | if (spu) { | ||
339 | ctx->stats.times[old_state] += delta; | ||
340 | spu->stats.times[old_state] += delta; | ||
341 | spu->stats.util_state = new_state; | ||
342 | spu->stats.tstamp = curtime; | ||
343 | } | ||
344 | } | ||
345 | 327 | ||
346 | #endif | 328 | #endif |