aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/iseries
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2010-01-28 08:23:22 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-03-08 19:52:52 -0500
commit1426d5a3bd07589534286375998c0c8c6fdc5260 (patch)
treefade4f3afd6324b46e27f3c8702935a7edc2fe21 /arch/powerpc/platforms/iseries
parent59603b9ae426e968d452f9325cdcff308573dee7 (diff)
powerpc: Dynamically allocate pacas
On 64-bit kernels we currently have a 512 byte struct paca_struct for each cpu (usually just called "the paca"). Currently they are statically allocated, which means a kernel built for a large number of cpus will waste a lot of space if it's booted on a machine with few cpus. We can avoid that by only allocating the number of pacas we need at boot. However this is complicated by the fact that we need to access the paca before we know how many cpus there are in the system. The solution is to dynamically allocate enough space for NR_CPUS pacas, but then later in boot when we know how many cpus we have, we free any unused pacas. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/iseries')
-rw-r--r--arch/powerpc/platforms/iseries/exception.S25
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index 5369653dcf6a..fba5bf915073 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -43,17 +43,14 @@ system_reset_iSeries:
43 LOAD_REG_ADDR(r23, alpaca) 43 LOAD_REG_ADDR(r23, alpaca)
44 li r0,ALPACA_SIZE 44 li r0,ALPACA_SIZE
45 sub r23,r13,r23 45 sub r23,r13,r23
46 divdu r23,r23,r0 /* r23 has cpu number */ 46 divdu r24,r23,r0 /* r24 has cpu number */
47 LOAD_REG_ADDR(r13, paca)
48 mulli r0,r23,PACA_SIZE
49 add r13,r13,r0
50 mtspr SPRN_SPRG_PACA,r13 /* Save it away for the future */
51 mfmsr r24
52 ori r24,r24,MSR_RI
53 mtmsrd r24 /* RI on */
54 mr r24,r23
55 cmpwi 0,r24,0 /* Are we processor 0? */ 47 cmpwi 0,r24,0 /* Are we processor 0? */
56 bne 1f 48 bne 1f
49 LOAD_REG_ADDR(r13, boot_paca)
50 mtspr SPRN_SPRG_PACA,r13 /* Save it away for the future */
51 mfmsr r23
52 ori r23,r23,MSR_RI
53 mtmsrd r23 /* RI on */
57 b .__start_initialization_iSeries /* Start up the first processor */ 54 b .__start_initialization_iSeries /* Start up the first processor */
581: mfspr r4,SPRN_CTRLF 551: mfspr r4,SPRN_CTRLF
59 li r5,CTRL_RUNLATCH /* Turn off the run light */ 56 li r5,CTRL_RUNLATCH /* Turn off the run light */
@@ -86,6 +83,16 @@ system_reset_iSeries:
86#endif 83#endif
87 84
882: 852:
86 /* Load our paca now that it's been allocated */
87 LOAD_REG_ADDR(r13, paca)
88 ld r13,0(r13)
89 mulli r0,r24,PACA_SIZE
90 add r13,r13,r0
91 mtspr SPRN_SPRG_PACA,r13 /* Save it away for the future */
92 mfmsr r23
93 ori r23,r23,MSR_RI
94 mtmsrd r23 /* RI on */
95
89 HMT_LOW 96 HMT_LOW
90#ifdef CONFIG_SMP 97#ifdef CONFIG_SMP
91 lbz r23,PACAPROCSTART(r13) /* Test if this processor 98 lbz r23,PACAPROCSTART(r13) /* Test if this processor