]> err.no Git - linux-2.6/blobdiff - include/asm-powerpc/spu.h
[DCCP]: Dedicated auxiliary states to support passive-close
[linux-2.6] / include / asm-powerpc / spu.h
index 42d88a6d2dfd021497195d00773e007a96845815..34b7807f068b3a0f1300bebdbd1046baad1da8d0 100644 (file)
@@ -107,10 +107,10 @@ struct spu_runqueue;
 struct device_node;
 
 enum spu_utilization_state {
-       SPU_UTIL_SYSTEM,
        SPU_UTIL_USER,
+       SPU_UTIL_SYSTEM,
        SPU_UTIL_IOWAIT,
-       SPU_UTIL_IDLE,
+       SPU_UTIL_IDLE_LOADED,
        SPU_UTIL_MAX
 };
 
@@ -121,15 +121,16 @@ struct spu {
        unsigned long problem_phys;
        struct spu_problem __iomem *problem;
        struct spu_priv2 __iomem *priv2;
-       struct list_head list;
-       struct list_head sched_list;
+       struct list_head cbe_list;
        struct list_head full_list;
+       enum { SPU_FREE, SPU_USED } alloc_state;
        int number;
        unsigned int irqs[3];
        u32 node;
        u64 flags;
        u64 dar;
        u64 dsisr;
+       u64 class_0_pending;
        size_t ls_size;
        unsigned int slb_replace;
        struct mm_struct *mm;
@@ -137,7 +138,7 @@ struct spu {
        struct spu_runqueue *rq;
        unsigned long long timestamp;
        pid_t pid;
-       int class_0_pending;
+       pid_t tgid;
        spinlock_t register_lock;
 
        void (* wbox_callback)(struct spu *spu);
@@ -165,11 +166,14 @@ struct spu {
 
        struct sys_device sysdev;
 
+       int has_mem_affinity;
+       struct list_head aff_list;
+
        struct {
                /* protected by interrupt reentrancy */
-               enum spu_utilization_state utilization_state;
-               unsigned long tstamp;           /* time of last ctx switch */
-               unsigned long times[SPU_UTIL_MAX];
+               enum spu_utilization_state util_state;
+               unsigned long long tstamp;
+               unsigned long long times[SPU_UTIL_MAX];
                unsigned long long vol_ctx_switch;
                unsigned long long invol_ctx_switch;
                unsigned long long min_flt;
@@ -181,9 +185,17 @@ struct spu {
        } stats;
 };
 
-struct spu *spu_alloc(void);
-struct spu *spu_alloc_node(int node);
-void spu_free(struct spu *spu);
+struct cbe_spu_info {
+       struct mutex list_mutex;
+       struct list_head spus;
+       int n_spus;
+       int nr_active;
+       atomic_t reserved_spus;
+};
+
+extern struct cbe_spu_info cbe_spu_info[];
+
+void spu_init_channels(struct spu *spu);
 int spu_irq_class_0_bottom(struct spu *spu);
 int spu_irq_class_1_bottom(struct spu *spu);
 void spu_irq_setaffinity(struct spu *spu, int cpu);
@@ -203,6 +215,20 @@ extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
 struct mm_struct;
 extern void spu_flush_all_slbs(struct mm_struct *mm);
 
+/* This interface allows a profiler (e.g., OProfile) to store a ref
+ * to spu context information that it creates. This caching technique
+ * avoids the need to recreate this information after a save/restore operation.
+ *
+ * Assumes the caller has already incremented the ref count to
+ * profile_info; then spu_context_destroy must call kref_put
+ * on prof_info_kref.
+ */
+void spu_set_profile_private_kref(struct spu_context *ctx,
+                                 struct kref *prof_info_kref,
+                                 void ( * prof_info_release) (struct kref *kref));
+
+void *spu_get_profile_private_kref(struct spu_context *ctx);
+
 /* system callbacks from the SPU */
 struct spu_syscall_block {
        u64 nr_ret;
@@ -212,18 +238,15 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
 
 /* syscalls implemented in spufs */
 struct file;
-extern struct spufs_calls {
-       asmlinkage long (*create_thread)(const char __user *name,
-                                       unsigned int flags, mode_t mode);
-       asmlinkage long (*spu_run)(struct file *filp, __u32 __user *unpc,
+struct spufs_calls {
+       long (*create_thread)(const char __user *name,
+                                       unsigned int flags, mode_t mode,
+                                       struct file *neighbor);
+       long (*spu_run)(struct file *filp, __u32 __user *unpc,
                                                __u32 __user *ustatus);
-       struct module *owner;
-} spufs_calls;
-
-/* coredump calls implemented in spufs */
-struct spu_coredump_calls {
-       asmlinkage int (*arch_notes_size)(void);
-       asmlinkage void (*arch_write_notes)(struct file *file);
+       int (*coredump_extra_notes_size)(void);
+       int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset);
+       void (*notify_spus_active)(void);
        struct module *owner;
 };
 
@@ -241,25 +264,14 @@ struct spu_coredump_calls {
 #define SPU_CREATE_GANG                        0x0002
 #define SPU_CREATE_NOSCHED             0x0004
 #define SPU_CREATE_ISOLATE             0x0008
+#define SPU_CREATE_AFFINITY_SPU                0x0010
+#define SPU_CREATE_AFFINITY_MEM                0x0020
 
-#define SPU_CREATE_FLAG_ALL            0x000f /* mask of all valid flags */
+#define SPU_CREATE_FLAG_ALL            0x003f /* mask of all valid flags */
 
 
-#ifdef CONFIG_SPU_FS_MODULE
 int register_spu_syscalls(struct spufs_calls *calls);
 void unregister_spu_syscalls(struct spufs_calls *calls);
-#else
-static inline int register_spu_syscalls(struct spufs_calls *calls)
-{
-       return 0;
-}
-static inline void unregister_spu_syscalls(struct spufs_calls *calls)
-{
-}
-#endif /* MODULE */
-
-int register_arch_coredump_calls(struct spu_coredump_calls *calls);
-void unregister_arch_coredump_calls(struct spu_coredump_calls *calls);
 
 int spu_add_sysdev_attr(struct sysdev_attribute *attr);
 void spu_remove_sysdev_attr(struct sysdev_attribute *attr);
@@ -287,6 +299,9 @@ struct notifier_block;
 int spu_switch_event_register(struct notifier_block * n);
 int spu_switch_event_unregister(struct notifier_block * n);
 
+extern void notify_spus_active(void);
+extern void do_notify_spus_active(void);
+
 /*
  * This defines the Local Store, Problem Area and Privlege Area of an SPU.
  */
@@ -411,6 +426,7 @@ struct spu_priv2 {
 #define MFC_CNTL_RESUME_DMA_QUEUE              (0ull << 0)
 #define MFC_CNTL_SUSPEND_DMA_QUEUE             (1ull << 0)
 #define MFC_CNTL_SUSPEND_DMA_QUEUE_MASK                (1ull << 0)
+#define MFC_CNTL_SUSPEND_MASK                  (1ull << 4)
 #define MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION    (0ull << 8)
 #define MFC_CNTL_SUSPEND_IN_PROGRESS           (1ull << 8)
 #define MFC_CNTL_SUSPEND_COMPLETE              (3ull << 8)