aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/ps3
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-01-08 19:56:37 -0500
committerPaul Mundt <lethal@linux-sh.org>2012-01-08 19:56:37 -0500
commit04cf399640b7acfa9abe2eb7900cd934db8af697 (patch)
treef9a055f2f0170550f5f0b0507b06ffce8d98945d /arch/powerpc/platforms/ps3
parent17f0056e6a2f3d1818801705f5e12b71217bf4ef (diff)
parenta0e86bd4252519321b0d102dc4ed90557aa7bee9 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into rmobile-latest
Conflicts: arch/arm/mach-shmobile/Makefile Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/powerpc/platforms/ps3')
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c126
-rw-r--r--arch/powerpc/platforms/ps3/mm.c1
-rw-r--r--arch/powerpc/platforms/ps3/platform.h1
-rw-r--r--arch/powerpc/platforms/ps3/repository.c137
-rw-r--r--arch/powerpc/platforms/ps3/setup.c4
-rw-r--r--arch/powerpc/platforms/ps3/smp.c64
-rw-r--r--arch/powerpc/platforms/ps3/spu.c2
7 files changed, 182 insertions, 153 deletions
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 404bc52b7806..617efa12a3a5 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -31,18 +31,18 @@
31 31
32#if defined(DEBUG) 32#if defined(DEBUG)
33#define DBG udbg_printf 33#define DBG udbg_printf
34#define FAIL udbg_printf
34#else 35#else
35#define DBG pr_debug 36#define DBG pr_devel
37#define FAIL pr_debug
36#endif 38#endif
37 39
38/** 40/**
39 * struct ps3_bmp - a per cpu irq status and mask bitmap structure 41 * struct ps3_bmp - a per cpu irq status and mask bitmap structure
40 * @status: 256 bit status bitmap indexed by plug 42 * @status: 256 bit status bitmap indexed by plug
41 * @unused_1: 43 * @unused_1: Alignment
42 * @mask: 256 bit mask bitmap indexed by plug 44 * @mask: 256 bit mask bitmap indexed by plug
43 * @unused_2: 45 * @unused_2: Alignment
44 * @lock:
45 * @ipi_debug_brk_mask:
46 * 46 *
47 * The HV maintains per SMT thread mappings of HV outlet to HV plug on 47 * The HV maintains per SMT thread mappings of HV outlet to HV plug on
48 * behalf of the guest. These mappings are implemented as 256 bit guest 48 * behalf of the guest. These mappings are implemented as 256 bit guest
@@ -73,21 +73,25 @@ struct ps3_bmp {
73 unsigned long mask; 73 unsigned long mask;
74 u64 unused_2[3]; 74 u64 unused_2[3];
75 }; 75 };
76 u64 ipi_debug_brk_mask;
77 spinlock_t lock;
78}; 76};
79 77
80/** 78/**
81 * struct ps3_private - a per cpu data structure 79 * struct ps3_private - a per cpu data structure
82 * @bmp: ps3_bmp structure 80 * @bmp: ps3_bmp structure
81 * @bmp_lock: Syncronize access to bmp.
82 * @ipi_debug_brk_mask: Mask for debug break IPIs
83 * @ppe_id: HV logical_ppe_id 83 * @ppe_id: HV logical_ppe_id
84 * @thread_id: HV thread_id 84 * @thread_id: HV thread_id
85 * @ipi_mask: Mask of IPI virqs
85 */ 86 */
86 87
87struct ps3_private { 88struct ps3_private {
88 struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN))); 89 struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN)));
90 spinlock_t bmp_lock;
89 u64 ppe_id; 91 u64 ppe_id;
90 u64 thread_id; 92 u64 thread_id;
93 unsigned long ipi_debug_brk_mask;
94 unsigned long ipi_mask;
91}; 95};
92 96
93static DEFINE_PER_CPU(struct ps3_private, ps3_private); 97static DEFINE_PER_CPU(struct ps3_private, ps3_private);
@@ -104,7 +108,7 @@ static void ps3_chip_mask(struct irq_data *d)
104 struct ps3_private *pd = irq_data_get_irq_chip_data(d); 108 struct ps3_private *pd = irq_data_get_irq_chip_data(d);
105 unsigned long flags; 109 unsigned long flags;
106 110
107 pr_debug("%s:%d: thread_id %llu, virq %d\n", __func__, __LINE__, 111 DBG("%s:%d: thread_id %llu, virq %d\n", __func__, __LINE__,
108 pd->thread_id, d->irq); 112 pd->thread_id, d->irq);
109 113
110 local_irq_save(flags); 114 local_irq_save(flags);
@@ -125,7 +129,7 @@ static void ps3_chip_unmask(struct irq_data *d)
125 struct ps3_private *pd = irq_data_get_irq_chip_data(d); 129 struct ps3_private *pd = irq_data_get_irq_chip_data(d);
126 unsigned long flags; 130 unsigned long flags;
127 131
128 pr_debug("%s:%d: thread_id %llu, virq %d\n", __func__, __LINE__, 132 DBG("%s:%d: thread_id %llu, virq %d\n", __func__, __LINE__,
129 pd->thread_id, d->irq); 133 pd->thread_id, d->irq);
130 134
131 local_irq_save(flags); 135 local_irq_save(flags);
@@ -144,7 +148,11 @@ static void ps3_chip_unmask(struct irq_data *d)
144static void ps3_chip_eoi(struct irq_data *d) 148static void ps3_chip_eoi(struct irq_data *d)
145{ 149{
146 const struct ps3_private *pd = irq_data_get_irq_chip_data(d); 150 const struct ps3_private *pd = irq_data_get_irq_chip_data(d);
147 lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, d->irq); 151
152 /* non-IPIs are EOIed here. */
153
154 if (!test_bit(63 - d->irq, &pd->ipi_mask))
155 lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, d->irq);
148} 156}
149 157
150/** 158/**
@@ -185,19 +193,19 @@ static int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
185 *virq = irq_create_mapping(NULL, outlet); 193 *virq = irq_create_mapping(NULL, outlet);
186 194
187 if (*virq == NO_IRQ) { 195 if (*virq == NO_IRQ) {
188 pr_debug("%s:%d: irq_create_mapping failed: outlet %lu\n", 196 FAIL("%s:%d: irq_create_mapping failed: outlet %lu\n",
189 __func__, __LINE__, outlet); 197 __func__, __LINE__, outlet);
190 result = -ENOMEM; 198 result = -ENOMEM;
191 goto fail_create; 199 goto fail_create;
192 } 200 }
193 201
194 pr_debug("%s:%d: outlet %lu => cpu %u, virq %u\n", __func__, __LINE__, 202 DBG("%s:%d: outlet %lu => cpu %u, virq %u\n", __func__, __LINE__,
195 outlet, cpu, *virq); 203 outlet, cpu, *virq);
196 204
197 result = irq_set_chip_data(*virq, pd); 205 result = irq_set_chip_data(*virq, pd);
198 206
199 if (result) { 207 if (result) {
200 pr_debug("%s:%d: irq_set_chip_data failed\n", 208 FAIL("%s:%d: irq_set_chip_data failed\n",
201 __func__, __LINE__); 209 __func__, __LINE__);
202 goto fail_set; 210 goto fail_set;
203 } 211 }
@@ -223,13 +231,13 @@ static int ps3_virq_destroy(unsigned int virq)
223{ 231{
224 const struct ps3_private *pd = irq_get_chip_data(virq); 232 const struct ps3_private *pd = irq_get_chip_data(virq);
225 233
226 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, virq %u\n", __func__, 234 DBG("%s:%d: ppe_id %llu, thread_id %llu, virq %u\n", __func__,
227 __LINE__, pd->ppe_id, pd->thread_id, virq); 235 __LINE__, pd->ppe_id, pd->thread_id, virq);
228 236
229 irq_set_chip_data(virq, NULL); 237 irq_set_chip_data(virq, NULL);
230 irq_dispose_mapping(virq); 238 irq_dispose_mapping(virq);
231 239
232 pr_debug("%s:%d <-\n", __func__, __LINE__); 240 DBG("%s:%d <-\n", __func__, __LINE__);
233 return 0; 241 return 0;
234} 242}
235 243
@@ -252,7 +260,7 @@ int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
252 result = ps3_virq_setup(cpu, outlet, virq); 260 result = ps3_virq_setup(cpu, outlet, virq);
253 261
254 if (result) { 262 if (result) {
255 pr_debug("%s:%d: ps3_virq_setup failed\n", __func__, __LINE__); 263 FAIL("%s:%d: ps3_virq_setup failed\n", __func__, __LINE__);
256 goto fail_setup; 264 goto fail_setup;
257 } 265 }
258 266
@@ -264,7 +272,7 @@ int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
264 outlet, 0); 272 outlet, 0);
265 273
266 if (result) { 274 if (result) {
267 pr_info("%s:%d: lv1_connect_irq_plug_ext failed: %s\n", 275 FAIL("%s:%d: lv1_connect_irq_plug_ext failed: %s\n",
268 __func__, __LINE__, ps3_result(result)); 276 __func__, __LINE__, ps3_result(result));
269 result = -EPERM; 277 result = -EPERM;
270 goto fail_connect; 278 goto fail_connect;
@@ -293,7 +301,7 @@ int ps3_irq_plug_destroy(unsigned int virq)
293 int result; 301 int result;
294 const struct ps3_private *pd = irq_get_chip_data(virq); 302 const struct ps3_private *pd = irq_get_chip_data(virq);
295 303
296 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, virq %u\n", __func__, 304 DBG("%s:%d: ppe_id %llu, thread_id %llu, virq %u\n", __func__,
297 __LINE__, pd->ppe_id, pd->thread_id, virq); 305 __LINE__, pd->ppe_id, pd->thread_id, virq);
298 306
299 ps3_chip_mask(irq_get_irq_data(virq)); 307 ps3_chip_mask(irq_get_irq_data(virq));
@@ -301,7 +309,7 @@ int ps3_irq_plug_destroy(unsigned int virq)
301 result = lv1_disconnect_irq_plug_ext(pd->ppe_id, pd->thread_id, virq); 309 result = lv1_disconnect_irq_plug_ext(pd->ppe_id, pd->thread_id, virq);
302 310
303 if (result) 311 if (result)
304 pr_info("%s:%d: lv1_disconnect_irq_plug_ext failed: %s\n", 312 FAIL("%s:%d: lv1_disconnect_irq_plug_ext failed: %s\n",
305 __func__, __LINE__, ps3_result(result)); 313 __func__, __LINE__, ps3_result(result));
306 314
307 ps3_virq_destroy(virq); 315 ps3_virq_destroy(virq);
@@ -329,7 +337,7 @@ int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq)
329 result = lv1_construct_event_receive_port(&outlet); 337 result = lv1_construct_event_receive_port(&outlet);
330 338
331 if (result) { 339 if (result) {
332 pr_debug("%s:%d: lv1_construct_event_receive_port failed: %s\n", 340 FAIL("%s:%d: lv1_construct_event_receive_port failed: %s\n",
333 __func__, __LINE__, ps3_result(result)); 341 __func__, __LINE__, ps3_result(result));
334 *virq = NO_IRQ; 342 *virq = NO_IRQ;
335 return result; 343 return result;
@@ -355,14 +363,14 @@ int ps3_event_receive_port_destroy(unsigned int virq)
355{ 363{
356 int result; 364 int result;
357 365
358 pr_debug(" -> %s:%d virq %u\n", __func__, __LINE__, virq); 366 DBG(" -> %s:%d virq %u\n", __func__, __LINE__, virq);
359 367
360 ps3_chip_mask(irq_get_irq_data(virq)); 368 ps3_chip_mask(irq_get_irq_data(virq));
361 369
362 result = lv1_destruct_event_receive_port(virq_to_hw(virq)); 370 result = lv1_destruct_event_receive_port(virq_to_hw(virq));
363 371
364 if (result) 372 if (result)
365 pr_debug("%s:%d: lv1_destruct_event_receive_port failed: %s\n", 373 FAIL("%s:%d: lv1_destruct_event_receive_port failed: %s\n",
366 __func__, __LINE__, ps3_result(result)); 374 __func__, __LINE__, ps3_result(result));
367 375
368 /* 376 /*
@@ -370,7 +378,7 @@ int ps3_event_receive_port_destroy(unsigned int virq)
370 * calls from interrupt context (smp_call_function) when kexecing. 378 * calls from interrupt context (smp_call_function) when kexecing.
371 */ 379 */
372 380
373 pr_debug(" <- %s:%d\n", __func__, __LINE__); 381 DBG(" <- %s:%d\n", __func__, __LINE__);
374 return result; 382 return result;
375} 383}
376 384
@@ -406,7 +414,7 @@ int ps3_sb_event_receive_port_setup(struct ps3_system_bus_device *dev,
406 dev->dev_id, virq_to_hw(*virq), dev->interrupt_id); 414 dev->dev_id, virq_to_hw(*virq), dev->interrupt_id);
407 415
408 if (result) { 416 if (result) {
409 pr_debug("%s:%d: lv1_connect_interrupt_event_receive_port" 417 FAIL("%s:%d: lv1_connect_interrupt_event_receive_port"
410 " failed: %s\n", __func__, __LINE__, 418 " failed: %s\n", __func__, __LINE__,
411 ps3_result(result)); 419 ps3_result(result));
412 ps3_event_receive_port_destroy(*virq); 420 ps3_event_receive_port_destroy(*virq);
@@ -414,7 +422,7 @@ int ps3_sb_event_receive_port_setup(struct ps3_system_bus_device *dev,
414 return result; 422 return result;
415 } 423 }
416 424
417 pr_debug("%s:%d: interrupt_id %u, virq %u\n", __func__, __LINE__, 425 DBG("%s:%d: interrupt_id %u, virq %u\n", __func__, __LINE__,
418 dev->interrupt_id, *virq); 426 dev->interrupt_id, *virq);
419 427
420 return 0; 428 return 0;
@@ -428,14 +436,14 @@ int ps3_sb_event_receive_port_destroy(struct ps3_system_bus_device *dev,
428 436
429 int result; 437 int result;
430 438
431 pr_debug(" -> %s:%d: interrupt_id %u, virq %u\n", __func__, __LINE__, 439 DBG(" -> %s:%d: interrupt_id %u, virq %u\n", __func__, __LINE__,
432 dev->interrupt_id, virq); 440 dev->interrupt_id, virq);
433 441
434 result = lv1_disconnect_interrupt_event_receive_port(dev->bus_id, 442 result = lv1_disconnect_interrupt_event_receive_port(dev->bus_id,
435 dev->dev_id, virq_to_hw(virq), dev->interrupt_id); 443 dev->dev_id, virq_to_hw(virq), dev->interrupt_id);
436 444
437 if (result) 445 if (result)
438 pr_debug("%s:%d: lv1_disconnect_interrupt_event_receive_port" 446 FAIL("%s:%d: lv1_disconnect_interrupt_event_receive_port"
439 " failed: %s\n", __func__, __LINE__, 447 " failed: %s\n", __func__, __LINE__,
440 ps3_result(result)); 448 ps3_result(result));
441 449
@@ -450,7 +458,7 @@ int ps3_sb_event_receive_port_destroy(struct ps3_system_bus_device *dev,
450 result = ps3_virq_destroy(virq); 458 result = ps3_virq_destroy(virq);
451 BUG_ON(result); 459 BUG_ON(result);
452 460
453 pr_debug(" <- %s:%d\n", __func__, __LINE__); 461 DBG(" <- %s:%d\n", __func__, __LINE__);
454 return result; 462 return result;
455} 463}
456EXPORT_SYMBOL(ps3_sb_event_receive_port_destroy); 464EXPORT_SYMBOL(ps3_sb_event_receive_port_destroy);
@@ -475,7 +483,7 @@ int ps3_io_irq_setup(enum ps3_cpu_binding cpu, unsigned int interrupt_id,
475 result = lv1_construct_io_irq_outlet(interrupt_id, &outlet); 483 result = lv1_construct_io_irq_outlet(interrupt_id, &outlet);
476 484
477 if (result) { 485 if (result) {
478 pr_debug("%s:%d: lv1_construct_io_irq_outlet failed: %s\n", 486 FAIL("%s:%d: lv1_construct_io_irq_outlet failed: %s\n",
479 __func__, __LINE__, ps3_result(result)); 487 __func__, __LINE__, ps3_result(result));
480 return result; 488 return result;
481 } 489 }
@@ -505,7 +513,7 @@ int ps3_io_irq_destroy(unsigned int virq)
505 result = lv1_destruct_io_irq_outlet(outlet); 513 result = lv1_destruct_io_irq_outlet(outlet);
506 514
507 if (result) 515 if (result)
508 pr_debug("%s:%d: lv1_destruct_io_irq_outlet failed: %s\n", 516 FAIL("%s:%d: lv1_destruct_io_irq_outlet failed: %s\n",
509 __func__, __LINE__, ps3_result(result)); 517 __func__, __LINE__, ps3_result(result));
510 518
511 return result; 519 return result;
@@ -537,7 +545,7 @@ int ps3_vuart_irq_setup(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
537 result = lv1_configure_virtual_uart_irq(lpar_addr, &outlet); 545 result = lv1_configure_virtual_uart_irq(lpar_addr, &outlet);
538 546
539 if (result) { 547 if (result) {
540 pr_debug("%s:%d: lv1_configure_virtual_uart_irq failed: %s\n", 548 FAIL("%s:%d: lv1_configure_virtual_uart_irq failed: %s\n",
541 __func__, __LINE__, ps3_result(result)); 549 __func__, __LINE__, ps3_result(result));
542 return result; 550 return result;
543 } 551 }
@@ -557,7 +565,7 @@ int ps3_vuart_irq_destroy(unsigned int virq)
557 result = lv1_deconfigure_virtual_uart_irq(); 565 result = lv1_deconfigure_virtual_uart_irq();
558 566
559 if (result) { 567 if (result) {
560 pr_debug("%s:%d: lv1_configure_virtual_uart_irq failed: %s\n", 568 FAIL("%s:%d: lv1_configure_virtual_uart_irq failed: %s\n",
561 __func__, __LINE__, ps3_result(result)); 569 __func__, __LINE__, ps3_result(result));
562 return result; 570 return result;
563 } 571 }
@@ -590,7 +598,7 @@ int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id,
590 result = lv1_get_spe_irq_outlet(spe_id, class, &outlet); 598 result = lv1_get_spe_irq_outlet(spe_id, class, &outlet);
591 599
592 if (result) { 600 if (result) {
593 pr_debug("%s:%d: lv1_get_spe_irq_outlet failed: %s\n", 601 FAIL("%s:%d: lv1_get_spe_irq_outlet failed: %s\n",
594 __func__, __LINE__, ps3_result(result)); 602 __func__, __LINE__, ps3_result(result));
595 return result; 603 return result;
596 } 604 }
@@ -621,7 +629,7 @@ int ps3_spe_irq_destroy(unsigned int virq)
621static void _dump_64_bmp(const char *header, const u64 *p, unsigned cpu, 629static void _dump_64_bmp(const char *header, const u64 *p, unsigned cpu,
622 const char* func, int line) 630 const char* func, int line)
623{ 631{
624 pr_debug("%s:%d: %s %u {%04lx_%04lx_%04lx_%04lx}\n", 632 pr_debug("%s:%d: %s %u {%04llx_%04llx_%04llx_%04llx}\n",
625 func, line, header, cpu, 633 func, line, header, cpu,
626 *p >> 48, (*p >> 32) & 0xffff, (*p >> 16) & 0xffff, 634 *p >> 48, (*p >> 32) & 0xffff, (*p >> 16) & 0xffff,
627 *p & 0xffff); 635 *p & 0xffff);
@@ -630,7 +638,7 @@ static void _dump_64_bmp(const char *header, const u64 *p, unsigned cpu,
630static void __maybe_unused _dump_256_bmp(const char *header, 638static void __maybe_unused _dump_256_bmp(const char *header,
631 const u64 *p, unsigned cpu, const char* func, int line) 639 const u64 *p, unsigned cpu, const char* func, int line)
632{ 640{
633 pr_debug("%s:%d: %s %u {%016lx:%016lx:%016lx:%016lx}\n", 641 pr_debug("%s:%d: %s %u {%016llx:%016llx:%016llx:%016llx}\n",
634 func, line, header, cpu, p[0], p[1], p[2], p[3]); 642 func, line, header, cpu, p[0], p[1], p[2], p[3]);
635} 643}
636 644
@@ -639,10 +647,10 @@ static void _dump_bmp(struct ps3_private* pd, const char* func, int line)
639{ 647{
640 unsigned long flags; 648 unsigned long flags;
641 649
642 spin_lock_irqsave(&pd->bmp.lock, flags); 650 spin_lock_irqsave(&pd->bmp_lock, flags);
643 _dump_64_bmp("stat", &pd->bmp.status, pd->thread_id, func, line); 651 _dump_64_bmp("stat", &pd->bmp.status, pd->thread_id, func, line);
644 _dump_64_bmp("mask", &pd->bmp.mask, pd->thread_id, func, line); 652 _dump_64_bmp("mask", (u64*)&pd->bmp.mask, pd->thread_id, func, line);
645 spin_unlock_irqrestore(&pd->bmp.lock, flags); 653 spin_unlock_irqrestore(&pd->bmp_lock, flags);
646} 654}
647 655
648#define dump_mask(_x) _dump_mask(_x, __func__, __LINE__) 656#define dump_mask(_x) _dump_mask(_x, __func__, __LINE__)
@@ -651,9 +659,9 @@ static void __maybe_unused _dump_mask(struct ps3_private *pd,
651{ 659{
652 unsigned long flags; 660 unsigned long flags;
653 661
654 spin_lock_irqsave(&pd->bmp.lock, flags); 662 spin_lock_irqsave(&pd->bmp_lock, flags);
655 _dump_64_bmp("mask", &pd->bmp.mask, pd->thread_id, func, line); 663 _dump_64_bmp("mask", (u64*)&pd->bmp.mask, pd->thread_id, func, line);
656 spin_unlock_irqrestore(&pd->bmp.lock, flags); 664 spin_unlock_irqrestore(&pd->bmp_lock, flags);
657} 665}
658#else 666#else
659static void dump_bmp(struct ps3_private* pd) {}; 667static void dump_bmp(struct ps3_private* pd) {};
@@ -662,7 +670,7 @@ static void dump_bmp(struct ps3_private* pd) {};
662static int ps3_host_map(struct irq_host *h, unsigned int virq, 670static int ps3_host_map(struct irq_host *h, unsigned int virq,
663 irq_hw_number_t hwirq) 671 irq_hw_number_t hwirq)
664{ 672{
665 pr_debug("%s:%d: hwirq %lu, virq %u\n", __func__, __LINE__, hwirq, 673 DBG("%s:%d: hwirq %lu, virq %u\n", __func__, __LINE__, hwirq,
666 virq); 674 virq);
667 675
668 irq_set_chip_and_handler(virq, &ps3_irq_chip, handle_fasteoi_irq); 676 irq_set_chip_and_handler(virq, &ps3_irq_chip, handle_fasteoi_irq);
@@ -685,10 +693,20 @@ void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq)
685{ 693{
686 struct ps3_private *pd = &per_cpu(ps3_private, cpu); 694 struct ps3_private *pd = &per_cpu(ps3_private, cpu);
687 695
688 pd->bmp.ipi_debug_brk_mask = 0x8000000000000000UL >> virq; 696 set_bit(63 - virq, &pd->ipi_debug_brk_mask);
689 697
690 pr_debug("%s:%d: cpu %u, virq %u, mask %llxh\n", __func__, __LINE__, 698 DBG("%s:%d: cpu %u, virq %u, mask %lxh\n", __func__, __LINE__,
691 cpu, virq, pd->bmp.ipi_debug_brk_mask); 699 cpu, virq, pd->ipi_debug_brk_mask);
700}
701
702void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq)
703{
704 struct ps3_private *pd = &per_cpu(ps3_private, cpu);
705
706 set_bit(63 - virq, &pd->ipi_mask);
707
708 DBG("%s:%d: cpu %u, virq %u, ipi_mask %lxh\n", __func__, __LINE__,
709 cpu, virq, pd->ipi_mask);
692} 710}
693 711
694static unsigned int ps3_get_irq(void) 712static unsigned int ps3_get_irq(void)
@@ -699,14 +717,14 @@ static unsigned int ps3_get_irq(void)
699 717
700 /* check for ipi break first to stop this cpu ASAP */ 718 /* check for ipi break first to stop this cpu ASAP */
701 719
702 if (x & pd->bmp.ipi_debug_brk_mask) 720 if (x & pd->ipi_debug_brk_mask)
703 x &= pd->bmp.ipi_debug_brk_mask; 721 x &= pd->ipi_debug_brk_mask;
704 722
705 asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x)); 723 asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x));
706 plug &= 0x3f; 724 plug &= 0x3f;
707 725
708 if (unlikely(plug == NO_IRQ)) { 726 if (unlikely(plug == NO_IRQ)) {
709 pr_debug("%s:%d: no plug found: thread_id %llu\n", __func__, 727 DBG("%s:%d: no plug found: thread_id %llu\n", __func__,
710 __LINE__, pd->thread_id); 728 __LINE__, pd->thread_id);
711 dump_bmp(&per_cpu(ps3_private, 0)); 729 dump_bmp(&per_cpu(ps3_private, 0));
712 dump_bmp(&per_cpu(ps3_private, 1)); 730 dump_bmp(&per_cpu(ps3_private, 1));
@@ -720,6 +738,12 @@ static unsigned int ps3_get_irq(void)
720 BUG(); 738 BUG();
721 } 739 }
722#endif 740#endif
741
742 /* IPIs are EOIed here. */
743
744 if (test_bit(63 - plug, &pd->ipi_mask))
745 lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, plug);
746
723 return plug; 747 return plug;
724} 748}
725 749
@@ -739,9 +763,9 @@ void __init ps3_init_IRQ(void)
739 763
740 lv1_get_logical_ppe_id(&pd->ppe_id); 764 lv1_get_logical_ppe_id(&pd->ppe_id);
741 pd->thread_id = get_hard_smp_processor_id(cpu); 765 pd->thread_id = get_hard_smp_processor_id(cpu);
742 spin_lock_init(&pd->bmp.lock); 766 spin_lock_init(&pd->bmp_lock);
743 767
744 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, bmp %lxh\n", 768 DBG("%s:%d: ppe_id %llu, thread_id %llu, bmp %lxh\n",
745 __func__, __LINE__, pd->ppe_id, pd->thread_id, 769 __func__, __LINE__, pd->ppe_id, pd->thread_id,
746 ps3_mm_phys_to_lpar(__pa(&pd->bmp))); 770 ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
747 771
@@ -749,7 +773,7 @@ void __init ps3_init_IRQ(void)
749 pd->thread_id, ps3_mm_phys_to_lpar(__pa(&pd->bmp))); 773 pd->thread_id, ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
750 774
751 if (result) 775 if (result)
752 pr_debug("%s:%d: lv1_configure_irq_state_bitmap failed:" 776 FAIL("%s:%d: lv1_configure_irq_state_bitmap failed:"
753 " %s\n", __func__, __LINE__, 777 " %s\n", __func__, __LINE__,
754 ps3_result(result)); 778 ps3_result(result));
755 } 779 }
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 72714ad27842..8bd6ba542691 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -319,7 +319,6 @@ static int __init ps3_mm_add_memory(void)
319 } 319 }
320 320
321 memblock_add(start_addr, map.r1.size); 321 memblock_add(start_addr, map.r1.size);
322 memblock_analyze();
323 322
324 result = online_pages(start_pfn, nr_pages); 323 result = online_pages(start_pfn, nr_pages);
325 324
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
index 9a196a88eda7..1a633ed0fe98 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -43,6 +43,7 @@ void ps3_mm_shutdown(void);
43void ps3_init_IRQ(void); 43void ps3_init_IRQ(void);
44void ps3_shutdown_IRQ(int cpu); 44void ps3_shutdown_IRQ(int cpu);
45void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq); 45void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq);
46void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq);
46 47
47/* smp */ 48/* smp */
48 49
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index ca40f6afd35d..7bdfea336f5e 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -44,7 +44,7 @@ static void _dump_field(const char *hdr, u64 n, const char *func, int line)
44 s[i] = (in[i] <= 126 && in[i] >= 32) ? in[i] : '.'; 44 s[i] = (in[i] <= 126 && in[i] >= 32) ? in[i] : '.';
45 s[i] = 0; 45 s[i] = 0;
46 46
47 pr_debug("%s:%d: %s%016llx : %s\n", func, line, hdr, n, s); 47 pr_devel("%s:%d: %s%016llx : %s\n", func, line, hdr, n, s);
48#endif 48#endif
49} 49}
50 50
@@ -53,7 +53,7 @@ static void _dump_field(const char *hdr, u64 n, const char *func, int line)
53static void _dump_node_name(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, 53static void _dump_node_name(unsigned int lpar_id, u64 n1, u64 n2, u64 n3,
54 u64 n4, const char *func, int line) 54 u64 n4, const char *func, int line)
55{ 55{
56 pr_debug("%s:%d: lpar: %u\n", func, line, lpar_id); 56 pr_devel("%s:%d: lpar: %u\n", func, line, lpar_id);
57 _dump_field("n1: ", n1, func, line); 57 _dump_field("n1: ", n1, func, line);
58 _dump_field("n2: ", n2, func, line); 58 _dump_field("n2: ", n2, func, line);
59 _dump_field("n3: ", n3, func, line); 59 _dump_field("n3: ", n3, func, line);
@@ -65,13 +65,13 @@ static void _dump_node_name(unsigned int lpar_id, u64 n1, u64 n2, u64 n3,
65static void _dump_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4, 65static void _dump_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4,
66 u64 v1, u64 v2, const char *func, int line) 66 u64 v1, u64 v2, const char *func, int line)
67{ 67{
68 pr_debug("%s:%d: lpar: %u\n", func, line, lpar_id); 68 pr_devel("%s:%d: lpar: %u\n", func, line, lpar_id);
69 _dump_field("n1: ", n1, func, line); 69 _dump_field("n1: ", n1, func, line);
70 _dump_field("n2: ", n2, func, line); 70 _dump_field("n2: ", n2, func, line);
71 _dump_field("n3: ", n3, func, line); 71 _dump_field("n3: ", n3, func, line);
72 _dump_field("n4: ", n4, func, line); 72 _dump_field("n4: ", n4, func, line);
73 pr_debug("%s:%d: v1: %016llx\n", func, line, v1); 73 pr_devel("%s:%d: v1: %016llx\n", func, line, v1);
74 pr_debug("%s:%d: v2: %016llx\n", func, line, v2); 74 pr_devel("%s:%d: v2: %016llx\n", func, line, v2);
75} 75}
76 76
77/** 77/**
@@ -131,11 +131,11 @@ static int read_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4,
131 lpar_id = id; 131 lpar_id = id;
132 } 132 }
133 133
134 result = lv1_get_repository_node_value(lpar_id, n1, n2, n3, n4, &v1, 134 result = lv1_read_repository_node(lpar_id, n1, n2, n3, n4, &v1,
135 &v2); 135 &v2);
136 136
137 if (result) { 137 if (result) {
138 pr_debug("%s:%d: lv1_get_repository_node_value failed: %s\n", 138 pr_warn("%s:%d: lv1_read_repository_node failed: %s\n",
139 __func__, __LINE__, ps3_result(result)); 139 __func__, __LINE__, ps3_result(result));
140 dump_node_name(lpar_id, n1, n2, n3, n4); 140 dump_node_name(lpar_id, n1, n2, n3, n4);
141 return -ENOENT; 141 return -ENOENT;
@@ -149,10 +149,10 @@ static int read_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4,
149 *_v2 = v2; 149 *_v2 = v2;
150 150
151 if (v1 && !_v1) 151 if (v1 && !_v1)
152 pr_debug("%s:%d: warning: discarding non-zero v1: %016llx\n", 152 pr_devel("%s:%d: warning: discarding non-zero v1: %016llx\n",
153 __func__, __LINE__, v1); 153 __func__, __LINE__, v1);
154 if (v2 && !_v2) 154 if (v2 && !_v2)
155 pr_debug("%s:%d: warning: discarding non-zero v2: %016llx\n", 155 pr_devel("%s:%d: warning: discarding non-zero v2: %016llx\n",
156 __func__, __LINE__, v2); 156 __func__, __LINE__, v2);
157 157
158 return 0; 158 return 0;
@@ -323,16 +323,16 @@ int ps3_repository_find_device(struct ps3_repository_device *repo)
323 result = ps3_repository_read_bus_num_dev(tmp.bus_index, &num_dev); 323 result = ps3_repository_read_bus_num_dev(tmp.bus_index, &num_dev);
324 324
325 if (result) { 325 if (result) {
326 pr_debug("%s:%d read_bus_num_dev failed\n", __func__, __LINE__); 326 pr_devel("%s:%d read_bus_num_dev failed\n", __func__, __LINE__);
327 return result; 327 return result;
328 } 328 }
329 329
330 pr_debug("%s:%d: bus_type %u, bus_index %u, bus_id %llu, num_dev %u\n", 330 pr_devel("%s:%d: bus_type %u, bus_index %u, bus_id %llu, num_dev %u\n",
331 __func__, __LINE__, tmp.bus_type, tmp.bus_index, tmp.bus_id, 331 __func__, __LINE__, tmp.bus_type, tmp.bus_index, tmp.bus_id,
332 num_dev); 332 num_dev);
333 333
334 if (tmp.dev_index >= num_dev) { 334 if (tmp.dev_index >= num_dev) {
335 pr_debug("%s:%d: no device found\n", __func__, __LINE__); 335 pr_devel("%s:%d: no device found\n", __func__, __LINE__);
336 return -ENODEV; 336 return -ENODEV;
337 } 337 }
338 338
@@ -340,7 +340,7 @@ int ps3_repository_find_device(struct ps3_repository_device *repo)
340 &tmp.dev_type); 340 &tmp.dev_type);
341 341
342 if (result) { 342 if (result) {
343 pr_debug("%s:%d read_dev_type failed\n", __func__, __LINE__); 343 pr_devel("%s:%d read_dev_type failed\n", __func__, __LINE__);
344 return result; 344 return result;
345 } 345 }
346 346
@@ -348,12 +348,12 @@ int ps3_repository_find_device(struct ps3_repository_device *repo)
348 &tmp.dev_id); 348 &tmp.dev_id);
349 349
350 if (result) { 350 if (result) {
351 pr_debug("%s:%d ps3_repository_read_dev_id failed\n", __func__, 351 pr_devel("%s:%d ps3_repository_read_dev_id failed\n", __func__,
352 __LINE__); 352 __LINE__);
353 return result; 353 return result;
354 } 354 }
355 355
356 pr_debug("%s:%d: found: dev_type %u, dev_index %u, dev_id %llu\n", 356 pr_devel("%s:%d: found: dev_type %u, dev_index %u, dev_id %llu\n",
357 __func__, __LINE__, tmp.dev_type, tmp.dev_index, tmp.dev_id); 357 __func__, __LINE__, tmp.dev_type, tmp.dev_index, tmp.dev_id);
358 358
359 *repo = tmp; 359 *repo = tmp;
@@ -367,14 +367,14 @@ int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,
367 struct ps3_repository_device tmp; 367 struct ps3_repository_device tmp;
368 unsigned int num_dev; 368 unsigned int num_dev;
369 369
370 pr_debug(" -> %s:%u: find device by id %llu:%llu\n", __func__, __LINE__, 370 pr_devel(" -> %s:%u: find device by id %llu:%llu\n", __func__, __LINE__,
371 bus_id, dev_id); 371 bus_id, dev_id);
372 372
373 for (tmp.bus_index = 0; tmp.bus_index < 10; tmp.bus_index++) { 373 for (tmp.bus_index = 0; tmp.bus_index < 10; tmp.bus_index++) {
374 result = ps3_repository_read_bus_id(tmp.bus_index, 374 result = ps3_repository_read_bus_id(tmp.bus_index,
375 &tmp.bus_id); 375 &tmp.bus_id);
376 if (result) { 376 if (result) {
377 pr_debug("%s:%u read_bus_id(%u) failed\n", __func__, 377 pr_devel("%s:%u read_bus_id(%u) failed\n", __func__,
378 __LINE__, tmp.bus_index); 378 __LINE__, tmp.bus_index);
379 return result; 379 return result;
380 } 380 }
@@ -382,23 +382,23 @@ int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,
382 if (tmp.bus_id == bus_id) 382 if (tmp.bus_id == bus_id)
383 goto found_bus; 383 goto found_bus;
384 384
385 pr_debug("%s:%u: skip, bus_id %llu\n", __func__, __LINE__, 385 pr_devel("%s:%u: skip, bus_id %llu\n", __func__, __LINE__,
386 tmp.bus_id); 386 tmp.bus_id);
387 } 387 }
388 pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__); 388 pr_devel(" <- %s:%u: bus not found\n", __func__, __LINE__);
389 return result; 389 return result;
390 390
391found_bus: 391found_bus:
392 result = ps3_repository_read_bus_type(tmp.bus_index, &tmp.bus_type); 392 result = ps3_repository_read_bus_type(tmp.bus_index, &tmp.bus_type);
393 if (result) { 393 if (result) {
394 pr_debug("%s:%u read_bus_type(%u) failed\n", __func__, 394 pr_devel("%s:%u read_bus_type(%u) failed\n", __func__,
395 __LINE__, tmp.bus_index); 395 __LINE__, tmp.bus_index);
396 return result; 396 return result;
397 } 397 }
398 398
399 result = ps3_repository_read_bus_num_dev(tmp.bus_index, &num_dev); 399 result = ps3_repository_read_bus_num_dev(tmp.bus_index, &num_dev);
400 if (result) { 400 if (result) {
401 pr_debug("%s:%u read_bus_num_dev failed\n", __func__, 401 pr_devel("%s:%u read_bus_num_dev failed\n", __func__,
402 __LINE__); 402 __LINE__);
403 return result; 403 return result;
404 } 404 }
@@ -408,7 +408,7 @@ found_bus:
408 tmp.dev_index, 408 tmp.dev_index,
409 &tmp.dev_id); 409 &tmp.dev_id);
410 if (result) { 410 if (result) {
411 pr_debug("%s:%u read_dev_id(%u:%u) failed\n", __func__, 411 pr_devel("%s:%u read_dev_id(%u:%u) failed\n", __func__,
412 __LINE__, tmp.bus_index, tmp.dev_index); 412 __LINE__, tmp.bus_index, tmp.dev_index);
413 return result; 413 return result;
414 } 414 }
@@ -416,21 +416,21 @@ found_bus:
416 if (tmp.dev_id == dev_id) 416 if (tmp.dev_id == dev_id)
417 goto found_dev; 417 goto found_dev;
418 418
419 pr_debug("%s:%u: skip, dev_id %llu\n", __func__, __LINE__, 419 pr_devel("%s:%u: skip, dev_id %llu\n", __func__, __LINE__,
420 tmp.dev_id); 420 tmp.dev_id);
421 } 421 }
422 pr_debug(" <- %s:%u: dev not found\n", __func__, __LINE__); 422 pr_devel(" <- %s:%u: dev not found\n", __func__, __LINE__);
423 return result; 423 return result;
424 424
425found_dev: 425found_dev:
426 result = ps3_repository_read_dev_type(tmp.bus_index, tmp.dev_index, 426 result = ps3_repository_read_dev_type(tmp.bus_index, tmp.dev_index,
427 &tmp.dev_type); 427 &tmp.dev_type);
428 if (result) { 428 if (result) {
429 pr_debug("%s:%u read_dev_type failed\n", __func__, __LINE__); 429 pr_devel("%s:%u read_dev_type failed\n", __func__, __LINE__);
430 return result; 430 return result;
431 } 431 }
432 432
433 pr_debug(" <- %s:%u: found: type (%u:%u) index (%u:%u) id (%llu:%llu)\n", 433 pr_devel(" <- %s:%u: found: type (%u:%u) index (%u:%u) id (%llu:%llu)\n",
434 __func__, __LINE__, tmp.bus_type, tmp.dev_type, tmp.bus_index, 434 __func__, __LINE__, tmp.bus_type, tmp.dev_type, tmp.bus_index,
435 tmp.dev_index, tmp.bus_id, tmp.dev_id); 435 tmp.dev_index, tmp.bus_id, tmp.dev_id);
436 *repo = tmp; 436 *repo = tmp;
@@ -443,18 +443,18 @@ int __devinit ps3_repository_find_devices(enum ps3_bus_type bus_type,
443 int result = 0; 443 int result = 0;
444 struct ps3_repository_device repo; 444 struct ps3_repository_device repo;
445 445
446 pr_debug(" -> %s:%d: find bus_type %u\n", __func__, __LINE__, bus_type); 446 pr_devel(" -> %s:%d: find bus_type %u\n", __func__, __LINE__, bus_type);
447 447
448 repo.bus_type = bus_type; 448 repo.bus_type = bus_type;
449 result = ps3_repository_find_bus(repo.bus_type, 0, &repo.bus_index); 449 result = ps3_repository_find_bus(repo.bus_type, 0, &repo.bus_index);
450 if (result) { 450 if (result) {
451 pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__); 451 pr_devel(" <- %s:%u: bus not found\n", __func__, __LINE__);
452 return result; 452 return result;
453 } 453 }
454 454
455 result = ps3_repository_read_bus_id(repo.bus_index, &repo.bus_id); 455 result = ps3_repository_read_bus_id(repo.bus_index, &repo.bus_id);
456 if (result) { 456 if (result) {
457 pr_debug("%s:%d read_bus_id(%u) failed\n", __func__, __LINE__, 457 pr_devel("%s:%d read_bus_id(%u) failed\n", __func__, __LINE__,
458 repo.bus_index); 458 repo.bus_index);
459 return result; 459 return result;
460 } 460 }
@@ -469,13 +469,13 @@ int __devinit ps3_repository_find_devices(enum ps3_bus_type bus_type,
469 469
470 result = callback(&repo); 470 result = callback(&repo);
471 if (result) { 471 if (result) {
472 pr_debug("%s:%d: abort at callback\n", __func__, 472 pr_devel("%s:%d: abort at callback\n", __func__,
473 __LINE__); 473 __LINE__);
474 break; 474 break;
475 } 475 }
476 } 476 }
477 477
478 pr_debug(" <- %s:%d\n", __func__, __LINE__); 478 pr_devel(" <- %s:%d\n", __func__, __LINE__);
479 return result; 479 return result;
480} 480}
481 481
@@ -489,7 +489,7 @@ int ps3_repository_find_bus(enum ps3_bus_type bus_type, unsigned int from,
489 for (i = from; i < 10; i++) { 489 for (i = from; i < 10; i++) {
490 error = ps3_repository_read_bus_type(i, &type); 490 error = ps3_repository_read_bus_type(i, &type);
491 if (error) { 491 if (error) {
492 pr_debug("%s:%d read_bus_type failed\n", 492 pr_devel("%s:%d read_bus_type failed\n",
493 __func__, __LINE__); 493 __func__, __LINE__);
494 *bus_index = UINT_MAX; 494 *bus_index = UINT_MAX;
495 return error; 495 return error;
@@ -509,7 +509,7 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *repo,
509 int result = 0; 509 int result = 0;
510 unsigned int res_index; 510 unsigned int res_index;
511 511
512 pr_debug("%s:%d: find intr_type %u\n", __func__, __LINE__, intr_type); 512 pr_devel("%s:%d: find intr_type %u\n", __func__, __LINE__, intr_type);
513 513
514 *interrupt_id = UINT_MAX; 514 *interrupt_id = UINT_MAX;
515 515
@@ -521,7 +521,7 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *repo,
521 repo->dev_index, res_index, &t, &id); 521 repo->dev_index, res_index, &t, &id);
522 522
523 if (result) { 523 if (result) {
524 pr_debug("%s:%d read_dev_intr failed\n", 524 pr_devel("%s:%d read_dev_intr failed\n",
525 __func__, __LINE__); 525 __func__, __LINE__);
526 return result; 526 return result;
527 } 527 }
@@ -535,7 +535,7 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *repo,
535 if (res_index == 10) 535 if (res_index == 10)
536 return -ENODEV; 536 return -ENODEV;
537 537
538 pr_debug("%s:%d: found intr_type %u at res_index %u\n", 538 pr_devel("%s:%d: found intr_type %u at res_index %u\n",
539 __func__, __LINE__, intr_type, res_index); 539 __func__, __LINE__, intr_type, res_index);
540 540
541 return result; 541 return result;
@@ -547,7 +547,7 @@ int ps3_repository_find_reg(const struct ps3_repository_device *repo,
547 int result = 0; 547 int result = 0;
548 unsigned int res_index; 548 unsigned int res_index;
549 549
550 pr_debug("%s:%d: find reg_type %u\n", __func__, __LINE__, reg_type); 550 pr_devel("%s:%d: find reg_type %u\n", __func__, __LINE__, reg_type);
551 551
552 *bus_addr = *len = 0; 552 *bus_addr = *len = 0;
553 553
@@ -560,7 +560,7 @@ int ps3_repository_find_reg(const struct ps3_repository_device *repo,
560 repo->dev_index, res_index, &t, &a, &l); 560 repo->dev_index, res_index, &t, &a, &l);
561 561
562 if (result) { 562 if (result) {
563 pr_debug("%s:%d read_dev_reg failed\n", 563 pr_devel("%s:%d read_dev_reg failed\n",
564 __func__, __LINE__); 564 __func__, __LINE__);
565 return result; 565 return result;
566 } 566 }
@@ -575,7 +575,7 @@ int ps3_repository_find_reg(const struct ps3_repository_device *repo,
575 if (res_index == 10) 575 if (res_index == 10)
576 return -ENODEV; 576 return -ENODEV;
577 577
578 pr_debug("%s:%d: found reg_type %u at res_index %u\n", 578 pr_devel("%s:%d: found reg_type %u at res_index %u\n",
579 __func__, __LINE__, reg_type, res_index); 579 __func__, __LINE__, reg_type, res_index);
580 580
581 return result; 581 return result;
@@ -1009,7 +1009,7 @@ int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo)
1009 int result = 0; 1009 int result = 0;
1010 unsigned int res_index; 1010 unsigned int res_index;
1011 1011
1012 pr_debug(" -> %s:%d: (%u:%u)\n", __func__, __LINE__, 1012 pr_devel(" -> %s:%d: (%u:%u)\n", __func__, __LINE__,
1013 repo->bus_index, repo->dev_index); 1013 repo->bus_index, repo->dev_index);
1014 1014
1015 for (res_index = 0; res_index < 10; res_index++) { 1015 for (res_index = 0; res_index < 10; res_index++) {
@@ -1021,13 +1021,13 @@ int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo)
1021 1021
1022 if (result) { 1022 if (result) {
1023 if (result != LV1_NO_ENTRY) 1023 if (result != LV1_NO_ENTRY)
1024 pr_debug("%s:%d ps3_repository_read_dev_intr" 1024 pr_devel("%s:%d ps3_repository_read_dev_intr"
1025 " (%u:%u) failed\n", __func__, __LINE__, 1025 " (%u:%u) failed\n", __func__, __LINE__,
1026 repo->bus_index, repo->dev_index); 1026 repo->bus_index, repo->dev_index);
1027 break; 1027 break;
1028 } 1028 }
1029 1029
1030 pr_debug("%s:%d (%u:%u) intr_type %u, interrupt_id %u\n", 1030 pr_devel("%s:%d (%u:%u) intr_type %u, interrupt_id %u\n",
1031 __func__, __LINE__, repo->bus_index, repo->dev_index, 1031 __func__, __LINE__, repo->bus_index, repo->dev_index,
1032 intr_type, interrupt_id); 1032 intr_type, interrupt_id);
1033 } 1033 }
@@ -1042,18 +1042,18 @@ int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo)
1042 1042
1043 if (result) { 1043 if (result) {
1044 if (result != LV1_NO_ENTRY) 1044 if (result != LV1_NO_ENTRY)
1045 pr_debug("%s:%d ps3_repository_read_dev_reg" 1045 pr_devel("%s:%d ps3_repository_read_dev_reg"
1046 " (%u:%u) failed\n", __func__, __LINE__, 1046 " (%u:%u) failed\n", __func__, __LINE__,
1047 repo->bus_index, repo->dev_index); 1047 repo->bus_index, repo->dev_index);
1048 break; 1048 break;
1049 } 1049 }
1050 1050
1051 pr_debug("%s:%d (%u:%u) reg_type %u, bus_addr %lxh, len %lxh\n", 1051 pr_devel("%s:%d (%u:%u) reg_type %u, bus_addr %llxh, len %llxh\n",
1052 __func__, __LINE__, repo->bus_index, repo->dev_index, 1052 __func__, __LINE__, repo->bus_index, repo->dev_index,
1053 reg_type, bus_addr, len); 1053 reg_type, bus_addr, len);
1054 } 1054 }
1055 1055
1056 pr_debug(" <- %s:%d\n", __func__, __LINE__); 1056 pr_devel(" <- %s:%d\n", __func__, __LINE__);
1057 return result; 1057 return result;
1058} 1058}
1059 1059
@@ -1063,22 +1063,22 @@ static int dump_stor_dev_info(struct ps3_repository_device *repo)
1063 unsigned int num_regions, region_index; 1063 unsigned int num_regions, region_index;
1064 u64 port, blk_size, num_blocks; 1064 u64 port, blk_size, num_blocks;
1065 1065
1066 pr_debug(" -> %s:%d: (%u:%u)\n", __func__, __LINE__, 1066 pr_devel(" -> %s:%d: (%u:%u)\n", __func__, __LINE__,
1067 repo->bus_index, repo->dev_index); 1067 repo->bus_index, repo->dev_index);
1068 1068
1069 result = ps3_repository_read_stor_dev_info(repo->bus_index, 1069 result = ps3_repository_read_stor_dev_info(repo->bus_index,
1070 repo->dev_index, &port, &blk_size, &num_blocks, &num_regions); 1070 repo->dev_index, &port, &blk_size, &num_blocks, &num_regions);
1071 if (result) { 1071 if (result) {
1072 pr_debug("%s:%d ps3_repository_read_stor_dev_info" 1072 pr_devel("%s:%d ps3_repository_read_stor_dev_info"
1073 " (%u:%u) failed\n", __func__, __LINE__, 1073 " (%u:%u) failed\n", __func__, __LINE__,
1074 repo->bus_index, repo->dev_index); 1074 repo->bus_index, repo->dev_index);
1075 goto out; 1075 goto out;
1076 } 1076 }
1077 1077
1078 pr_debug("%s:%d (%u:%u): port %lu, blk_size %lu, num_blocks " 1078 pr_devel("%s:%d (%u:%u): port %llu, blk_size %llu, num_blocks "
1079 "%lu, num_regions %u\n", 1079 "%llu, num_regions %u\n",
1080 __func__, __LINE__, repo->bus_index, repo->dev_index, port, 1080 __func__, __LINE__, repo->bus_index, repo->dev_index,
1081 blk_size, num_blocks, num_regions); 1081 port, blk_size, num_blocks, num_regions);
1082 1082
1083 for (region_index = 0; region_index < num_regions; region_index++) { 1083 for (region_index = 0; region_index < num_regions; region_index++) {
1084 unsigned int region_id; 1084 unsigned int region_id;
@@ -1088,19 +1088,20 @@ static int dump_stor_dev_info(struct ps3_repository_device *repo)
1088 repo->dev_index, region_index, &region_id, 1088 repo->dev_index, region_index, &region_id,
1089 &region_start, &region_size); 1089 &region_start, &region_size);
1090 if (result) { 1090 if (result) {
1091 pr_debug("%s:%d ps3_repository_read_stor_dev_region" 1091 pr_devel("%s:%d ps3_repository_read_stor_dev_region"
1092 " (%u:%u) failed\n", __func__, __LINE__, 1092 " (%u:%u) failed\n", __func__, __LINE__,
1093 repo->bus_index, repo->dev_index); 1093 repo->bus_index, repo->dev_index);
1094 break; 1094 break;
1095 } 1095 }
1096 1096
1097 pr_debug("%s:%d (%u:%u) region_id %u, start %lxh, size %lxh\n", 1097 pr_devel("%s:%d (%u:%u) region_id %u, start %lxh, size %lxh\n",
1098 __func__, __LINE__, repo->bus_index, repo->dev_index, 1098 __func__, __LINE__, repo->bus_index, repo->dev_index,
1099 region_id, region_start, region_size); 1099 region_id, (unsigned long)region_start,
1100 (unsigned long)region_size);
1100 } 1101 }
1101 1102
1102out: 1103out:
1103 pr_debug(" <- %s:%d\n", __func__, __LINE__); 1104 pr_devel(" <- %s:%d\n", __func__, __LINE__);
1104 return result; 1105 return result;
1105} 1106}
1106 1107
@@ -1109,7 +1110,7 @@ static int dump_device_info(struct ps3_repository_device *repo,
1109{ 1110{
1110 int result = 0; 1111 int result = 0;
1111 1112
1112 pr_debug(" -> %s:%d: bus_%u\n", __func__, __LINE__, repo->bus_index); 1113 pr_devel(" -> %s:%d: bus_%u\n", __func__, __LINE__, repo->bus_index);
1113 1114
1114 for (repo->dev_index = 0; repo->dev_index < num_dev; 1115 for (repo->dev_index = 0; repo->dev_index < num_dev;
1115 repo->dev_index++) { 1116 repo->dev_index++) {
@@ -1118,7 +1119,7 @@ static int dump_device_info(struct ps3_repository_device *repo,
1118 repo->dev_index, &repo->dev_type); 1119 repo->dev_index, &repo->dev_type);
1119 1120
1120 if (result) { 1121 if (result) {
1121 pr_debug("%s:%d ps3_repository_read_dev_type" 1122 pr_devel("%s:%d ps3_repository_read_dev_type"
1122 " (%u:%u) failed\n", __func__, __LINE__, 1123 " (%u:%u) failed\n", __func__, __LINE__,
1123 repo->bus_index, repo->dev_index); 1124 repo->bus_index, repo->dev_index);
1124 break; 1125 break;
@@ -1128,15 +1129,15 @@ static int dump_device_info(struct ps3_repository_device *repo,
1128 repo->dev_index, &repo->dev_id); 1129 repo->dev_index, &repo->dev_id);
1129 1130
1130 if (result) { 1131 if (result) {
1131 pr_debug("%s:%d ps3_repository_read_dev_id" 1132 pr_devel("%s:%d ps3_repository_read_dev_id"
1132 " (%u:%u) failed\n", __func__, __LINE__, 1133 " (%u:%u) failed\n", __func__, __LINE__,
1133 repo->bus_index, repo->dev_index); 1134 repo->bus_index, repo->dev_index);
1134 continue; 1135 continue;
1135 } 1136 }
1136 1137
1137 pr_debug("%s:%d (%u:%u): dev_type %u, dev_id %lu\n", __func__, 1138 pr_devel("%s:%d (%u:%u): dev_type %u, dev_id %lu\n", __func__,
1138 __LINE__, repo->bus_index, repo->dev_index, 1139 __LINE__, repo->bus_index, repo->dev_index,
1139 repo->dev_type, repo->dev_id); 1140 repo->dev_type, (unsigned long)repo->dev_id);
1140 1141
1141 ps3_repository_dump_resource_info(repo); 1142 ps3_repository_dump_resource_info(repo);
1142 1143
@@ -1144,7 +1145,7 @@ static int dump_device_info(struct ps3_repository_device *repo,
1144 dump_stor_dev_info(repo); 1145 dump_stor_dev_info(repo);
1145 } 1146 }
1146 1147
1147 pr_debug(" <- %s:%d\n", __func__, __LINE__); 1148 pr_devel(" <- %s:%d\n", __func__, __LINE__);
1148 return result; 1149 return result;
1149} 1150}
1150 1151
@@ -1153,7 +1154,7 @@ int ps3_repository_dump_bus_info(void)
1153 int result = 0; 1154 int result = 0;
1154 struct ps3_repository_device repo; 1155 struct ps3_repository_device repo;
1155 1156
1156 pr_debug(" -> %s:%d\n", __func__, __LINE__); 1157 pr_devel(" -> %s:%d\n", __func__, __LINE__);
1157 1158
1158 memset(&repo, 0, sizeof(repo)); 1159 memset(&repo, 0, sizeof(repo));
1159 1160
@@ -1164,7 +1165,7 @@ int ps3_repository_dump_bus_info(void)
1164 &repo.bus_type); 1165 &repo.bus_type);
1165 1166
1166 if (result) { 1167 if (result) {
1167 pr_debug("%s:%d read_bus_type(%u) failed\n", 1168 pr_devel("%s:%d read_bus_type(%u) failed\n",
1168 __func__, __LINE__, repo.bus_index); 1169 __func__, __LINE__, repo.bus_index);
1169 break; 1170 break;
1170 } 1171 }
@@ -1173,32 +1174,32 @@ int ps3_repository_dump_bus_info(void)
1173 &repo.bus_id); 1174 &repo.bus_id);
1174 1175
1175 if (result) { 1176 if (result) {
1176 pr_debug("%s:%d read_bus_id(%u) failed\n", 1177 pr_devel("%s:%d read_bus_id(%u) failed\n",
1177 __func__, __LINE__, repo.bus_index); 1178 __func__, __LINE__, repo.bus_index);
1178 continue; 1179 continue;
1179 } 1180 }
1180 1181
1181 if (repo.bus_index != repo.bus_id) 1182 if (repo.bus_index != repo.bus_id)
1182 pr_debug("%s:%d bus_index != bus_id\n", 1183 pr_devel("%s:%d bus_index != bus_id\n",
1183 __func__, __LINE__); 1184 __func__, __LINE__);
1184 1185
1185 result = ps3_repository_read_bus_num_dev(repo.bus_index, 1186 result = ps3_repository_read_bus_num_dev(repo.bus_index,
1186 &num_dev); 1187 &num_dev);
1187 1188
1188 if (result) { 1189 if (result) {
1189 pr_debug("%s:%d read_bus_num_dev(%u) failed\n", 1190 pr_devel("%s:%d read_bus_num_dev(%u) failed\n",
1190 __func__, __LINE__, repo.bus_index); 1191 __func__, __LINE__, repo.bus_index);
1191 continue; 1192 continue;
1192 } 1193 }
1193 1194
1194 pr_debug("%s:%d bus_%u: bus_type %u, bus_id %lu, num_dev %u\n", 1195 pr_devel("%s:%d bus_%u: bus_type %u, bus_id %lu, num_dev %u\n",
1195 __func__, __LINE__, repo.bus_index, repo.bus_type, 1196 __func__, __LINE__, repo.bus_index, repo.bus_type,
1196 repo.bus_id, num_dev); 1197 (unsigned long)repo.bus_id, num_dev);
1197 1198
1198 dump_device_info(&repo, num_dev); 1199 dump_device_info(&repo, num_dev);
1199 } 1200 }
1200 1201
1201 pr_debug(" <- %s:%d\n", __func__, __LINE__); 1202 pr_devel(" <- %s:%d\n", __func__, __LINE__);
1202 return result; 1203 return result;
1203} 1204}
1204 1205
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index e8ec1b2bfffd..2d664c5a83b0 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -193,10 +193,12 @@ static int ps3_set_dabr(unsigned long dabr)
193 193
194static void __init ps3_setup_arch(void) 194static void __init ps3_setup_arch(void)
195{ 195{
196 u64 tmp;
196 197
197 DBG(" -> %s:%d\n", __func__, __LINE__); 198 DBG(" -> %s:%d\n", __func__, __LINE__);
198 199
199 lv1_get_version_info(&ps3_firmware_version.raw); 200 lv1_get_version_info(&ps3_firmware_version.raw, &tmp);
201
200 printk(KERN_INFO "PS3 firmware version %u.%u.%u\n", 202 printk(KERN_INFO "PS3 firmware version %u.%u.%u\n",
201 ps3_firmware_version.major, ps3_firmware_version.minor, 203 ps3_firmware_version.major, ps3_firmware_version.minor,
202 ps3_firmware_version.rev); 204 ps3_firmware_version.rev);
diff --git a/arch/powerpc/platforms/ps3/smp.c b/arch/powerpc/platforms/ps3/smp.c
index 4c44794faac0..4b35166229fe 100644
--- a/arch/powerpc/platforms/ps3/smp.c
+++ b/arch/powerpc/platforms/ps3/smp.c
@@ -57,48 +57,51 @@ static void ps3_smp_message_pass(int cpu, int msg)
57 " (%d)\n", __func__, __LINE__, cpu, msg, result); 57 " (%d)\n", __func__, __LINE__, cpu, msg, result);
58} 58}
59 59
60static int ps3_smp_probe(void) 60static int __init ps3_smp_probe(void)
61{ 61{
62 return 2; 62 int cpu;
63}
64 63
65static void __init ps3_smp_setup_cpu(int cpu) 64 for (cpu = 0; cpu < 2; cpu++) {
66{ 65 int result;
67 int result; 66 unsigned int *virqs = per_cpu(ps3_ipi_virqs, cpu);
68 unsigned int *virqs = per_cpu(ps3_ipi_virqs, cpu); 67 int i;
69 int i;
70 68
71 DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu); 69 DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
72 70
73 /* 71 /*
74 * Check assumptions on ps3_ipi_virqs[] indexing. If this 72 * Check assumptions on ps3_ipi_virqs[] indexing. If this
75 * check fails, then a different mapping of PPC_MSG_ 73 * check fails, then a different mapping of PPC_MSG_
76 * to index needs to be setup. 74 * to index needs to be setup.
77 */ 75 */
78 76
79 BUILD_BUG_ON(PPC_MSG_CALL_FUNCTION != 0); 77 BUILD_BUG_ON(PPC_MSG_CALL_FUNCTION != 0);
80 BUILD_BUG_ON(PPC_MSG_RESCHEDULE != 1); 78 BUILD_BUG_ON(PPC_MSG_RESCHEDULE != 1);
81 BUILD_BUG_ON(PPC_MSG_CALL_FUNC_SINGLE != 2); 79 BUILD_BUG_ON(PPC_MSG_CALL_FUNC_SINGLE != 2);
82 BUILD_BUG_ON(PPC_MSG_DEBUGGER_BREAK != 3); 80 BUILD_BUG_ON(PPC_MSG_DEBUGGER_BREAK != 3);
83 81
84 for (i = 0; i < MSG_COUNT; i++) { 82 for (i = 0; i < MSG_COUNT; i++) {
85 result = ps3_event_receive_port_setup(cpu, &virqs[i]); 83 result = ps3_event_receive_port_setup(cpu, &virqs[i]);
86 84
87 if (result) 85 if (result)
88 continue; 86 continue;
89 87
90 DBG("%s:%d: (%d, %d) => virq %u\n", 88 DBG("%s:%d: (%d, %d) => virq %u\n",
91 __func__, __LINE__, cpu, i, virqs[i]); 89 __func__, __LINE__, cpu, i, virqs[i]);
92 90
93 result = smp_request_message_ipi(virqs[i], i); 91 result = smp_request_message_ipi(virqs[i], i);
94 92
95 if (result) 93 if (result)
96 virqs[i] = NO_IRQ; 94 virqs[i] = NO_IRQ;
97 } 95 else
96 ps3_register_ipi_irq(cpu, virqs[i]);
97 }
98 98
99 ps3_register_ipi_debug_brk(cpu, virqs[PPC_MSG_DEBUGGER_BREAK]); 99 ps3_register_ipi_debug_brk(cpu, virqs[PPC_MSG_DEBUGGER_BREAK]);
100 100
101 DBG(" <- %s:%d: (%d)\n", __func__, __LINE__, cpu); 101 DBG(" <- %s:%d: (%d)\n", __func__, __LINE__, cpu);
102 }
103
104 return 2;
102} 105}
103 106
104void ps3_smp_cleanup_cpu(int cpu) 107void ps3_smp_cleanup_cpu(int cpu)
@@ -121,7 +124,6 @@ static struct smp_ops_t ps3_smp_ops = {
121 .probe = ps3_smp_probe, 124 .probe = ps3_smp_probe,
122 .message_pass = ps3_smp_message_pass, 125 .message_pass = ps3_smp_message_pass,
123 .kick_cpu = smp_generic_kick_cpu, 126 .kick_cpu = smp_generic_kick_cpu,
124 .setup_cpu = ps3_smp_setup_cpu,
125}; 127};
126 128
127void smp_init_ps3(void) 129void smp_init_ps3(void)
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index 451fad1c92a8..e17fa1432d80 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -154,7 +154,7 @@ static unsigned long get_vas_id(void)
154 u64 id; 154 u64 id;
155 155
156 lv1_get_logical_ppe_id(&id); 156 lv1_get_logical_ppe_id(&id);
157 lv1_get_virtual_address_space_id_of_ppe(id, &id); 157 lv1_get_virtual_address_space_id_of_ppe(&id);
158 158
159 return id; 159 return id;
160} 160}