aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2005-11-15 15:53:52 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 22:49:30 -0500
commit8b3d6663c6217e4f50cc3720935a96da9b984117 (patch)
tree5295c29787ac66c26ddf715868fda7fcd3ad5f97 /include
parent05b841174c289ca62a6b42d883b8791d9ac3a4bd (diff)
[PATCH] spufs: cooperative scheduler support
This adds a scheduler for SPUs to make it possible to use more logical SPUs than physical ones are present in the system. Currently, there is no support for preempting a running SPU thread, they have to leave the SPU by either triggering an event on the SPU that causes it to return to the owning thread or by sending a signal to it. This patch also adds operations that enable accessing an SPU in either runnable or saved state. We use an RW semaphore to protect the state of the SPU from changing underneath us, while we are holding it readable. In order to change the state, it is acquired writeable and a context save or restore is executed before downgrading the semaphore to read-only. From: Mark Nutter <mnutter@us.ibm.com>, Uli Weigand <Ulrich.Weigand@de.ibm.com> Signed-off-by: Arnd Bergmann <arndb@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-powerpc/spu.h19
-rw-r--r--include/asm-powerpc/spu_csa.h1
2 files changed, 13 insertions, 7 deletions
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 62718f3ba03f..092ec97be326 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -105,6 +105,9 @@
105#define SPU_CONTEXT_SWITCH_PENDING (1UL << SPU_CONTEXT_SWITCH_PENDING_nr) 105#define SPU_CONTEXT_SWITCH_PENDING (1UL << SPU_CONTEXT_SWITCH_PENDING_nr)
106#define SPU_CONTEXT_SWITCH_ACTIVE (1UL << SPU_CONTEXT_SWITCH_ACTIVE_nr) 106#define SPU_CONTEXT_SWITCH_ACTIVE (1UL << SPU_CONTEXT_SWITCH_ACTIVE_nr)
107 107
108struct spu_context;
109struct spu_runqueue;
110
108struct spu { 111struct spu {
109 char *name; 112 char *name;
110 unsigned long local_store_phys; 113 unsigned long local_store_phys;
@@ -113,23 +116,28 @@ struct spu {
113 struct spu_priv1 __iomem *priv1; 116 struct spu_priv1 __iomem *priv1;
114 struct spu_priv2 __iomem *priv2; 117 struct spu_priv2 __iomem *priv2;
115 struct list_head list; 118 struct list_head list;
119 struct list_head sched_list;
116 int number; 120 int number;
117 u32 isrc; 121 u32 isrc;
118 u32 node; 122 u32 node;
119 u64 flags; 123 u64 flags;
124 u64 dar;
125 u64 dsisr;
120 struct kref kref; 126 struct kref kref;
121 size_t ls_size; 127 size_t ls_size;
122 unsigned int slb_replace; 128 unsigned int slb_replace;
123 struct mm_struct *mm; 129 struct mm_struct *mm;
130 struct spu_context *ctx;
131 struct spu_runqueue *rq;
132 pid_t pid;
133 int prio;
124 int class_0_pending; 134 int class_0_pending;
125 spinlock_t register_lock; 135 spinlock_t register_lock;
126 136
127 u32 stop_code; 137 u32 stop_code;
128 wait_queue_head_t stop_wq; 138 wait_queue_head_t stop_wq;
129 wait_queue_head_t ibox_wq; 139 void (* wbox_callback)(struct spu *spu);
130 wait_queue_head_t wbox_wq; 140 void (* ibox_callback)(struct spu *spu);
131 struct fasync_struct *ibox_fasync;
132 struct fasync_struct *wbox_fasync;
133 141
134 char irq_c0[8]; 142 char irq_c0[8];
135 char irq_c1[8]; 143 char irq_c1[8];
@@ -140,9 +148,6 @@ struct spu *spu_alloc(void);
140void spu_free(struct spu *spu); 148void spu_free(struct spu *spu);
141int spu_run(struct spu *spu); 149int spu_run(struct spu *spu);
142 150
143size_t spu_wbox_write(struct spu *spu, u32 data);
144size_t spu_ibox_read(struct spu *spu, u32 *data);
145
146extern struct spufs_calls { 151extern struct spufs_calls {
147 asmlinkage long (*create_thread)(const char __user *name, 152 asmlinkage long (*create_thread)(const char __user *name,
148 unsigned int flags, mode_t mode); 153 unsigned int flags, mode_t mode);
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index 989a0688144e..2a8af416638f 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -241,6 +241,7 @@ struct spu_state {
241 unsigned long suspend_time; 241 unsigned long suspend_time;
242 u64 slb_esid_RW[8]; 242 u64 slb_esid_RW[8];
243 u64 slb_vsid_RW[8]; 243 u64 slb_vsid_RW[8];
244 spinlock_t register_lock;
244}; 245};
245 246
246extern void spu_init_csa(struct spu_state *csa); 247extern void spu_init_csa(struct spu_state *csa);