]> err.no Git - linux-2.6/blobdiff - arch/powerpc/platforms/cell/spufs/spufs.h
Merge branch 'for-2.6.26' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer...
[linux-2.6] / arch / powerpc / platforms / cell / spufs / spufs.h
index 0e114038ea6fc136b5ec74e675987d848553629f..454c277c1457deaf4034b084cf95e438241c295c 100644 (file)
@@ -44,6 +44,31 @@ struct spu_gang;
 enum {
        SPU_SCHED_NOTIFY_ACTIVE,
        SPU_SCHED_WAS_ACTIVE,   /* was active upon spu_acquire_saved()  */
+       SPU_SCHED_SPU_RUN,      /* context is within spu_run */
+};
+
+enum {
+       SWITCH_LOG_BUFSIZE = 4096,
+};
+
+enum {
+       SWITCH_LOG_START,
+       SWITCH_LOG_STOP,
+       SWITCH_LOG_EXIT,
+};
+
+struct switch_log {
+       spinlock_t              lock;
+       wait_queue_head_t       wait;
+       unsigned long           head;
+       unsigned long           tail;
+       struct switch_log_entry {
+               struct timespec tstamp;
+               s32             spu_id;
+               u32             type;
+               u32             val;
+               u64             timebase;
+       } log[];
 };
 
 struct spu_context {
@@ -96,6 +121,7 @@ struct spu_context {
        cpumask_t cpus_allowed;
        int policy;
        int prio;
+       int last_ran;
 
        /* statistics */
        struct {
@@ -115,6 +141,9 @@ struct spu_context {
                unsigned long long libassist;
        } stats;
 
+       /* context switch log */
+       struct switch_log *switch_log;
+
        struct list_head aff_list;
        int aff_head;
        int aff_offset;
@@ -255,6 +284,8 @@ int spu_activate(struct spu_context *ctx, unsigned long flags);
 void spu_deactivate(struct spu_context *ctx);
 void spu_yield(struct spu_context *ctx);
 void spu_switch_notify(struct spu *spu, struct spu_context *ctx);
+void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx,
+               u32 type, u32 val);
 void spu_set_timeslice(struct spu_context *ctx);
 void spu_update_sched_info(struct spu_context *ctx);
 void __spu_update_sched_info(struct spu_context *ctx);
@@ -268,6 +299,9 @@ extern char *isolated_loader;
  *     Same as wait_event_interruptible(), except that here
  *     we need to call spu_release(ctx) before sleeping, and
  *     then spu_acquire(ctx) when awoken.
+ *
+ *     Returns with state_mutex re-acquired when successfull or
+ *     with -ERESTARTSYS and the state_mutex dropped when interrupted.
  */
 
 #define spufs_wait(wq, condition)                                      \
@@ -278,11 +312,11 @@ extern char *isolated_loader;
                prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE);    \
                if (condition)                                          \
                        break;                                          \
+               spu_release(ctx);                                       \
                if (signal_pending(current)) {                          \
                        __ret = -ERESTARTSYS;                           \
                        break;                                          \
                }                                                       \
-               spu_release(ctx);                                       \
                schedule();                                             \
                __ret = spu_acquire(ctx);                               \
                if (__ret)                                              \
@@ -298,7 +332,7 @@ size_t spu_ibox_read(struct spu_context *ctx, u32 *data);
 /* irq callback funcs. */
 void spufs_ibox_callback(struct spu *spu);
 void spufs_wbox_callback(struct spu *spu);
-void spufs_stop_callback(struct spu *spu);
+void spufs_stop_callback(struct spu *spu, int irq);
 void spufs_mfc_callback(struct spu *spu);
 void spufs_dma_callback(struct spu *spu, int type);
 
@@ -325,4 +359,9 @@ extern void spu_free_lscsa(struct spu_state *csa);
 extern void spuctx_switch_state(struct spu_context *ctx,
                enum spu_utilization_state new_state);
 
+#define spu_context_trace(name, ctx, spu) \
+       trace_mark(name, "ctx %p spu %p", ctx, spu);
+#define spu_context_nospu_trace(name, ctx) \
+       trace_mark(name, "ctx %p", ctx);
+
 #endif