Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
[POWERPC] PS3: Fix printing of os-area magic numbers
[POWERPC] Oprofile: Remove dependency on spufs module

+129 -48
+5
arch/powerpc/platforms/cell/Kconfig
··· 88 88 but also at lower core voltage. 89 89 90 90 endmenu 91 + 92 + config OPROFILE_CELL 93 + def_bool y 94 + depends on PPC_CELL_NATIVE && (OPROFILE = m || OPROFILE = y) 95 +
+1
arch/powerpc/platforms/cell/Makefile
··· 19 19 spu-manage-$(CONFIG_PPC_CELL_NATIVE) += spu_manage.o 20 20 21 21 obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \ 22 + spu_notify.o \ 22 23 spu_syscalls.o \ 23 24 $(spu-priv1-y) \ 24 25 $(spu-manage-y) \
+67
arch/powerpc/platforms/cell/spu_notify.c
··· 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 + 28 + static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier); 29 + 30 + void 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 + } 35 + EXPORT_SYMBOL_GPL(spu_switch_notify); 36 + 37 + int 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 + } 45 + EXPORT_SYMBOL_GPL(spu_switch_event_register); 46 + 47 + int spu_switch_event_unregister(struct notifier_block *n) 48 + { 49 + return blocking_notifier_chain_unregister(&spu_switch_notifier, n); 50 + } 51 + EXPORT_SYMBOL_GPL(spu_switch_event_unregister); 52 + 53 + void 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 + } 60 + EXPORT_SYMBOL_GPL(spu_set_profile_private_kref); 61 + 62 + void *spu_get_profile_private_kref(struct spu_context *ctx) 63 + { 64 + return ctx->prof_priv_kref; 65 + } 66 + EXPORT_SYMBOL_GPL(spu_get_profile_private_kref); 67 +
+14
arch/powerpc/platforms/cell/spu_syscalls.c
··· 145 145 return ret; 146 146 } 147 147 148 + void 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 + 148 162 int register_spu_syscalls(struct spufs_calls *calls) 149 163 { 150 164 if (spufs_calls)
-16
arch/powerpc/platforms/cell/spufs/context.c
··· 190 190 spu_release(ctx); 191 191 } 192 192 193 - void spu_set_profile_private_kref(struct spu_context *ctx, 194 - struct kref *prof_info_kref, 195 - void ( * prof_info_release) (struct kref *kref)) 196 - { 197 - ctx->prof_priv_kref = prof_info_kref; 198 - ctx->prof_priv_release = prof_info_release; 199 - } 200 - EXPORT_SYMBOL_GPL(spu_set_profile_private_kref); 201 - 202 - void *spu_get_profile_private_kref(struct spu_context *ctx) 203 - { 204 - return ctx->prof_priv_kref; 205 - } 206 - EXPORT_SYMBOL_GPL(spu_get_profile_private_kref); 207 - 208 -
+7 -22
arch/powerpc/platforms/cell/spufs/sched.c
··· 166 166 return rval; 167 167 } 168 168 169 - static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier); 170 - 171 - void spu_switch_notify(struct spu *spu, struct spu_context *ctx) 172 - { 173 - blocking_notifier_call_chain(&spu_switch_notifier, 174 - ctx ? ctx->object_id : 0, spu); 175 - } 176 - 177 - static void notify_spus_active(void) 169 + void do_notify_spus_active(void) 178 170 { 179 171 int node; 180 172 ··· 192 200 mutex_unlock(&cbe_spu_info[node].list_mutex); 193 201 } 194 202 } 203 + EXPORT_SYMBOL_GPL(do_notify_spus_active); 195 204 196 - int spu_switch_event_register(struct notifier_block * n) 205 + #ifndef MODULE 206 + void notify_spus_active(void) 197 207 { 198 - int ret; 199 - ret = blocking_notifier_chain_register(&spu_switch_notifier, n); 200 - if (!ret) 201 - notify_spus_active(); 202 - return ret; 208 + do_notify_spus_active(); 203 209 } 204 - EXPORT_SYMBOL_GPL(spu_switch_event_register); 205 - 206 - int spu_switch_event_unregister(struct notifier_block * n) 207 - { 208 - return blocking_notifier_chain_unregister(&spu_switch_notifier, n); 209 - } 210 - EXPORT_SYMBOL_GPL(spu_switch_event_unregister); 210 + EXPORT_SYMBOL_GPL(notify_spus_active); 211 + #endif 211 212 212 213 /** 213 214 * spu_bind_context - bind spu context to physical spu
+1
arch/powerpc/platforms/cell/spufs/syscalls.c
··· 86 86 .spu_run = do_spu_run, 87 87 .coredump_extra_notes_size = spufs_coredump_extra_notes_size, 88 88 .coredump_extra_notes_write = spufs_coredump_extra_notes_write, 89 + .notify_spus_active = do_notify_spus_active, 89 90 .owner = THIS_MODULE, 90 91 };
+30 -10
arch/powerpc/platforms/ps3/os-area.c
··· 23 23 #include <linux/workqueue.h> 24 24 #include <linux/fs.h> 25 25 #include <linux/syscalls.h> 26 + #include <linux/ctype.h> 26 27 27 28 #include <asm/lmb.h> 28 29 ··· 37 36 HEADER_LDR_FORMAT_RAW = 0, 38 37 HEADER_LDR_FORMAT_GZIP = 1, 39 38 }; 39 + 40 + #define OS_AREA_HEADER_MAGIC_NUM "cell_ext_os_area" 40 41 41 42 /** 42 43 * struct os_area_header - os area header segment. ··· 117 114 u8 _reserved_5[8]; 118 115 }; 119 116 120 - enum { 121 - OS_AREA_DB_MAGIC_NUM = 0x2d64622dU, 122 - }; 117 + #define OS_AREA_DB_MAGIC_NUM "-db-" 123 118 124 119 /** 125 120 * struct os_area_db - Shared flash memory database. 126 - * @magic_num: Always '-db-' = 0x2d64622d. 121 + * @magic_num: Always '-db-'. 127 122 * @version: os_area_db format version number. 128 123 * @index_64: byte offset of the database id index for 64 bit variables. 129 124 * @count_64: number of usable 64 bit index entries ··· 136 135 */ 137 136 138 137 struct os_area_db { 139 - u32 magic_num; 138 + u8 magic_num[4]; 140 139 u16 version; 141 140 u16 _reserved_1; 142 141 u16 index_64; ··· 266 265 prop->name); 267 266 } 268 267 268 + static void dump_field(char *s, const u8 *field, int size_of_field) 269 + { 270 + #if defined(DEBUG) 271 + int i; 272 + 273 + for (i = 0; i < size_of_field; i++) 274 + s[i] = isprint(field[i]) ? field[i] : '.'; 275 + s[i] = 0; 276 + #endif 277 + } 278 + 269 279 #define dump_header(_a) _dump_header(_a, __func__, __LINE__) 270 280 static void _dump_header(const struct os_area_header *h, const char *func, 271 281 int line) 272 282 { 283 + char str[sizeof(h->magic_num) + 1]; 284 + 285 + dump_field(str, h->magic_num, sizeof(h->magic_num)); 273 286 pr_debug("%s:%d: h.magic_num: '%s'\n", func, line, 274 - h->magic_num); 287 + str); 275 288 pr_debug("%s:%d: h.hdr_version: %u\n", func, line, 276 289 h->hdr_version); 277 290 pr_debug("%s:%d: h.db_area_offset: %u\n", func, line, ··· 326 311 327 312 static int verify_header(const struct os_area_header *header) 328 313 { 329 - if (memcmp(header->magic_num, "cell_ext_os_area", 16)) { 314 + if (memcmp(header->magic_num, OS_AREA_HEADER_MAGIC_NUM, 315 + sizeof(header->magic_num))) { 330 316 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__); 331 317 return -1; 332 318 } ··· 347 331 348 332 static int db_verify(const struct os_area_db *db) 349 333 { 350 - if (db->magic_num != OS_AREA_DB_MAGIC_NUM) { 334 + if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM, 335 + sizeof(db->magic_num))) { 351 336 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__); 352 337 return -1; 353 338 } ··· 501 484 static void _dump_db(const struct os_area_db *db, const char *func, 502 485 int line) 503 486 { 487 + char str[sizeof(db->magic_num) + 1]; 488 + 489 + dump_field(str, db->magic_num, sizeof(db->magic_num)); 504 490 pr_debug("%s:%d: db.magic_num: '%s'\n", func, line, 505 - (const char*)&db->magic_num); 491 + str); 506 492 pr_debug("%s:%d: db.version: %u\n", func, line, 507 493 db->version); 508 494 pr_debug("%s:%d: db.index_64: %u\n", func, line, ··· 536 516 537 517 memset(db, 0, sizeof(struct os_area_db)); 538 518 539 - db->magic_num = OS_AREA_DB_MAGIC_NUM; 519 + memcpy(db->magic_num, OS_AREA_DB_MAGIC_NUM, sizeof(db->magic_num)); 540 520 db->version = 1; 541 521 db->index_64 = HEADER_SIZE; 542 522 db->count_64 = VALUES_64_COUNT;
+4
include/asm-powerpc/spu.h
··· 246 246 __u32 __user *ustatus); 247 247 int (*coredump_extra_notes_size)(void); 248 248 int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset); 249 + void (*notify_spus_active)(void); 249 250 struct module *owner; 250 251 }; 251 252 ··· 298 297 struct notifier_block; 299 298 int spu_switch_event_register(struct notifier_block * n); 300 299 int spu_switch_event_unregister(struct notifier_block * n); 300 + 301 + extern void notify_spus_active(void); 302 + extern void do_notify_spus_active(void); 301 303 302 304 /* 303 305 * This defines the Local Store, Problem Area and Privlege Area of an SPU.