aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/cell/Makefile2
-rw-r--r--arch/powerpc/platforms/cell/spu_coredump.c83
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c30
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c10
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c6
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h4
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c2
-rw-r--r--include/asm-powerpc/spu.h12
8 files changed, 41 insertions, 108 deletions
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 40f78e908953..61d12f183036 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -19,7 +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_coredump.o spu_syscalls.o \ 22 spu_syscalls.o \
23 $(spu-priv1-y) \ 23 $(spu-priv1-y) \
24 $(spu-manage-y) \ 24 $(spu-manage-y) \
25 spufs/ 25 spufs/
diff --git a/arch/powerpc/platforms/cell/spu_coredump.c b/arch/powerpc/platforms/cell/spu_coredump.c
deleted file mode 100644
index 656a8c52cd38..000000000000
--- a/arch/powerpc/platforms/cell/spu_coredump.c
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * SPU core dump code
3 *
4 * (C) Copyright 2006 IBM Corp.
5 *
6 * Author: Dwayne Grant McConnell <decimal@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/file.h>
24#include <linux/module.h>
25#include <linux/syscalls.h>
26
27#include <asm/spu.h>
28
29static struct spu_coredump_calls *spu_coredump_calls;
30static DEFINE_MUTEX(spu_coredump_mutex);
31
32int arch_notes_size(void)
33{
34 int ret;
35
36 mutex_lock(&spu_coredump_mutex);
37
38 if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
39 ret = spu_coredump_calls->arch_notes_size();
40 module_put(spu_coredump_calls->owner);
41 } else {
42 ret = 0;
43 }
44
45 mutex_unlock(&spu_coredump_mutex);
46
47 return ret;
48}
49
50void arch_write_notes(struct file *file)
51{
52 mutex_lock(&spu_coredump_mutex);
53 if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
54 spu_coredump_calls->arch_write_notes(file);
55 module_put(spu_coredump_calls->owner);
56 }
57 mutex_unlock(&spu_coredump_mutex);
58}
59
60int register_arch_coredump_calls(struct spu_coredump_calls *calls)
61{
62 int ret = 0;
63
64
65 mutex_lock(&spu_coredump_mutex);
66 if (spu_coredump_calls)
67 ret = -EBUSY;
68 else
69 spu_coredump_calls = calls;
70 mutex_unlock(&spu_coredump_mutex);
71 return ret;
72}
73EXPORT_SYMBOL_GPL(register_arch_coredump_calls);
74
75void unregister_arch_coredump_calls(struct spu_coredump_calls *calls)
76{
77 BUG_ON(spu_coredump_calls != calls);
78
79 mutex_lock(&spu_coredump_mutex);
80 spu_coredump_calls = NULL;
81 mutex_unlock(&spu_coredump_mutex);
82}
83EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls);
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index c0238dd9ff27..05841cdef4e1 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -2,6 +2,7 @@
2 * SPU file system -- system call stubs 2 * SPU file system -- system call stubs
3 * 3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 * (C) Copyright 2006-2007, IBM Corporation
5 * 6 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com> 7 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 * 8 *
@@ -111,6 +112,35 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
111 return ret; 112 return ret;
112} 113}
113 114
115int arch_notes_size(void)
116{
117 struct spufs_calls *calls;
118 int ret;
119
120 calls = spufs_calls_get();
121 if (!calls)
122 return 0;
123
124 ret = calls->coredump_extra_notes_size();
125
126 spufs_calls_put(calls);
127
128 return ret;
129}
130
131void arch_write_notes(struct file *file)
132{
133 struct spufs_calls *calls;
134
135 calls = spufs_calls_get();
136 if (!calls)
137 return;
138
139 calls->coredump_extra_notes_write(file);
140
141 spufs_calls_put(calls);
142}
143
114int register_spu_syscalls(struct spufs_calls *calls) 144int register_spu_syscalls(struct spufs_calls *calls)
115{ 145{
116 if (spufs_calls) 146 if (spufs_calls)
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index fc988fd1ffb6..6c20e44dba63 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -122,7 +122,7 @@ static struct spu_context *coredump_next_context(int *fd)
122 return ctx; 122 return ctx;
123} 123}
124 124
125static int spufs_arch_notes_size(void) 125int spufs_coredump_extra_notes_size(void)
126{ 126{
127 struct spu_context *ctx; 127 struct spu_context *ctx;
128 int size = 0, rc, fd; 128 int size = 0, rc, fd;
@@ -185,7 +185,7 @@ out:
185 free_page((unsigned long)buf); 185 free_page((unsigned long)buf);
186} 186}
187 187
188static void spufs_arch_write_notes(struct file *file) 188void spufs_coredump_extra_notes_write(struct file *file)
189{ 189{
190 struct spu_context *ctx; 190 struct spu_context *ctx;
191 int fd, j; 191 int fd, j;
@@ -200,9 +200,3 @@ static void spufs_arch_write_notes(struct file *file)
200 spu_release_saved(ctx); 200 spu_release_saved(ctx);
201 } 201 }
202} 202}
203
204struct spu_coredump_calls spufs_coredump_calls = {
205 .arch_notes_size = spufs_arch_notes_size,
206 .arch_write_notes = spufs_arch_write_notes,
207 .owner = THIS_MODULE,
208};
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index e210a4b259fb..11098747d09b 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -790,16 +790,11 @@ static int __init spufs_init(void)
790 ret = register_spu_syscalls(&spufs_calls); 790 ret = register_spu_syscalls(&spufs_calls);
791 if (ret) 791 if (ret)
792 goto out_fs; 792 goto out_fs;
793 ret = register_arch_coredump_calls(&spufs_coredump_calls);
794 if (ret)
795 goto out_syscalls;
796 793
797 spufs_init_isolated_loader(); 794 spufs_init_isolated_loader();
798 795
799 return 0; 796 return 0;
800 797
801out_syscalls:
802 unregister_spu_syscalls(&spufs_calls);
803out_fs: 798out_fs:
804 unregister_filesystem(&spufs_type); 799 unregister_filesystem(&spufs_type);
805out_sched: 800out_sched:
@@ -815,7 +810,6 @@ static void __exit spufs_exit(void)
815{ 810{
816 spu_sched_exit(); 811 spu_sched_exit();
817 spufs_exit_isolated_loader(); 812 spufs_exit_isolated_loader();
818 unregister_arch_coredump_calls(&spufs_coredump_calls);
819 unregister_spu_syscalls(&spufs_calls); 813 unregister_spu_syscalls(&spufs_calls);
820 unregister_filesystem(&spufs_type); 814 unregister_filesystem(&spufs_type);
821 kmem_cache_destroy(spufs_inode_cache); 815 kmem_cache_destroy(spufs_inode_cache);
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index f869a4b488b0..c7b4e035de48 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -204,6 +204,10 @@ extern struct spufs_calls spufs_calls;
204long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); 204long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
205long spufs_create(struct nameidata *nd, unsigned int flags, 205long spufs_create(struct nameidata *nd, unsigned int flags,
206 mode_t mode, struct file *filp); 206 mode_t mode, struct file *filp);
207/* ELF coredump callbacks for writing SPU ELF notes */
208extern int spufs_coredump_extra_notes_size(void);
209extern void spufs_coredump_extra_notes_write(struct file *file);
210
207extern const struct file_operations spufs_context_fops; 211extern const struct file_operations spufs_context_fops;
208 212
209/* gang management */ 213/* gang management */
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 22b138dc335c..2c34f7170190 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -84,5 +84,7 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
84struct spufs_calls spufs_calls = { 84struct spufs_calls spufs_calls = {
85 .create_thread = do_spu_create, 85 .create_thread = do_spu_create,
86 .spu_run = do_spu_run, 86 .spu_run = do_spu_run,
87 .coredump_extra_notes_size = spufs_coredump_extra_notes_size,
88 .coredump_extra_notes_write = spufs_coredump_extra_notes_write,
87 .owner = THIS_MODULE, 89 .owner = THIS_MODULE,
88}; 90};
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index eb1159cdb8ac..f1b10a187987 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -244,13 +244,8 @@ struct spufs_calls {
244 struct file *neighbor); 244 struct file *neighbor);
245 long (*spu_run)(struct file *filp, __u32 __user *unpc, 245 long (*spu_run)(struct file *filp, __u32 __user *unpc,
246 __u32 __user *ustatus); 246 __u32 __user *ustatus);
247 struct module *owner; 247 int (*coredump_extra_notes_size)(void);
248}; 248 void (*coredump_extra_notes_write)(struct file *file);
249
250/* coredump calls implemented in spufs */
251struct spu_coredump_calls {
252 asmlinkage int (*arch_notes_size)(void);
253 asmlinkage void (*arch_write_notes)(struct file *file);
254 struct module *owner; 249 struct module *owner;
255}; 250};
256 251
@@ -277,9 +272,6 @@ struct spu_coredump_calls {
277int register_spu_syscalls(struct spufs_calls *calls); 272int register_spu_syscalls(struct spufs_calls *calls);
278void unregister_spu_syscalls(struct spufs_calls *calls); 273void unregister_spu_syscalls(struct spufs_calls *calls);
279 274
280int register_arch_coredump_calls(struct spu_coredump_calls *calls);
281void unregister_arch_coredump_calls(struct spu_coredump_calls *calls);
282
283int spu_add_sysdev_attr(struct sysdev_attribute *attr); 275int spu_add_sysdev_attr(struct sysdev_attribute *attr);
284void spu_remove_sysdev_attr(struct sysdev_attribute *attr); 276void spu_remove_sysdev_attr(struct sysdev_attribute *attr);
285 277