diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2006-05-01 15:16:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-01 21:17:46 -0400 |
commit | 8261aa600943046a5305564a1cd7432009971799 (patch) | |
tree | a25304dd85c473d2fae77bc27fec49183978feba /arch/powerpc | |
parent | 953039c8df7beb2694814e20e2707a77d335a2e3 (diff) |
[PATCH] powerpc: cell: Add numa id to struct spu
Add an nid member to the spu structure, and store the numa id of the spu there
on creation.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/spu_base.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index b788e165c557..ad141fe8d52d 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -529,8 +529,8 @@ static int __init find_spu_node_id(struct device_node *spe) | |||
529 | return id ? *id : 0; | 529 | return id ? *id : 0; |
530 | } | 530 | } |
531 | 531 | ||
532 | static int __init cell_spuprop_present(struct device_node *spe, | 532 | static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, |
533 | const char *prop) | 533 | const char *prop) |
534 | { | 534 | { |
535 | static DEFINE_MUTEX(add_spumem_mutex); | 535 | static DEFINE_MUTEX(add_spumem_mutex); |
536 | 536 | ||
@@ -541,7 +541,6 @@ static int __init cell_spuprop_present(struct device_node *spe, | |||
541 | int proplen; | 541 | int proplen; |
542 | 542 | ||
543 | unsigned long start_pfn, nr_pages; | 543 | unsigned long start_pfn, nr_pages; |
544 | int node_id; | ||
545 | struct pglist_data *pgdata; | 544 | struct pglist_data *pgdata; |
546 | struct zone *zone; | 545 | struct zone *zone; |
547 | int ret; | 546 | int ret; |
@@ -552,14 +551,7 @@ static int __init cell_spuprop_present(struct device_node *spe, | |||
552 | start_pfn = p->address >> PAGE_SHIFT; | 551 | start_pfn = p->address >> PAGE_SHIFT; |
553 | nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 552 | nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
554 | 553 | ||
555 | /* | 554 | pgdata = NODE_DATA(spu->nid); |
556 | * XXX need to get the correct NUMA node in here. This may | ||
557 | * be different from the spe::node_id property, e.g. when | ||
558 | * the host firmware is not NUMA aware. | ||
559 | */ | ||
560 | node_id = 0; | ||
561 | |||
562 | pgdata = NODE_DATA(node_id); | ||
563 | zone = pgdata->node_zones; | 555 | zone = pgdata->node_zones; |
564 | 556 | ||
565 | /* XXX rethink locking here */ | 557 | /* XXX rethink locking here */ |
@@ -570,8 +562,8 @@ static int __init cell_spuprop_present(struct device_node *spe, | |||
570 | return ret; | 562 | return ret; |
571 | } | 563 | } |
572 | 564 | ||
573 | static void __iomem * __init map_spe_prop(struct device_node *n, | 565 | static void __iomem * __init map_spe_prop(struct spu *spu, |
574 | const char *name) | 566 | struct device_node *n, const char *name) |
575 | { | 567 | { |
576 | struct address_prop { | 568 | struct address_prop { |
577 | unsigned long address; | 569 | unsigned long address; |
@@ -589,7 +581,7 @@ static void __iomem * __init map_spe_prop(struct device_node *n, | |||
589 | 581 | ||
590 | prop = p; | 582 | prop = p; |
591 | 583 | ||
592 | err = cell_spuprop_present(n, name); | 584 | err = cell_spuprop_present(spu, n, name); |
593 | if (err && (err != -EEXIST)) | 585 | if (err && (err != -EEXIST)) |
594 | goto out; | 586 | goto out; |
595 | 587 | ||
@@ -607,44 +599,45 @@ static void spu_unmap(struct spu *spu) | |||
607 | iounmap((u8 __iomem *)spu->local_store); | 599 | iounmap((u8 __iomem *)spu->local_store); |
608 | } | 600 | } |
609 | 601 | ||
610 | static int __init spu_map_device(struct spu *spu, struct device_node *spe) | 602 | static int __init spu_map_device(struct spu *spu, struct device_node *node) |
611 | { | 603 | { |
612 | char *prop; | 604 | char *prop; |
613 | int ret; | 605 | int ret; |
614 | 606 | ||
615 | ret = -ENODEV; | 607 | ret = -ENODEV; |
616 | prop = get_property(spe, "isrc", NULL); | 608 | prop = get_property(node, "isrc", NULL); |
617 | if (!prop) | 609 | if (!prop) |
618 | goto out; | 610 | goto out; |
619 | spu->isrc = *(unsigned int *)prop; | 611 | spu->isrc = *(unsigned int *)prop; |
620 | 612 | ||
621 | spu->name = get_property(spe, "name", NULL); | 613 | spu->name = get_property(node, "name", NULL); |
622 | if (!spu->name) | 614 | if (!spu->name) |
623 | goto out; | 615 | goto out; |
624 | 616 | ||
625 | prop = get_property(spe, "local-store", NULL); | 617 | prop = get_property(node, "local-store", NULL); |
626 | if (!prop) | 618 | if (!prop) |
627 | goto out; | 619 | goto out; |
628 | spu->local_store_phys = *(unsigned long *)prop; | 620 | spu->local_store_phys = *(unsigned long *)prop; |
629 | 621 | ||
630 | /* we use local store as ram, not io memory */ | 622 | /* we use local store as ram, not io memory */ |
631 | spu->local_store = (void __force *)map_spe_prop(spe, "local-store"); | 623 | spu->local_store = (void __force *) |
624 | map_spe_prop(spu, node, "local-store"); | ||
632 | if (!spu->local_store) | 625 | if (!spu->local_store) |
633 | goto out; | 626 | goto out; |
634 | 627 | ||
635 | prop = get_property(spe, "problem", NULL); | 628 | prop = get_property(node, "problem", NULL); |
636 | if (!prop) | 629 | if (!prop) |
637 | goto out_unmap; | 630 | goto out_unmap; |
638 | spu->problem_phys = *(unsigned long *)prop; | 631 | spu->problem_phys = *(unsigned long *)prop; |
639 | 632 | ||
640 | spu->problem= map_spe_prop(spe, "problem"); | 633 | spu->problem= map_spe_prop(spu, node, "problem"); |
641 | if (!spu->problem) | 634 | if (!spu->problem) |
642 | goto out_unmap; | 635 | goto out_unmap; |
643 | 636 | ||
644 | spu->priv1= map_spe_prop(spe, "priv1"); | 637 | spu->priv1= map_spe_prop(spu, node, "priv1"); |
645 | /* priv1 is not available on a hypervisor */ | 638 | /* priv1 is not available on a hypervisor */ |
646 | 639 | ||
647 | spu->priv2= map_spe_prop(spe, "priv2"); | 640 | spu->priv2= map_spe_prop(spu, node, "priv2"); |
648 | if (!spu->priv2) | 641 | if (!spu->priv2) |
649 | goto out_unmap; | 642 | goto out_unmap; |
650 | ret = 0; | 643 | ret = 0; |
@@ -672,6 +665,10 @@ static int __init create_spu(struct device_node *spe) | |||
672 | goto out_free; | 665 | goto out_free; |
673 | 666 | ||
674 | spu->node = find_spu_node_id(spe); | 667 | spu->node = find_spu_node_id(spe); |
668 | spu->nid = of_node_to_nid(spe); | ||
669 | if (spu->nid == -1) | ||
670 | spu->nid = 0; | ||
671 | |||
675 | spu->stop_code = 0; | 672 | spu->stop_code = 0; |
676 | spu->slb_replace = 0; | 673 | spu->slb_replace = 0; |
677 | spu->mm = NULL; | 674 | spu->mm = NULL; |