linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0
@ 2010-08-31 23:24 Matthew McClintock
  2010-08-31 23:24 ` [PATCH 2/2] powerpc/fsl_booke: Add support to boot from core other than 0 Matthew McClintock
  2010-09-01 13:05 ` [linuxppc-release] [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0 Timur Tabi
  0 siblings, 2 replies; 6+ messages in thread
From: Matthew McClintock @ 2010-08-31 23:24 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Matthew McClintock, kumar.gala

arch/powerpc/mm/mmu_context_nohash.c assumes the boot cpu
will always have smp_processor_id() == 0. This patch fixes
that assumption

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 arch/powerpc/mm/mmu_context_nohash.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index 1f2d9ff..cf98c1e 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -334,7 +334,7 @@ static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self,
 	/* We don't touch CPU 0 map, it's allocated at aboot and kept
 	 * around forever
 	 */
-	if (cpu == 0)
+	if (cpu == boot_cpuid)
 		return NOTIFY_OK;
 
 	switch (action) {
@@ -412,9 +412,11 @@ void __init mmu_context_init(void)
 	 */
 	context_map = alloc_bootmem(CTX_MAP_SIZE);
 	context_mm = alloc_bootmem(sizeof(void *) * (last_context + 1));
+#ifndef CONFIG_SMP
 	stale_map[0] = alloc_bootmem(CTX_MAP_SIZE);
+#else
+	stale_map[boot_cpuid] = alloc_bootmem(CTX_MAP_SIZE);
 
-#ifdef CONFIG_SMP
 	register_cpu_notifier(&mmu_context_cpu_nb);
 #endif
 
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] powerpc/fsl_booke: Add support to boot from core other than 0
  2010-08-31 23:24 [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0 Matthew McClintock
@ 2010-08-31 23:24 ` Matthew McClintock
  2010-10-07  6:10   ` Kumar Gala
  2010-10-07 17:19   ` Kumar Gala
  2010-09-01 13:05 ` [linuxppc-release] [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0 Timur Tabi
  1 sibling, 2 replies; 6+ messages in thread
From: Matthew McClintock @ 2010-08-31 23:24 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Matthew McClintock, kumar.gala

First we check to see if we are the first core booting up. This
is accomplished by comparing the boot_cpuid with -1, if it is we
assume this is the first core coming up.

Secondly, we need to update the initial thread info structure
to reflect the actual cpu we are running on otherwise
smp_processor_id() and related functions will return the default
initialization value of the struct or 0.

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 arch/powerpc/kernel/head_fsl_booke.S |   10 ++++++++--
 arch/powerpc/kernel/setup_32.c       |    2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 258315a..5bbf593 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -152,8 +152,11 @@ _ENTRY(__early_start)
 	/* Check to see if we're the second processor, and jump
 	 * to the secondary_start code if so
 	 */
-	mfspr	r24,SPRN_PIR
-	cmpwi	r24,0
+	lis	r24, boot_cpuid@h
+	ori	r24, r24, boot_cpuid@l
+	lwz	r24, 0(r24)
+	cmpwi	r24, -1
+	mfspr   r24,SPRN_PIR
 	bne	__secondary_start
 #endif
 
@@ -175,6 +178,9 @@ _ENTRY(__early_start)
 	li	r0,0
 	stwu	r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
 
+	rlwinm  r22,r1,0,0,31-THREAD_SHIFT      /* current thread_info */
+	stw	r24, TI_CPU(r22)
+
 	bl	early_init
 
 #ifdef CONFIG_RELOCATABLE
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 8f58986..4be3ef4 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -46,7 +46,7 @@
 
 extern void bootx_init(unsigned long r4, unsigned long phys);
 
-int boot_cpuid;
+int boot_cpuid = -1;
 EXPORT_SYMBOL_GPL(boot_cpuid);
 int boot_cpuid_phys;
 
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [linuxppc-release] [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0
  2010-08-31 23:24 [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0 Matthew McClintock
  2010-08-31 23:24 ` [PATCH 2/2] powerpc/fsl_booke: Add support to boot from core other than 0 Matthew McClintock
@ 2010-09-01 13:05 ` Timur Tabi
  2010-09-01 13:12   ` Kumar Gala
  1 sibling, 1 reply; 6+ messages in thread
From: Timur Tabi @ 2010-09-01 13:05 UTC (permalink / raw)
  To: Matthew McClintock; +Cc: linuxppc-dev

Matthew McClintock wrote:
> +#ifndef CONFIG_SMP
>  	stale_map[0] = alloc_bootmem(CTX_MAP_SIZE);
> +#else
> +	stale_map[boot_cpuid] = alloc_bootmem(CTX_MAP_SIZE);

So you're saying that even on a non-SMP kernel, boot_cpuid might not be zero?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linuxppc-release] [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0
  2010-09-01 13:05 ` [linuxppc-release] [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0 Timur Tabi
@ 2010-09-01 13:12   ` Kumar Gala
  0 siblings, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2010-09-01 13:12 UTC (permalink / raw)
  To: Timur Tabi; +Cc: Matthew McClintock, linuxppc-dev


On Sep 1, 2010, at 8:05 AM, Timur Tabi wrote:

> Matthew McClintock wrote:
>> +#ifndef CONFIG_SMP
>> 	stale_map[0] =3D alloc_bootmem(CTX_MAP_SIZE);
>> +#else
>> +	stale_map[boot_cpuid] =3D alloc_bootmem(CTX_MAP_SIZE);
>=20
> So you're saying that even on a non-SMP kernel, boot_cpuid might not =
be zero?

That is correct, we have that situation on AMP kernel boots on 8572, =
p2020, etc.

- k=

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] powerpc/fsl_booke: Add support to boot from core other than 0
  2010-08-31 23:24 ` [PATCH 2/2] powerpc/fsl_booke: Add support to boot from core other than 0 Matthew McClintock
@ 2010-10-07  6:10   ` Kumar Gala
  2010-10-07 17:19   ` Kumar Gala
  1 sibling, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2010-10-07  6:10 UTC (permalink / raw)
  To: Matthew McClintock; +Cc: linuxppc-dev


On Aug 31, 2010, at 6:24 PM, Matthew McClintock wrote:

> First we check to see if we are the first core booting up. This
> is accomplished by comparing the boot_cpuid with -1, if it is we
> assume this is the first core coming up.
> 
> Secondly, we need to update the initial thread info structure
> to reflect the actual cpu we are running on otherwise
> smp_processor_id() and related functions will return the default
> initialization value of the struct or 0.
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
> arch/powerpc/kernel/head_fsl_booke.S |   10 ++++++++--
> arch/powerpc/kernel/setup_32.c       |    2 +-
> 2 files changed, 9 insertions(+), 3 deletions(-)

Are we sticking with this or not?

- k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] powerpc/fsl_booke: Add support to boot from core other than 0
  2010-08-31 23:24 ` [PATCH 2/2] powerpc/fsl_booke: Add support to boot from core other than 0 Matthew McClintock
  2010-10-07  6:10   ` Kumar Gala
@ 2010-10-07 17:19   ` Kumar Gala
  1 sibling, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2010-10-07 17:19 UTC (permalink / raw)
  To: Matthew McClintock; +Cc: linuxppc-dev


On Aug 31, 2010, at 6:24 PM, Matthew McClintock wrote:

> First we check to see if we are the first core booting up. This
> is accomplished by comparing the boot_cpuid with -1, if it is we
> assume this is the first core coming up.
> 
> Secondly, we need to update the initial thread info structure
> to reflect the actual cpu we are running on otherwise
> smp_processor_id() and related functions will return the default
> initialization value of the struct or 0.
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
> arch/powerpc/kernel/head_fsl_booke.S |   10 ++++++++--
> arch/powerpc/kernel/setup_32.c       |    2 +-
> 2 files changed, 9 insertions(+), 3 deletions(-)

applied

- k

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-07 17:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-31 23:24 [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0 Matthew McClintock
2010-08-31 23:24 ` [PATCH 2/2] powerpc/fsl_booke: Add support to boot from core other than 0 Matthew McClintock
2010-10-07  6:10   ` Kumar Gala
2010-10-07 17:19   ` Kumar Gala
2010-09-01 13:05 ` [linuxppc-release] [PATCH 1/2] powerpc/mm: Assume first cpu is boot_cpuid not 0 Timur Tabi
2010-09-01 13:12   ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).