Skip to contentSkip to conversation

powerpc/8xxx: query feature reporting register for num cores on unknown cpus

PATCH New Kim Phillips 3 participants 5 messages Jul 15, 2010 – Aug 18, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 powerpc/8xxx: query feature reporting register for num cores on unknown cpus

doing so helps avant garde users, such as those using simulators that allow users to configure the number of cores, so as to not have to manually adjust u-boot sources. h/w should also be reliably setting FRR NCPU in the future.

---
 arch/powerpc/cpu/mpc8xxx/cpu.c        |   10 ++++++++--
 arch/powerpc/include/asm/immap_85xx.h |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/powerpc/cpu/mpc8xxx/cpu.c +8 -2
index 22f3423..89434e1 100644
@@ -104,8 +104,14 @@ struct cpu_type *identify_cpu(u32 ver)
 }
 
 int cpu_numcores() {
-	struct cpu_type *cpu;
-	cpu = gd->cpu;
+	ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC85xx_PIC_ADDR;
+	struct cpu_type *cpu = gd->cpu;
+
+	/* better to query feature reporting register than just assume 1 */
+	if (cpu == &cpu_type_unknown)
+		return ((in_be32(&pic->frr) & MPC85xx_PICFRR_NCPU_MASK) >>
+			MPC85xx_PICFRR_NCPU_SHIFT) + 1;
+
 	return cpu->num_cores;
 }
 
arch/powerpc/include/asm/immap_85xx.h +2 -0
index a37bc80..e1d077b 100644
@@ -759,6 +759,8 @@ typedef struct ccsr_pic {
 	u32	eoi;		/* End Of IRQ */
 	u8	res9[3916];
 	u32	frr;		/* Feature Reporting */
+#define MPC85xx_PICFRR_NCPU_MASK	0x00001f00
+#define MPC85xx_PICFRR_NCPU_SHIFT	8
 	u8	res10[28];
 	u32	gcr;		/* Global Configuration */
 #define MPC85xx_PICGCR_RST	0x80000000
Signature · 1 line
1.7.1.1
Applied
#1 lore raw

PATCH 2/2 powerpc/8xxx: query feature reporting register for num cores on unknown cpus

Quoted 10 lines · Kim Phillips

doing so helps avant garde users, such as those using simulators that allow users to configure the number of cores, so as to not have to manually adjust u-boot sources. h/w should also be reliably setting FRR NCPU in the future.

---
arch/powerpc/cpu/mpc8xxx/cpu.c | 10 ++++++++--
arch/powerpc/include/asm/immap_85xx.h | 2 ++

2 files changed, 10 insertions(+), 2 deletions(-)

applied to 85xx

- k

#2 lore raw

PATCH 2/2 powerpc/8xxx: query feature reporting register for num cores on unknown cpus

In reply to Kim Phillips

Dear Kim,

Quoted 10 lines · In message <[email protected]> you wrote:

doing so helps avant garde users, such as those using simulators that allow users to configure the number of cores, so as to not have to manually adjust u-boot sources. h/w should also be reliably setting FRR NCPU in the future.

---
 arch/powerpc/cpu/mpc8xxx/cpu.c        |   10 ++++++++--
 arch/powerpc/include/asm/immap_85xx.h |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

Unfortunately this commit breaks a number of boards, especially 86xx ones. For example:

$ ./MAKEALL MPC8610HPCD
Configuring for MPC8610HPCD board...
cpu.c: In function 'cpu_numcores':
cpu.c:113: error: 'CONFIG_SYS_MPC85xx_PIC_ADDR' undeclared (first use in this function)
cpu.c:113: error: (Each undeclared identifier is reported only once
cpu.c:113: error: for each function it appears in.)
cpu.c:118: error: 'MPC85xx_PICFRR_NCPU_MASK' undeclared (first use in this function)
cpu.c:119: error: 'MPC85xx_PICFRR_NCPU_SHIFT' undeclared (first use in this function)
make[1]: *** [/work/wd/tmp-ppc/arch/powerpc/cpu/mpc8xxx/cpu.o] Error 1
make: *** [/work/wd/tmp-ppc/arch/powerpc/cpu/mpc8xxx/lib8xxx.a] Error 2
make: *** Waiting for unfinished jobs....
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file

And git bisect says:

a37c36f4e70bada297f281b0e542539ad43e50f6 is the first bad commit commit a37c36f4e70bada297f281b0e542539ad43e50f6

Author: Kim Phillips <[email protected]>
Date:   Wed Jul 14 19:47:29 2010 -0500

powerpc/8xxx: query feature reporting register for num cores on unknown cpus

Can you please have a look at it?

[Did both you and Kumar forget to run MAKEALL?]

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
For every complex problem, there is a solution that is simple,  neat,
and wrong.                                               - Mark Twain
#3 lore raw

PATCH 2/2 powerpc/8xxx: query feature reporting register for num cores on unknown cpus

Quoted 8 lines · On Mon, 9 Aug 2010 23:33:18 +0200 Wolfgang Denk <[email protected]> wrote:

Dear Kim,

Quoted 5 lines · In message <[email protected]> you wrote:

doing so helps avant garde users, such as those using simulators that allow users to configure the number of cores, so as to not have to manually adjust u-boot sources. h/w should also be reliably setting FRR NCPU in the future.

Quoted 8 lines
Quoted 5 lines
---
 arch/powerpc/cpu/mpc8xxx/cpu.c        |   10 ++++++++--
 arch/powerpc/include/asm/immap_85xx.h |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

Unfortunately this commit breaks a number of boards, especially 86xx ones. For example:

sorry, my fault - this should fix it:

Applied
#4 lore raw

PATCH 2/2 powerpc/8xxx: query feature reporting register for num cores on unknown cpus

Quoted 13 lines · Kim Phillips
Quoted 2 lines

From 093851331069abefe38e93bb04f715e9c63c9dd3 Mon Sep 17 00:00:00 2001

From: Kim Phillips <[email protected]>
Date: Mon, 9 Aug 2010 18:28:40 -0500
Subject: [PATCH] powerpc/8xxx: share PIC defines among 85xx and 86xx

fixes breakeage introduced by commit a37c36f4e70bada297f281b0e542539ad43e50f6 "powerpc/8xxx: query feature reporting register for num cores on unknown cpus"

---

Quoted 9 lines
arch/powerpc/cpu/mpc85xx/cpu.c        |    2 +-
arch/powerpc/cpu/mpc85xx/cpu_init.c   |    2 +-
arch/powerpc/cpu/mpc85xx/interrupts.c |    2 +-
arch/powerpc/cpu/mpc85xx/mp.c         |    6 +++---
arch/powerpc/cpu/mpc85xx/traps.c      |    2 +-
arch/powerpc/cpu/mpc8xxx/cpu.c        |    8 +++++---
arch/powerpc/include/asm/immap_85xx.h |    4 +---
arch/powerpc/include/asm/immap_86xx.h |    9 ++++++---
8 files changed, 19 insertions(+), 16 deletions(-)

applied

- k