diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2010-01-28 08:23:22 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-03-08 19:52:52 -0500 |
commit | 1426d5a3bd07589534286375998c0c8c6fdc5260 (patch) | |
tree | fade4f3afd6324b46e27f3c8702935a7edc2fe21 /arch/powerpc/kernel/head_64.S | |
parent | 59603b9ae426e968d452f9325cdcff308573dee7 (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/kernel/head_64.S')
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 925807488022..b24b7001ae19 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -219,7 +219,8 @@ generic_secondary_common_init: | |||
219 | * physical cpu id in r24, we need to search the pacas to find | 219 | * physical cpu id in r24, we need to search the pacas to find |
220 | * which logical id maps to our physical one. | 220 | * which logical id maps to our physical one. |
221 | */ | 221 | */ |
222 | LOAD_REG_ADDR(r13, paca) /* Get base vaddr of paca array */ | 222 | LOAD_REG_ADDR(r13, paca) /* Load paca pointer */ |
223 | ld r13,0(r13) /* Get base vaddr of paca array */ | ||
223 | li r5,0 /* logical cpu id */ | 224 | li r5,0 /* logical cpu id */ |
224 | 1: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */ | 225 | 1: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */ |
225 | cmpw r6,r24 /* Compare to our id */ | 226 | cmpw r6,r24 /* Compare to our id */ |
@@ -536,7 +537,8 @@ _GLOBAL(pmac_secondary_start) | |||
536 | mtmsrd r3 /* RI on */ | 537 | mtmsrd r3 /* RI on */ |
537 | 538 | ||
538 | /* Set up a paca value for this processor. */ | 539 | /* Set up a paca value for this processor. */ |
539 | LOAD_REG_ADDR(r4,paca) /* Get base vaddr of paca array */ | 540 | LOAD_REG_ADDR(r4,paca) /* Load paca pointer */ |
541 | ld r4,0(r4) /* Get base vaddr of paca array */ | ||
540 | mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ | 542 | mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ |
541 | add r13,r13,r4 /* for this processor. */ | 543 | add r13,r13,r4 /* for this processor. */ |
542 | mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG*/ | 544 | mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG*/ |