aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-01-23 18:07:21 -0500
committerPaul Mackerras <paulus@samba.org>2008-01-23 18:07:21 -0500
commit9156ad48338e0306e508ead5c0d9986050744475 (patch)
tree37f3a90e38190052ecf3cdf9171dfdddd37b56fd /arch/powerpc/platforms/cell
parentfa28237cfcc5827553044cbd6ee52e33692b0faa (diff)
parent8f7b3d156d348b6766833cd4e272d0d19b501e64 (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'arch/powerpc/platforms/cell')
-rw-r--r--arch/powerpc/platforms/cell/Kconfig5
-rw-r--r--arch/powerpc/platforms/cell/Makefile1
-rw-r--r--arch/powerpc/platforms/cell/spu_notify.c67
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c14
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c16
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c26
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c1
7 files changed, 89 insertions, 41 deletions
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index e1e2f6a43019..3a963b4a9be0 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -88,3 +88,8 @@ config CBE_CPUFREQ_PMI
88 but also at lower core voltage. 88 but also at lower core voltage.
89 89
90endmenu 90endmenu
91
92config OPROFILE_CELL
93 def_bool y
94 depends on PPC_CELL_NATIVE && (OPROFILE = m || OPROFILE = y)
95
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 3cd565a04d0a..c89964c6fb1f 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -19,6 +19,7 @@ spu-manage-$(CONFIG_PPC_CELLEB) += spu_manage.o
19spu-manage-$(CONFIG_PPC_CELL_NATIVE) += spu_manage.o 19spu-manage-$(CONFIG_PPC_CELL_NATIVE) += spu_manage.o
20 20
21obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \ 21obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
22 spu_notify.o \
22 spu_syscalls.o spu_fault.o \ 23 spu_syscalls.o spu_fault.o \
23 $(spu-priv1-y) \ 24 $(spu-priv1-y) \
24 $(spu-manage-y) \ 25 $(spu-manage-y) \
diff --git a/arch/powerpc/platforms/cell/spu_notify.c b/arch/powerpc/platforms/cell/spu_notify.c
new file mode 100644
index 000000000000..34d156959f39
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spu_notify.c
@@ -0,0 +1,67 @@
1/*
2 * Move OProfile dependencies from spufs module to the kernel so it
3 * can run on non-cell PPC.
4 *
5 * Copyright (C) IBM 2005
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#undef DEBUG
23
24#include <linux/module.h>
25#include <asm/spu.h>
26#include "spufs/spufs.h"
27
28static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
29
30void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
31{
32 blocking_notifier_call_chain(&spu_switch_notifier,
33 ctx ? ctx->object_id : 0, spu);
34}
35EXPORT_SYMBOL_GPL(spu_switch_notify);
36
37int spu_switch_event_register(struct notifier_block *n)
38{
39 int ret;
40 ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
41 if (!ret)
42 notify_spus_active();
43 return ret;
44}
45EXPORT_SYMBOL_GPL(spu_switch_event_register);
46
47int spu_switch_event_unregister(struct notifier_block *n)
48{
49 return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
50}
51EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
52
53void spu_set_profile_private_kref(struct spu_context *ctx,
54 struct kref *prof_info_kref,
55 void (* prof_info_release) (struct kref *kref))
56{
57 ctx->prof_priv_kref = prof_info_kref;
58 ctx->prof_priv_release = prof_info_release;
59}
60EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
61
62void *spu_get_profile_private_kref(struct spu_context *ctx)
63{
64 return ctx->prof_priv_kref;
65}
66EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
67
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index a9438b719fe8..75530d99eda6 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -145,6 +145,20 @@ int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
145 return ret; 145 return ret;
146} 146}
147 147
148void notify_spus_active(void)
149{
150 struct spufs_calls *calls;
151
152 calls = spufs_calls_get();
153 if (!calls)
154 return;
155
156 calls->notify_spus_active();
157 spufs_calls_put(calls);
158
159 return;
160}
161
148int register_spu_syscalls(struct spufs_calls *calls) 162int register_spu_syscalls(struct spufs_calls *calls)
149{ 163{
150 if (spufs_calls) 164 if (spufs_calls)
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 237e152d31dc..133995ed5cc7 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -177,19 +177,3 @@ void spu_release_saved(struct spu_context *ctx)
177 spu_release(ctx); 177 spu_release(ctx);
178} 178}
179 179
180void spu_set_profile_private_kref(struct spu_context *ctx,
181 struct kref *prof_info_kref,
182 void ( * prof_info_release) (struct kref *kref))
183{
184 ctx->prof_priv_kref = prof_info_kref;
185 ctx->prof_priv_release = prof_info_release;
186}
187EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
188
189void *spu_get_profile_private_kref(struct spu_context *ctx)
190{
191 return ctx->prof_priv_kref;
192}
193EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
194
195
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 8c8af11b35b4..00d914232af1 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -182,15 +182,7 @@ static int node_allowed(struct spu_context *ctx, int node)
182 return rval; 182 return rval;
183} 183}
184 184
185static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier); 185void do_notify_spus_active(void)
186
187void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
188{
189 blocking_notifier_call_chain(&spu_switch_notifier,
190 ctx ? ctx->object_id : 0, spu);
191}
192
193static void notify_spus_active(void)
194{ 186{
195 int node; 187 int node;
196 188
@@ -217,22 +209,6 @@ static void notify_spus_active(void)
217 } 209 }
218} 210}
219 211
220int spu_switch_event_register(struct notifier_block * n)
221{
222 int ret;
223 ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
224 if (!ret)
225 notify_spus_active();
226 return ret;
227}
228EXPORT_SYMBOL_GPL(spu_switch_event_register);
229
230int spu_switch_event_unregister(struct notifier_block * n)
231{
232 return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
233}
234EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
235
236/** 212/**
237 * spu_bind_context - bind spu context to physical spu 213 * spu_bind_context - bind spu context to physical spu
238 * @spu: physical spu to bind to 214 * @spu: physical spu to bind to
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 2c34f7170190..430404413178 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -86,5 +86,6 @@ struct spufs_calls spufs_calls = {
86 .spu_run = do_spu_run, 86 .spu_run = do_spu_run,
87 .coredump_extra_notes_size = spufs_coredump_extra_notes_size, 87 .coredump_extra_notes_size = spufs_coredump_extra_notes_size,
88 .coredump_extra_notes_write = spufs_coredump_extra_notes_write, 88 .coredump_extra_notes_write = spufs_coredump_extra_notes_write,
89 .notify_spus_active = do_notify_spus_active,
89 .owner = THIS_MODULE, 90 .owner = THIS_MODULE,
90}; 91};