diff options
author | Arnd Bergmann <arnd@arndb.de> | 2005-11-15 15:53:52 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 22:49:30 -0500 |
commit | 8b3d6663c6217e4f50cc3720935a96da9b984117 (patch) | |
tree | 5295c29787ac66c26ddf715868fda7fcd3ad5f97 /include/asm-powerpc/spu.h | |
parent | 05b841174c289ca62a6b42d883b8791d9ac3a4bd (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/asm-powerpc/spu.h')
-rw-r--r-- | include/asm-powerpc/spu.h | 19 |
1 files changed, 12 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 | ||
108 | struct spu_context; | ||
109 | struct spu_runqueue; | ||
110 | |||
108 | struct spu { | 111 | struct 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); | |||
140 | void spu_free(struct spu *spu); | 148 | void spu_free(struct spu *spu); |
141 | int spu_run(struct spu *spu); | 149 | int spu_run(struct spu *spu); |
142 | 150 | ||
143 | size_t spu_wbox_write(struct spu *spu, u32 data); | ||
144 | size_t spu_ibox_read(struct spu *spu, u32 *data); | ||
145 | |||
146 | extern struct spufs_calls { | 151 | extern 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); |