diff options
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/sched.c')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index a824b6051164..bd6fe4b7a84b 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/unistd.h> | 35 | #include <linux/unistd.h> |
36 | #include <linux/numa.h> | 36 | #include <linux/numa.h> |
37 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
38 | #include <linux/notifier.h> | ||
38 | 39 | ||
39 | #include <asm/io.h> | 40 | #include <asm/io.h> |
40 | #include <asm/mmu_context.h> | 41 | #include <asm/mmu_context.h> |
@@ -75,6 +76,25 @@ static inline void mm_needs_global_tlbie(struct mm_struct *mm) | |||
75 | __cpus_setall(&mm->cpu_vm_mask, nr); | 76 | __cpus_setall(&mm->cpu_vm_mask, nr); |
76 | } | 77 | } |
77 | 78 | ||
79 | static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier); | ||
80 | |||
81 | static void spu_switch_notify(struct spu *spu, struct spu_context *ctx) | ||
82 | { | ||
83 | blocking_notifier_call_chain(&spu_switch_notifier, | ||
84 | ctx ? ctx->object_id : 0, spu); | ||
85 | } | ||
86 | |||
87 | int spu_switch_event_register(struct notifier_block * n) | ||
88 | { | ||
89 | return blocking_notifier_chain_register(&spu_switch_notifier, n); | ||
90 | } | ||
91 | |||
92 | int spu_switch_event_unregister(struct notifier_block * n) | ||
93 | { | ||
94 | return blocking_notifier_chain_unregister(&spu_switch_notifier, n); | ||
95 | } | ||
96 | |||
97 | |||
78 | static inline void bind_context(struct spu *spu, struct spu_context *ctx) | 98 | static inline void bind_context(struct spu *spu, struct spu_context *ctx) |
79 | { | 99 | { |
80 | pr_debug("%s: pid=%d SPU=%d NODE=%d\n", __FUNCTION__, current->pid, | 100 | pr_debug("%s: pid=%d SPU=%d NODE=%d\n", __FUNCTION__, current->pid, |
@@ -97,12 +117,14 @@ static inline void bind_context(struct spu *spu, struct spu_context *ctx) | |||
97 | spu_restore(&ctx->csa, spu); | 117 | spu_restore(&ctx->csa, spu); |
98 | spu->timestamp = jiffies; | 118 | spu->timestamp = jiffies; |
99 | spu_cpu_affinity_set(spu, raw_smp_processor_id()); | 119 | spu_cpu_affinity_set(spu, raw_smp_processor_id()); |
120 | spu_switch_notify(spu, ctx); | ||
100 | } | 121 | } |
101 | 122 | ||
102 | static inline void unbind_context(struct spu *spu, struct spu_context *ctx) | 123 | static inline void unbind_context(struct spu *spu, struct spu_context *ctx) |
103 | { | 124 | { |
104 | pr_debug("%s: unbind pid=%d SPU=%d NODE=%d\n", __FUNCTION__, | 125 | pr_debug("%s: unbind pid=%d SPU=%d NODE=%d\n", __FUNCTION__, |
105 | spu->pid, spu->number, spu->node); | 126 | spu->pid, spu->number, spu->node); |
127 | spu_switch_notify(spu, NULL); | ||
106 | spu_unmap_mappings(ctx); | 128 | spu_unmap_mappings(ctx); |
107 | spu_save(&ctx->csa, spu); | 129 | spu_save(&ctx->csa, spu); |
108 | spu->timestamp = jiffies; | 130 | spu->timestamp = jiffies; |