diff options
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/83xx/mpc832x_mds.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/83xx/mpc832x_rdb.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/83xx/mpc836x_mds.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/mpc85xx_mds.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_base.c | 141 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_manage.c | 163 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/Kconfig | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/device-init.c | 37 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/spu.c | 6 |
9 files changed, 194 insertions, 167 deletions
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c index b39cb52c6fb9..2c8e641a739b 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c | |||
@@ -106,7 +106,6 @@ static struct of_device_id mpc832x_ids[] = { | |||
106 | { .type = "soc", }, | 106 | { .type = "soc", }, |
107 | { .compatible = "soc", }, | 107 | { .compatible = "soc", }, |
108 | { .type = "qe", }, | 108 | { .type = "qe", }, |
109 | { .type = "mdio", }, | ||
110 | {}, | 109 | {}, |
111 | }; | 110 | }; |
112 | 111 | ||
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c index b2b28a44738c..090906170a41 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c | |||
@@ -70,7 +70,6 @@ static struct of_device_id mpc832x_ids[] = { | |||
70 | { .type = "soc", }, | 70 | { .type = "soc", }, |
71 | { .compatible = "soc", }, | 71 | { .compatible = "soc", }, |
72 | { .type = "qe", }, | 72 | { .type = "qe", }, |
73 | { .type = "mdio", }, | ||
74 | {}, | 73 | {}, |
75 | }; | 74 | }; |
76 | 75 | ||
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c index 0e615fd65c1f..84b58934aafd 100644 --- a/arch/powerpc/platforms/83xx/mpc836x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c | |||
@@ -113,7 +113,6 @@ static struct of_device_id mpc836x_ids[] = { | |||
113 | { .type = "soc", }, | 113 | { .type = "soc", }, |
114 | { .compatible = "soc", }, | 114 | { .compatible = "soc", }, |
115 | { .type = "qe", }, | 115 | { .type = "qe", }, |
116 | { .type = "mdio", }, | ||
117 | {}, | 116 | {}, |
118 | }; | 117 | }; |
119 | 118 | ||
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c index e8003bf00c9a..be25ecd911ba 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c | |||
@@ -142,7 +142,6 @@ static struct of_device_id mpc85xx_ids[] = { | |||
142 | { .type = "soc", }, | 142 | { .type = "soc", }, |
143 | { .compatible = "soc", }, | 143 | { .compatible = "soc", }, |
144 | { .type = "qe", }, | 144 | { .type = "qe", }, |
145 | { .type = "mdio", }, | ||
146 | {}, | 145 | {}, |
147 | }; | 146 | }; |
148 | 147 | ||
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 90124228b8f4..095a30304c56 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <asm/spu_priv1.h> | 36 | #include <asm/spu_priv1.h> |
37 | #include <asm/xmon.h> | 37 | #include <asm/xmon.h> |
38 | #include <asm/prom.h> | 38 | #include <asm/prom.h> |
39 | #include "spu_priv1_mmio.h" | ||
40 | 39 | ||
41 | const struct spu_management_ops *spu_management_ops; | 40 | const struct spu_management_ops *spu_management_ops; |
42 | EXPORT_SYMBOL_GPL(spu_management_ops); | 41 | EXPORT_SYMBOL_GPL(spu_management_ops); |
@@ -636,138 +635,6 @@ static ssize_t spu_stat_show(struct sys_device *sysdev, char *buf) | |||
636 | 635 | ||
637 | static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); | 636 | static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); |
638 | 637 | ||
639 | /* Hardcoded affinity idxs for QS20 */ | ||
640 | #define SPES_PER_BE 8 | ||
641 | static int QS20_reg_idxs[SPES_PER_BE] = { 0, 2, 4, 6, 7, 5, 3, 1 }; | ||
642 | static int QS20_reg_memory[SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 }; | ||
643 | |||
644 | static struct spu *spu_lookup_reg(int node, u32 reg) | ||
645 | { | ||
646 | struct spu *spu; | ||
647 | |||
648 | list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) { | ||
649 | if (*(u32 *)get_property(spu_devnode(spu), "reg", NULL) == reg) | ||
650 | return spu; | ||
651 | } | ||
652 | return NULL; | ||
653 | } | ||
654 | |||
655 | static void init_aff_QS20_harcoded(void) | ||
656 | { | ||
657 | int node, i; | ||
658 | struct spu *last_spu, *spu; | ||
659 | u32 reg; | ||
660 | |||
661 | for (node = 0; node < MAX_NUMNODES; node++) { | ||
662 | last_spu = NULL; | ||
663 | for (i = 0; i < SPES_PER_BE; i++) { | ||
664 | reg = QS20_reg_idxs[i]; | ||
665 | spu = spu_lookup_reg(node, reg); | ||
666 | if (!spu) | ||
667 | continue; | ||
668 | spu->has_mem_affinity = QS20_reg_memory[reg]; | ||
669 | if (last_spu) | ||
670 | list_add_tail(&spu->aff_list, | ||
671 | &last_spu->aff_list); | ||
672 | last_spu = spu; | ||
673 | } | ||
674 | } | ||
675 | } | ||
676 | |||
677 | static int of_has_vicinity(void) | ||
678 | { | ||
679 | struct spu* spu; | ||
680 | |||
681 | spu = list_entry(cbe_spu_info[0].spus.next, struct spu, cbe_list); | ||
682 | return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL; | ||
683 | } | ||
684 | |||
685 | static struct spu *aff_devnode_spu(int cbe, struct device_node *dn) | ||
686 | { | ||
687 | struct spu *spu; | ||
688 | |||
689 | list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) | ||
690 | if (spu_devnode(spu) == dn) | ||
691 | return spu; | ||
692 | return NULL; | ||
693 | } | ||
694 | |||
695 | static struct spu * | ||
696 | aff_node_next_to(int cbe, struct device_node *target, struct device_node *avoid) | ||
697 | { | ||
698 | struct spu *spu; | ||
699 | const phandle *vic_handles; | ||
700 | int lenp, i; | ||
701 | |||
702 | list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) { | ||
703 | if (spu_devnode(spu) == avoid) | ||
704 | continue; | ||
705 | vic_handles = get_property(spu_devnode(spu), "vicinity", &lenp); | ||
706 | for (i=0; i < (lenp / sizeof(phandle)); i++) { | ||
707 | if (vic_handles[i] == target->linux_phandle) | ||
708 | return spu; | ||
709 | } | ||
710 | } | ||
711 | return NULL; | ||
712 | } | ||
713 | |||
714 | static void init_aff_fw_vicinity_node(int cbe) | ||
715 | { | ||
716 | struct spu *spu, *last_spu; | ||
717 | struct device_node *vic_dn, *last_spu_dn; | ||
718 | phandle avoid_ph; | ||
719 | const phandle *vic_handles; | ||
720 | const char *name; | ||
721 | int lenp, i, added, mem_aff; | ||
722 | |||
723 | last_spu = list_entry(cbe_spu_info[cbe].spus.next, struct spu, cbe_list); | ||
724 | avoid_ph = 0; | ||
725 | for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) { | ||
726 | last_spu_dn = spu_devnode(last_spu); | ||
727 | vic_handles = get_property(last_spu_dn, "vicinity", &lenp); | ||
728 | |||
729 | for (i = 0; i < (lenp / sizeof(phandle)); i++) { | ||
730 | if (vic_handles[i] == avoid_ph) | ||
731 | continue; | ||
732 | |||
733 | vic_dn = of_find_node_by_phandle(vic_handles[i]); | ||
734 | if (!vic_dn) | ||
735 | continue; | ||
736 | |||
737 | name = get_property(vic_dn, "name", NULL); | ||
738 | if (strcmp(name, "spe") == 0) { | ||
739 | spu = aff_devnode_spu(cbe, vic_dn); | ||
740 | avoid_ph = last_spu_dn->linux_phandle; | ||
741 | } | ||
742 | else { | ||
743 | mem_aff = strcmp(name, "mic-tm") == 0; | ||
744 | spu = aff_node_next_to(cbe, vic_dn, last_spu_dn); | ||
745 | if (!spu) | ||
746 | continue; | ||
747 | if (mem_aff) { | ||
748 | last_spu->has_mem_affinity = 1; | ||
749 | spu->has_mem_affinity = 1; | ||
750 | } | ||
751 | avoid_ph = vic_dn->linux_phandle; | ||
752 | } | ||
753 | list_add_tail(&spu->aff_list, &last_spu->aff_list); | ||
754 | last_spu = spu; | ||
755 | break; | ||
756 | } | ||
757 | } | ||
758 | } | ||
759 | |||
760 | static void init_aff_fw_vicinity(void) | ||
761 | { | ||
762 | int cbe; | ||
763 | |||
764 | /* sets has_mem_affinity for each spu, as long as the | ||
765 | * spu->aff_list list, linking each spu to its neighbors | ||
766 | */ | ||
767 | for (cbe = 0; cbe < MAX_NUMNODES; cbe++) | ||
768 | init_aff_fw_vicinity_node(cbe); | ||
769 | } | ||
770 | |||
771 | static int __init init_spu_base(void) | 638 | static int __init init_spu_base(void) |
772 | { | 639 | { |
773 | int i, ret = 0; | 640 | int i, ret = 0; |
@@ -811,13 +678,7 @@ static int __init init_spu_base(void) | |||
811 | mutex_unlock(&spu_full_list_mutex); | 678 | mutex_unlock(&spu_full_list_mutex); |
812 | spu_add_sysdev_attr(&attr_stat); | 679 | spu_add_sysdev_attr(&attr_stat); |
813 | 680 | ||
814 | if (of_has_vicinity()) { | 681 | spu_init_affinity(); |
815 | init_aff_fw_vicinity(); | ||
816 | } else { | ||
817 | long root = of_get_flat_dt_root(); | ||
818 | if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) | ||
819 | init_aff_QS20_harcoded(); | ||
820 | } | ||
821 | 682 | ||
822 | return 0; | 683 | return 0; |
823 | 684 | ||
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c index 75ed50fcc3db..5eb88346181a 100644 --- a/arch/powerpc/platforms/cell/spu_manage.c +++ b/arch/powerpc/platforms/cell/spu_manage.c | |||
@@ -361,8 +361,171 @@ static int of_destroy_spu(struct spu *spu) | |||
361 | return 0; | 361 | return 0; |
362 | } | 362 | } |
363 | 363 | ||
364 | /* Hardcoded affinity idxs for qs20 */ | ||
365 | #define QS20_SPES_PER_BE 8 | ||
366 | static int qs20_reg_idxs[QS20_SPES_PER_BE] = { 0, 2, 4, 6, 7, 5, 3, 1 }; | ||
367 | static int qs20_reg_memory[QS20_SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 }; | ||
368 | |||
369 | static struct spu *spu_lookup_reg(int node, u32 reg) | ||
370 | { | ||
371 | struct spu *spu; | ||
372 | u32 *spu_reg; | ||
373 | |||
374 | list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) { | ||
375 | spu_reg = (u32*)of_get_property(spu_devnode(spu), "reg", NULL); | ||
376 | if (*spu_reg == reg) | ||
377 | return spu; | ||
378 | } | ||
379 | return NULL; | ||
380 | } | ||
381 | |||
382 | static void init_affinity_qs20_harcoded(void) | ||
383 | { | ||
384 | int node, i; | ||
385 | struct spu *last_spu, *spu; | ||
386 | u32 reg; | ||
387 | |||
388 | for (node = 0; node < MAX_NUMNODES; node++) { | ||
389 | last_spu = NULL; | ||
390 | for (i = 0; i < QS20_SPES_PER_BE; i++) { | ||
391 | reg = qs20_reg_idxs[i]; | ||
392 | spu = spu_lookup_reg(node, reg); | ||
393 | if (!spu) | ||
394 | continue; | ||
395 | spu->has_mem_affinity = qs20_reg_memory[reg]; | ||
396 | if (last_spu) | ||
397 | list_add_tail(&spu->aff_list, | ||
398 | &last_spu->aff_list); | ||
399 | last_spu = spu; | ||
400 | } | ||
401 | } | ||
402 | } | ||
403 | |||
404 | static int of_has_vicinity(void) | ||
405 | { | ||
406 | struct spu* spu; | ||
407 | |||
408 | spu = list_first_entry(&cbe_spu_info[0].spus, struct spu, cbe_list); | ||
409 | return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL; | ||
410 | } | ||
411 | |||
412 | static struct spu *devnode_spu(int cbe, struct device_node *dn) | ||
413 | { | ||
414 | struct spu *spu; | ||
415 | |||
416 | list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) | ||
417 | if (spu_devnode(spu) == dn) | ||
418 | return spu; | ||
419 | return NULL; | ||
420 | } | ||
421 | |||
422 | static struct spu * | ||
423 | neighbour_spu(int cbe, struct device_node *target, struct device_node *avoid) | ||
424 | { | ||
425 | struct spu *spu; | ||
426 | struct device_node *spu_dn; | ||
427 | const phandle *vic_handles; | ||
428 | int lenp, i; | ||
429 | |||
430 | list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) { | ||
431 | spu_dn = spu_devnode(spu); | ||
432 | if (spu_dn == avoid) | ||
433 | continue; | ||
434 | vic_handles = of_get_property(spu_dn, "vicinity", &lenp); | ||
435 | for (i=0; i < (lenp / sizeof(phandle)); i++) { | ||
436 | if (vic_handles[i] == target->linux_phandle) | ||
437 | return spu; | ||
438 | } | ||
439 | } | ||
440 | return NULL; | ||
441 | } | ||
442 | |||
443 | static void init_affinity_node(int cbe) | ||
444 | { | ||
445 | struct spu *spu, *last_spu; | ||
446 | struct device_node *vic_dn, *last_spu_dn; | ||
447 | phandle avoid_ph; | ||
448 | const phandle *vic_handles; | ||
449 | const char *name; | ||
450 | int lenp, i, added; | ||
451 | |||
452 | last_spu = list_first_entry(&cbe_spu_info[cbe].spus, struct spu, | ||
453 | cbe_list); | ||
454 | avoid_ph = 0; | ||
455 | for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) { | ||
456 | last_spu_dn = spu_devnode(last_spu); | ||
457 | vic_handles = of_get_property(last_spu_dn, "vicinity", &lenp); | ||
458 | |||
459 | /* | ||
460 | * Walk through each phandle in vicinity property of the spu | ||
461 | * (tipically two vicinity phandles per spe node) | ||
462 | */ | ||
463 | for (i = 0; i < (lenp / sizeof(phandle)); i++) { | ||
464 | if (vic_handles[i] == avoid_ph) | ||
465 | continue; | ||
466 | |||
467 | vic_dn = of_find_node_by_phandle(vic_handles[i]); | ||
468 | if (!vic_dn) | ||
469 | continue; | ||
470 | |||
471 | /* a neighbour might be spe, mic-tm, or bif0 */ | ||
472 | name = of_get_property(vic_dn, "name", NULL); | ||
473 | if (!name) | ||
474 | continue; | ||
475 | |||
476 | if (strcmp(name, "spe") == 0) { | ||
477 | spu = devnode_spu(cbe, vic_dn); | ||
478 | avoid_ph = last_spu_dn->linux_phandle; | ||
479 | } else { | ||
480 | /* | ||
481 | * "mic-tm" and "bif0" nodes do not have | ||
482 | * vicinity property. So we need to find the | ||
483 | * spe which has vic_dn as neighbour, but | ||
484 | * skipping the one we came from (last_spu_dn) | ||
485 | */ | ||
486 | spu = neighbour_spu(cbe, vic_dn, last_spu_dn); | ||
487 | if (!spu) | ||
488 | continue; | ||
489 | if (!strcmp(name, "mic-tm")) { | ||
490 | last_spu->has_mem_affinity = 1; | ||
491 | spu->has_mem_affinity = 1; | ||
492 | } | ||
493 | avoid_ph = vic_dn->linux_phandle; | ||
494 | } | ||
495 | |||
496 | list_add_tail(&spu->aff_list, &last_spu->aff_list); | ||
497 | last_spu = spu; | ||
498 | break; | ||
499 | } | ||
500 | } | ||
501 | } | ||
502 | |||
503 | static void init_affinity_fw(void) | ||
504 | { | ||
505 | int cbe; | ||
506 | |||
507 | for (cbe = 0; cbe < MAX_NUMNODES; cbe++) | ||
508 | init_affinity_node(cbe); | ||
509 | } | ||
510 | |||
511 | static int __init init_affinity(void) | ||
512 | { | ||
513 | if (of_has_vicinity()) { | ||
514 | init_affinity_fw(); | ||
515 | } else { | ||
516 | long root = of_get_flat_dt_root(); | ||
517 | if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) | ||
518 | init_affinity_qs20_harcoded(); | ||
519 | else | ||
520 | printk("No affinity configuration found"); | ||
521 | } | ||
522 | |||
523 | return 0; | ||
524 | } | ||
525 | |||
364 | const struct spu_management_ops spu_management_of_ops = { | 526 | const struct spu_management_ops spu_management_of_ops = { |
365 | .enumerate_spus = of_enumerate_spus, | 527 | .enumerate_spus = of_enumerate_spus, |
366 | .create_spu = of_create_spu, | 528 | .create_spu = of_create_spu, |
367 | .destroy_spu = of_destroy_spu, | 529 | .destroy_spu = of_destroy_spu, |
530 | .init_affinity = init_affinity, | ||
368 | }; | 531 | }; |
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig index d4fc74f7bb15..67144d1d1405 100644 --- a/arch/powerpc/platforms/ps3/Kconfig +++ b/arch/powerpc/platforms/ps3/Kconfig | |||
@@ -1,5 +1,5 @@ | |||
1 | config PPC_PS3 | 1 | config PPC_PS3 |
2 | bool "Sony PS3 (incomplete)" | 2 | bool "Sony PS3" |
3 | depends on PPC_MULTIPLATFORM && PPC64 | 3 | depends on PPC_MULTIPLATFORM && PPC64 |
4 | select PPC_CELL | 4 | select PPC_CELL |
5 | select USB_ARCH_HAS_OHCI | 5 | select USB_ARCH_HAS_OHCI |
@@ -10,10 +10,10 @@ config PPC_PS3 | |||
10 | select MEMORY_HOTPLUG | 10 | select MEMORY_HOTPLUG |
11 | help | 11 | help |
12 | This option enables support for the Sony PS3 game console | 12 | This option enables support for the Sony PS3 game console |
13 | and other platforms using the PS3 hypervisor. | 13 | and other platforms using the PS3 hypervisor. Enabling this |
14 | Support for this platform is not yet complete, so | 14 | option will allow building otheros.bld, a kernel image suitable |
15 | enabling this will not result in a bootable kernel on a | 15 | for programming into flash memory, and vmlinux, a kernel image |
16 | PS3 system. | 16 | suitable for loading via kexec. |
17 | 17 | ||
18 | menu "PS3 Platform Options" | 18 | menu "PS3 Platform Options" |
19 | depends on PPC_PS3 | 19 | depends on PPC_PS3 |
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c index 825ebb2cbc2a..e23a5a874ad3 100644 --- a/arch/powerpc/platforms/ps3/device-init.c +++ b/arch/powerpc/platforms/ps3/device-init.c | |||
@@ -273,55 +273,58 @@ static int ps3stor_wait_for_completion(u64 dev_id, u64 tag, | |||
273 | 273 | ||
274 | static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo) | 274 | static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo) |
275 | { | 275 | { |
276 | int error = -ENODEV; | ||
276 | int result; | 277 | int result; |
277 | const u64 notification_dev_id = (u64)-1LL; | 278 | const u64 notification_dev_id = (u64)-1LL; |
278 | const unsigned int timeout = HZ; | 279 | const unsigned int timeout = HZ; |
279 | u64 lpar; | 280 | u64 lpar; |
280 | u64 tag; | 281 | u64 tag; |
282 | void *buf; | ||
283 | enum ps3_notify_type { | ||
284 | notify_device_ready = 0, | ||
285 | notify_region_probe = 1, | ||
286 | notify_region_update = 2, | ||
287 | }; | ||
281 | struct { | 288 | struct { |
282 | u64 operation_code; /* must be zero */ | 289 | u64 operation_code; /* must be zero */ |
283 | u64 event_mask; /* 1 = device ready */ | 290 | u64 event_mask; /* OR of 1UL << enum ps3_notify_type */ |
284 | } *notify_cmd; | 291 | } *notify_cmd; |
285 | struct { | 292 | struct { |
286 | u64 event_type; /* notify_device_ready */ | 293 | u64 event_type; /* enum ps3_notify_type */ |
287 | u64 bus_id; | 294 | u64 bus_id; |
288 | u64 dev_id; | 295 | u64 dev_id; |
289 | u64 dev_type; | 296 | u64 dev_type; |
290 | u64 dev_port; | 297 | u64 dev_port; |
291 | } *notify_event; | 298 | } *notify_event; |
292 | enum { | ||
293 | notify_device_ready = 1 | ||
294 | }; | ||
295 | 299 | ||
296 | pr_debug(" -> %s:%u: bus_id %u, dev_id %u, dev_type %u\n", __func__, | 300 | pr_debug(" -> %s:%u: bus_id %u, dev_id %u, dev_type %u\n", __func__, |
297 | __LINE__, repo->bus_id, repo->dev_id, repo->dev_type); | 301 | __LINE__, repo->bus_id, repo->dev_id, repo->dev_type); |
298 | 302 | ||
299 | notify_cmd = kzalloc(512, GFP_KERNEL); | 303 | buf = kzalloc(512, GFP_KERNEL); |
300 | notify_event = (void *)notify_cmd; | 304 | if (!buf) |
301 | if (!notify_cmd) | ||
302 | return -ENOMEM; | 305 | return -ENOMEM; |
303 | 306 | ||
304 | lpar = ps3_mm_phys_to_lpar(__pa(notify_cmd)); | 307 | lpar = ps3_mm_phys_to_lpar(__pa(buf)); |
308 | notify_cmd = buf; | ||
309 | notify_event = buf; | ||
305 | 310 | ||
306 | result = lv1_open_device(repo->bus_id, notification_dev_id, 0); | 311 | result = lv1_open_device(repo->bus_id, notification_dev_id, 0); |
307 | if (result) { | 312 | if (result) { |
308 | printk(KERN_ERR "%s:%u: lv1_open_device %s\n", __func__, | 313 | printk(KERN_ERR "%s:%u: lv1_open_device %s\n", __func__, |
309 | __LINE__, ps3_result(result)); | 314 | __LINE__, ps3_result(result)); |
310 | result = -ENODEV; | ||
311 | goto fail_free; | 315 | goto fail_free; |
312 | } | 316 | } |
313 | 317 | ||
314 | /* Setup and write the request for device notification. */ | 318 | /* Setup and write the request for device notification. */ |
315 | 319 | ||
316 | notify_cmd->operation_code = 0; /* must be zero */ | 320 | notify_cmd->operation_code = 0; /* must be zero */ |
317 | notify_cmd->event_mask = 0x01; /* device ready */ | 321 | notify_cmd->event_mask = 1UL << notify_region_probe; |
318 | 322 | ||
319 | result = lv1_storage_write(notification_dev_id, 0, 0, 1, 0, lpar, | 323 | result = lv1_storage_write(notification_dev_id, 0, 0, 1, 0, lpar, |
320 | &tag); | 324 | &tag); |
321 | if (result) { | 325 | if (result) { |
322 | printk(KERN_ERR "%s:%u: write failed %s\n", __func__, __LINE__, | 326 | printk(KERN_ERR "%s:%u: write failed %s\n", __func__, __LINE__, |
323 | ps3_result(result)); | 327 | ps3_result(result)); |
324 | result = -ENODEV; | ||
325 | goto fail_close; | 328 | goto fail_close; |
326 | } | 329 | } |
327 | 330 | ||
@@ -332,13 +335,11 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo) | |||
332 | if (result) { | 335 | if (result) { |
333 | printk(KERN_ERR "%s:%u: write not completed %s\n", __func__, | 336 | printk(KERN_ERR "%s:%u: write not completed %s\n", __func__, |
334 | __LINE__, ps3_result(result)); | 337 | __LINE__, ps3_result(result)); |
335 | result = -ENODEV; | ||
336 | goto fail_close; | 338 | goto fail_close; |
337 | } | 339 | } |
338 | 340 | ||
339 | /* Loop here processing the requested notification events. */ | 341 | /* Loop here processing the requested notification events. */ |
340 | 342 | ||
341 | result = -ENODEV; | ||
342 | while (1) { | 343 | while (1) { |
343 | memset(notify_event, 0, sizeof(*notify_event)); | 344 | memset(notify_event, 0, sizeof(*notify_event)); |
344 | 345 | ||
@@ -358,7 +359,7 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo) | |||
358 | break; | 359 | break; |
359 | } | 360 | } |
360 | 361 | ||
361 | if (notify_event->event_type != notify_device_ready || | 362 | if (notify_event->event_type != notify_region_probe || |
362 | notify_event->bus_id != repo->bus_id) { | 363 | notify_event->bus_id != repo->bus_id) { |
363 | pr_debug("%s:%u: bad notify_event: event %lu, " | 364 | pr_debug("%s:%u: bad notify_event: event %lu, " |
364 | "dev_id %lu, dev_type %lu\n", | 365 | "dev_id %lu, dev_type %lu\n", |
@@ -386,9 +387,9 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo) | |||
386 | fail_close: | 387 | fail_close: |
387 | lv1_close_device(repo->bus_id, notification_dev_id); | 388 | lv1_close_device(repo->bus_id, notification_dev_id); |
388 | fail_free: | 389 | fail_free: |
389 | kfree(notify_cmd); | 390 | kfree(buf); |
390 | pr_debug(" <- %s:%u\n", __func__, __LINE__); | 391 | pr_debug(" <- %s:%u\n", __func__, __LINE__); |
391 | return result; | 392 | return error; |
392 | } | 393 | } |
393 | 394 | ||
394 | static int ps3_setup_storage_dev(const struct ps3_repository_device *repo, | 395 | static int ps3_setup_storage_dev(const struct ps3_repository_device *repo, |
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c index 502d80ed982b..ac2a4b8a4c14 100644 --- a/arch/powerpc/platforms/ps3/spu.c +++ b/arch/powerpc/platforms/ps3/spu.c | |||
@@ -414,10 +414,16 @@ static int __init ps3_enumerate_spus(int (*fn)(void *data)) | |||
414 | return num_resource_id; | 414 | return num_resource_id; |
415 | } | 415 | } |
416 | 416 | ||
417 | static int ps3_init_affinity(void) | ||
418 | { | ||
419 | return 0; | ||
420 | } | ||
421 | |||
417 | const struct spu_management_ops spu_management_ps3_ops = { | 422 | const struct spu_management_ops spu_management_ps3_ops = { |
418 | .enumerate_spus = ps3_enumerate_spus, | 423 | .enumerate_spus = ps3_enumerate_spus, |
419 | .create_spu = ps3_create_spu, | 424 | .create_spu = ps3_create_spu, |
420 | .destroy_spu = ps3_destroy_spu, | 425 | .destroy_spu = ps3_destroy_spu, |
426 | .init_affinity = ps3_init_affinity, | ||
421 | }; | 427 | }; |
422 | 428 | ||
423 | /* spu_priv1_ops */ | 429 | /* spu_priv1_ops */ |