diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2013-11-19 19:05:01 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-11-20 18:33:44 -0500 |
commit | 3eb906c6b6c123513718e7742a96a4189f900382 (patch) | |
tree | 116cb8384e74dd0e6466172f87dd309a9a85e0ce /arch | |
parent | c6102609289de268bcc6093e606483ea8bb35c84 (diff) |
powerpc: Make cpu_to_chip_id() available when SMP=n
Up until now we have only used cpu_to_chip_id() in the topology code,
which is only used on SMP builds. However my recent commit a4da0d5
"Implement arch_get_random_long/int() for powernv" added a usage when
SMP=n, breaking the build.
Move cpu_to_chip_id() into prom.c so it is available for SMP=n builds.
We would move the extern to prom.h, but that breaks the include in
topology.h. Instead we leave it in smp.h, but move it out of the
CONFIG_SMP #ifdef. We also need to include asm/smp.h in rng.c, because
the linux version skips asm/smp.h on UP. What a mess.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/smp.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 20 | ||||
-rw-r--r-- | arch/powerpc/kernel/smp.c | 16 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/rng.c | 1 |
4 files changed, 22 insertions, 17 deletions
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h index 98da78e0c2c0..084e0807db98 100644 --- a/arch/powerpc/include/asm/smp.h +++ b/arch/powerpc/include/asm/smp.h | |||
@@ -33,6 +33,7 @@ extern int boot_cpuid; | |||
33 | extern int spinning_secondaries; | 33 | extern int spinning_secondaries; |
34 | 34 | ||
35 | extern void cpu_die(void); | 35 | extern void cpu_die(void); |
36 | extern int cpu_to_chip_id(int cpu); | ||
36 | 37 | ||
37 | #ifdef CONFIG_SMP | 38 | #ifdef CONFIG_SMP |
38 | 39 | ||
@@ -112,7 +113,6 @@ static inline struct cpumask *cpu_core_mask(int cpu) | |||
112 | } | 113 | } |
113 | 114 | ||
114 | extern int cpu_to_core_id(int cpu); | 115 | extern int cpu_to_core_id(int cpu); |
115 | extern int cpu_to_chip_id(int cpu); | ||
116 | 116 | ||
117 | /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. | 117 | /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. |
118 | * | 118 | * |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index f3a47098fb8e..fa0ad8aafbcc 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -777,6 +777,26 @@ int of_get_ibm_chip_id(struct device_node *np) | |||
777 | return -1; | 777 | return -1; |
778 | } | 778 | } |
779 | 779 | ||
780 | /** | ||
781 | * cpu_to_chip_id - Return the cpus chip-id | ||
782 | * @cpu: The logical cpu number. | ||
783 | * | ||
784 | * Return the value of the ibm,chip-id property corresponding to the given | ||
785 | * logical cpu number. If the chip-id can not be found, returns -1. | ||
786 | */ | ||
787 | int cpu_to_chip_id(int cpu) | ||
788 | { | ||
789 | struct device_node *np; | ||
790 | |||
791 | np = of_get_cpu_node(cpu, NULL); | ||
792 | if (!np) | ||
793 | return -1; | ||
794 | |||
795 | of_node_put(np); | ||
796 | return of_get_ibm_chip_id(np); | ||
797 | } | ||
798 | EXPORT_SYMBOL(cpu_to_chip_id); | ||
799 | |||
780 | #ifdef CONFIG_PPC_PSERIES | 800 | #ifdef CONFIG_PPC_PSERIES |
781 | /* | 801 | /* |
782 | * Fix up the uninitialized fields in a new device node: | 802 | * Fix up the uninitialized fields in a new device node: |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 930cd8af3503..a3b64f3bf9a2 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -597,22 +597,6 @@ out: | |||
597 | return id; | 597 | return id; |
598 | } | 598 | } |
599 | 599 | ||
600 | /* Return the value of the chip-id property corresponding | ||
601 | * to the given logical cpu. | ||
602 | */ | ||
603 | int cpu_to_chip_id(int cpu) | ||
604 | { | ||
605 | struct device_node *np; | ||
606 | |||
607 | np = of_get_cpu_node(cpu, NULL); | ||
608 | if (!np) | ||
609 | return -1; | ||
610 | |||
611 | of_node_put(np); | ||
612 | return of_get_ibm_chip_id(np); | ||
613 | } | ||
614 | EXPORT_SYMBOL(cpu_to_chip_id); | ||
615 | |||
616 | /* Helper routines for cpu to core mapping */ | 600 | /* Helper routines for cpu to core mapping */ |
617 | int cpu_core_index_of_thread(int cpu) | 601 | int cpu_core_index_of_thread(int cpu) |
618 | { | 602 | { |
diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c index 8844628915dc..1cb160dc1609 100644 --- a/arch/powerpc/platforms/powernv/rng.c +++ b/arch/powerpc/platforms/powernv/rng.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/io.h> | 19 | #include <asm/io.h> |
20 | #include <asm/prom.h> | 20 | #include <asm/prom.h> |
21 | #include <asm/machdep.h> | 21 | #include <asm/machdep.h> |
22 | #include <asm/smp.h> | ||
22 | 23 | ||
23 | 24 | ||
24 | struct powernv_rng { | 25 | struct powernv_rng { |