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.h64
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 */
221int spufs_handle_class1(struct spu_context *ctx); 224int spufs_handle_class1(struct spu_context *ctx);
225int spufs_handle_class0(struct spu_context *ctx);
222 226
223/* affinity */ 227/* affinity */
224struct spu *affinity_check(struct spu_context *ctx); 228struct spu *affinity_check(struct spu_context *ctx);
225 229
226/* context management */ 230/* context management */
227extern atomic_t nr_spu_contexts; 231extern atomic_t nr_spu_contexts;
228static inline void spu_acquire(struct spu_context *ctx) 232static 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
233static inline void spu_release(struct spu_context *ctx) 237static inline void spu_release(struct spu_context *ctx)
@@ -242,10 +246,11 @@ int put_spu_context(struct spu_context *ctx);
242void spu_unmap_mappings(struct spu_context *ctx); 246void spu_unmap_mappings(struct spu_context *ctx);
243 247
244void spu_forget(struct spu_context *ctx); 248void spu_forget(struct spu_context *ctx);
245int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags); 249int __must_check spu_acquire_saved(struct spu_context *ctx);
246void spu_acquire_saved(struct spu_context *ctx);
247void spu_release_saved(struct spu_context *ctx); 250void spu_release_saved(struct spu_context *ctx);
248 251
252int spu_stopped(struct spu_context *ctx, u32 * stat);
253void spu_del_from_rq(struct spu_context *ctx);
249int spu_activate(struct spu_context *ctx, unsigned long flags); 254int spu_activate(struct spu_context *ctx, unsigned long flags);
250void spu_deactivate(struct spu_context *ctx); 255void spu_deactivate(struct spu_context *ctx);
251void spu_yield(struct spu_context *ctx); 256void 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 {
306extern struct spufs_coredump_reader spufs_coredump_read[]; 313extern struct spufs_coredump_reader spufs_coredump_read[];
307extern int spufs_coredump_num_notes; 314extern int spufs_coredump_num_notes;
308 315
309/* 316extern int spu_init_csa(struct spu_state *csa);
310 * This function is a little bit too large for an inline, but 317extern void spu_fini_csa(struct spu_state *csa);
311 * as fault.c is built into the kernel we can't move it out of 318extern int spu_save(struct spu_state *prev, struct spu *spu);
312 * line. 319extern int spu_restore(struct spu_state *new, struct spu *spu);
313 */ 320extern int spu_switch(struct spu_state *prev, struct spu_state *new,
314static inline void spuctx_switch_state(struct spu_context *ctx, 321 struct spu *spu);
315 enum spu_utilization_state new_state) 322extern int spu_alloc_lscsa(struct spu_state *csa);
316{ 323extern void spu_free_lscsa(struct spu_state *csa);
317 unsigned long long curtime; 324
318 signed long long delta; 325extern 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