Skip to contentSkip to conversation

powerpc/85xx: Setup secondary cores PIR with hard SMP id

PATCH Applied Kumar Gala 2 participants 5 messages Oct 14, 2011 – Nov 3, 2011

Subsystems (2)
lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 powerpc/85xx: Setup secondary cores PIR with hard SMP id

Normally logical and hard cpu ID are the same, however in same cases like on the P3060 they may differ. Where the logical is 0..5, the hard id goes 0,1,4..7. This can causes issues for places we utilize PIR to index into array like in debug exception handlers for finding the exception stack.

Move to setting up PIR with hard_smp_processor_id fixes the issue.

---
 arch/powerpc/platforms/85xx/smp.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
arch/powerpc/platforms/85xx/smp.c +5 -4
index d6e4746..190d111 100644
@@ -48,10 +48,11 @@ smp_85xx_kick_cpu(int nr)
 	const u64 *cpu_rel_addr;
 	__iomem u32 *bptr_vaddr;
 	struct device_node *np;
-	int n = 0;
+	int n = 0, hw_cpu = get_hard_smp_processor_id(nr);
 	int ioremappable;
 
-	WARN_ON (nr < 0 || nr >= NR_CPUS);
+	WARN_ON(nr < 0 || nr >= NR_CPUS);
+	WARN_ON(hw_cpu < 0 || hw_cpu >= NR_CPUS);
 
 	pr_debug("smp_85xx_kick_cpu: kick CPU #%d\n", nr);
 
@@ -79,7 +80,7 @@ smp_85xx_kick_cpu(int nr)
 
 	local_irq_save(flags);
 
-	out_be32(bptr_vaddr + BOOT_ENTRY_PIR, nr);
+	out_be32(bptr_vaddr + BOOT_ENTRY_PIR, hw_cpu);
 #ifdef CONFIG_PPC32
 	out_be32(bptr_vaddr + BOOT_ENTRY_ADDR_LOWER, __pa(__early_start));
 
@@ -88,7 +89,7 @@ smp_85xx_kick_cpu(int nr)
 				(ulong)(bptr_vaddr + SIZE_BOOT_ENTRY));
 
 	/* Wait a bit for the CPU to ack. */
-	while ((__secondary_hold_acknowledge != nr) && (++n < 1000))
+	while ((__secondary_hold_acknowledge != hw_cpu) && (++n < 1000))
 		mdelay(1);
 #else
 	smp_generic_kick_cpu(nr);
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 4 lines

-----Original Message-----
From: linuxppc-dev-bounces+bharat.bhushan=3Dfreescale.com@lists.ozlabs.or=

g

Quoted 2 lines

[mailto:linuxppc-dev- [email protected]] On Behalf Of Kum=

ar

Quoted 10 lines

Gala
Sent: Friday, October 14, 2011 1:23 PM
To: [email protected]
Subject: [PATCH] powerpc/85xx: Setup secondary cores PIR with hard SMP id =20
Normally logical and hard cpu ID are the same, however in same cases like on the P3060 they may differ. Where the logical is 0..5, the hard id goes 0,1,4..7. This can causes issues for places we utilize PIR to index into array like in debug exception handlers for finding the exception stack.

Kumar, What should be the CONFIG_NR_CPUS for this? 8 or 6 ?

Thanks
-Bharat

Quoted 52 lines

=20
Move to setting up PIR with hard_smp_processor_id fixes the issue. =20

---
 arch/powerpc/platforms/85xx/smp.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

=20

arch/powerpc/platforms/85xx/smp.c +1 -1
index d6e4746..190d111 100644
@@ -48,10 +48,11 @@ smp_85xx_kick_cpu(int nr)
 	const u64 *cpu_rel_addr;
 	__iomem u32 *bptr_vaddr;
 	struct device_node *np;
-	int n =3D 0;
+	int n =3D 0, hw_cpu =3D get_hard_smp_processor_id(nr);
 	int ioremappable;

=20

arch/powerpc/platforms/85xx/smp.c +2 -1
-	WARN_ON (nr < 0 || nr >=3D NR_CPUS);
+	WARN_ON(nr < 0 || nr >=3D NR_CPUS);
+	WARN_ON(hw_cpu < 0 || hw_cpu >=3D NR_CPUS);

=20
pr_debug("smp_85xx_kick_cpu: kick CPU #%d\n", nr);
=20

arch/powerpc/platforms/85xx/smp.c +0 -0
@@ -79,7 +80,7 @@ smp_85xx_kick_cpu(int nr)

=20
local_irq_save(flags);
=20

arch/powerpc/platforms/85xx/smp.c +1 -1
-	out_be32(bptr_vaddr + BOOT_ENTRY_PIR, nr);
+	out_be32(bptr_vaddr + BOOT_ENTRY_PIR, hw_cpu);
 #ifdef CONFIG_PPC32
 	out_be32(bptr_vaddr + BOOT_ENTRY_ADDR_LOWER, __pa(__early_start));

=20

arch/powerpc/platforms/85xx/smp.c +0 -0
@@ -88,7 +89,7 @@ smp_85xx_kick_cpu(int nr)
 				(ulong)(bptr_vaddr + SIZE_BOOT_ENTRY));

=20

arch/powerpc/platforms/85xx/smp.c +1 -2
 	/* Wait a bit for the CPU to ack. */
-	while ((__secondary_hold_acknowledge !=3D nr) && (++n < 1000))
+	while ((__secondary_hold_acknowledge !=3D hw_cpu) && (++n < 1000))
 		mdelay(1);
 #else
 	smp_generic_kick_cpu(nr);
--

1.7.3.4
=20
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

author
#2 lore raw
Quoted 11 lines · On Oct 19, 2011, at 10:53 PM, Bhushan Bharat-R65777 wrote:
Quoted 11 lines

-----Original Message-----
From: linuxppc-dev-bounces+bharat.bhushan=freescale.com@lists.ozlabs.org [mailto:linuxppc-dev- [email protected]] On Behalf Of Kumar Gala
Sent: Friday, October 14, 2011 1:23 PM
To: [email protected]
Subject: [PATCH] powerpc/85xx: Setup secondary cores PIR with hard SMP id

Quoted 7 lines
Quoted 5 lines

Normally logical and hard cpu ID are the same, however in same cases like on the P3060 they may differ. Where the logical is 0..5, the hard id goes 0,1,4..7. This can causes issues for places we utilize PIR to index into array like in debug exception handlers for finding the exception stack.

Kumar, What should be the CONFIG_NR_CPUS for this? 8 or 6 ?

8.

- k

#3 lore raw
Quoted 33 lines

-----Original Message-----
From: Kumar Gala [mailto:[email protected]]
Sent: Thursday, October 20, 2011 9:32 AM
To: Bhushan Bharat-R65777
Cc: [email protected]
Subject: Re: [PATCH] powerpc/85xx: Setup secondary cores PIR with hard SMP id
=20
=20
On Oct 19, 2011, at 10:53 PM, Bhushan Bharat-R65777 wrote:
=20

Quoted 20 lines
Quoted 19 lines

-----Original Message-----
From:
linuxppc-dev-bounces+bharat.bhushan=3Dfreescale.com@lists.ozlabs.org [mailto:linuxppc-dev- [email protected]] On Behalf Of bounces+Kumar
Gala
Sent: Friday, October 14, 2011 1:23 PM
To: [email protected]
Subject: [PATCH] powerpc/85xx: Setup secondary cores PIR with hard SMP id

Normally logical and hard cpu ID are the same, however in same cases like on the P3060 they may differ. Where the logical is 0..5, the hard id goes 0,1,4..7. This can causes issues for places we utilize PIR to index into array like in debug exception handlers for finding the exception stack.

Quoted 3 lines
Quoted 1 line

Kumar, What should be the CONFIG_NR_CPUS for this? 8 or 6 ?

=20
8.

Kumar, I am just trying to understand the impact of setting NR_CPUS =3D 8 w= hile actual cpus are 6 only.

If I understood correctly, cpu_present, cpu_online are logical cpuid bit ma= p. Also the PACA is allocated for nr_cpu_ids (NR_CPUS) and also indexed by = logical cpuid. While they have knowledge of physical_cpuid.

So in this case last two entries of PACA will not be used or wasted? I am not sure I am missing something here?

Thanks
-Bharat

author Applied
#4 lore raw
In reply to Kumar Gala
Quoted 6 lines · Kumar Gala

Normally logical and hard cpu ID are the same, however in same cases like on the P3060 they may differ. Where the logical is 0..5, the hard id goes 0,1,4..7. This can causes issues for places we utilize PIR to index into array like in debug exception handlers for finding the exception stack.

Quoted 6 lines

Move to setting up PIR with hard_smp_processor_id fixes the issue.

---
arch/powerpc/platforms/85xx/smp.c | 9 +++++----

1 files changed, 5 insertions(+), 4 deletions(-)

applied

- k