* [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support
@ 2009-04-01 16:06 Kumar Gala
2009-04-01 16:06 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Kumar Gala
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Kumar Gala @ 2009-04-01 16:06 UTC (permalink / raw)
To: u-boot
* Use CONFIG_MP instead of CONFIG_NUM_CPUS to match 85xx
* Introduce determine_mp_bootpg() helper. We'll need this to address a
bug introduced in v2009.03 with 86xx MP booting. We have to make sure
to reserve the region of memory used for the MP bootpg() so other
u-boot code doesn't use it.
* Added dummy versions of cpu_status() & cpu_release() to allow cmd_mp.c
to build and work. In the future we should look at implementing
cpu_release(). This could be common w/85xx if we use spin tables on
86xx.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
* removed change to 85xx code
* added comments about cpu_status() & cpu_release()
board/freescale/mpc8641hpcn/mpc8641hpcn.c | 2 +-
board/sbc8641d/sbc8641d.c | 2 +-
cpu/mpc86xx/Makefile | 7 ++--
cpu/mpc86xx/fdt.c | 12 ++-----
cpu/mpc86xx/mp.c | 50 +++++++++++++++++++----------
cpu/mpc86xx/mp.h | 1 +
cpu/mpc86xx/release.S | 2 -
include/configs/MPC8641HPCN.h | 1 +
include/configs/sbc8641d.h | 1 +
9 files changed, 44 insertions(+), 34 deletions(-)
diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
index 1e35dfa..ef0095a 100644
--- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
+++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
@@ -375,7 +375,7 @@ void board_reset(void)
;
}
-#if (CONFIG_NUM_CPUS > 1)
+#ifdef CONFIG_MP
extern void cpu_mp_lmb_reserve(struct lmb *lmb);
void board_lmb_reserve(struct lmb *lmb)
diff --git a/board/sbc8641d/sbc8641d.c b/board/sbc8641d/sbc8641d.c
index fc1f07d..9f69638 100644
--- a/board/sbc8641d/sbc8641d.c
+++ b/board/sbc8641d/sbc8641d.c
@@ -414,7 +414,7 @@ void board_reset(void)
#endif
}
-#if (CONFIG_NUM_CPUS > 1)
+#ifdef CONFIG_MP
extern void cpu_mp_lmb_reserve(struct lmb *lmb);
void board_lmb_reserve(struct lmb *lmb)
diff --git a/cpu/mpc86xx/Makefile b/cpu/mpc86xx/Makefile
index 34a9755..f1af64e 100644
--- a/cpu/mpc86xx/Makefile
+++ b/cpu/mpc86xx/Makefile
@@ -31,10 +31,9 @@ LIB = $(obj)lib$(CPU).a
START = start.o
SOBJS = cache.o
-ifneq ($(CONFIG_NUM_CPUS),1)
-COBJS-y += mp.o
-SOBJS += release.o
-endif
+SOBJS-$(CONFIG_MP) += release.o
+SOBJS += $(SOBJS-y)
+COBJS-$(CONFIG_MP) += mp.o
COBJS-y += traps.o
COBJS-y += cpu.o
COBJS-y += cpu_init.o
diff --git a/cpu/mpc86xx/fdt.c b/cpu/mpc86xx/fdt.c
index 383b06b..ee2eb0b 100644
--- a/cpu/mpc86xx/fdt.c
+++ b/cpu/mpc86xx/fdt.c
@@ -15,9 +15,9 @@ DECLARE_GLOBAL_DATA_PTR;
void ft_cpu_setup(void *blob, bd_t *bd)
{
-#if (CONFIG_NUM_CPUS > 1)
+#ifdef CONFIG_MP
int off;
- u32 bootpg;
+ u32 bootpg = determine_mp_bootpg();
#endif
do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
@@ -48,13 +48,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
"clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
#endif
-#if (CONFIG_NUM_CPUS > 1)
- /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
- if (gd->ram_size > 0xfffff000)
- bootpg = 0xfff00000;
- else
- bootpg = gd->ram_size - (1024 * 1024);
-
+#ifdef CONFIG_MP
/* Reserve the boot page so OSes dont use it */
off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
if (off < 0)
diff --git a/cpu/mpc86xx/mp.c b/cpu/mpc86xx/mp.c
index 5014401..e17f5e1 100644
--- a/cpu/mpc86xx/mp.c
+++ b/cpu/mpc86xx/mp.c
@@ -8,16 +8,42 @@
DECLARE_GLOBAL_DATA_PTR;
-#if (CONFIG_NUM_CPUS > 1)
-void cpu_mp_lmb_reserve(struct lmb *lmb)
+int cpu_reset(int nr)
+{
+ volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+ volatile ccsr_pic_t *pic = &immr->im_pic;
+ out_be32(&pic->pir, 1 << nr);
+ (void)in_be32(&pic->pir);
+ out_be32(&pic->pir, 0x0);
+
+ return 0;
+}
+
+int cpu_status(int nr)
+{
+ /* dummy function so common/cmd_mp.c will build */
+ return 0;
+}
+
+int cpu_release(int nr, int argc, char *argv[])
{
- u32 bootpg;
+ /* dummy function so common/cmd_mp.c will build
+ * should be implemented in the future */
+ return 1;
+}
+u32 determine_mp_bootpg(void)
+{
/* if we have 4G or more of memory, put the boot page at 4Gb-1M */
if ((u64)gd->ram_size > 0xfffff000)
- bootpg = 0xfff00000;
- else
- bootpg = gd->ram_size - (1024 * 1024);
+ return (0xfff00000);
+
+ return (gd->ram_size - (1024 * 1024));
+}
+
+void cpu_mp_lmb_reserve(struct lmb *lmb)
+{
+ u32 bootpg = determine_mp_bootpg();
/* tell u-boot we stole a page */
lmb_reserve(lmb, bootpg, 4096);
@@ -31,18 +57,9 @@ void setup_mp(void)
{
extern ulong __secondary_start_page;
ulong fixup = (ulong)&__secondary_start_page;
- u32 bootpg;
+ u32 bootpg = determine_mp_bootpg();
u32 bootpg_va;
- /*
- * If we have 4G or more of memory, put the boot page at 4Gb-1M.
- * Otherwise, put it at the very end of RAM.
- */
- if (gd->ram_size > 0xfffff000)
- bootpg = 0xfff00000;
- else
- bootpg = gd->ram_size - (1024 * 1024);
-
if (bootpg >= CONFIG_SYS_MAX_DDR_BAT_SIZE) {
/* We're not covered by the DDR mapping, set up BAT */
write_bat(DBAT7, CONFIG_SYS_SCRATCH_VA | BATU_BL_128K |
@@ -65,4 +82,3 @@ void setup_mp(void)
out_be32((uint *)(CONFIG_SYS_CCSRBAR + 0x20), 0x80000000 |
(bootpg >> 12));
}
-#endif
diff --git a/cpu/mpc86xx/mp.h b/cpu/mpc86xx/mp.h
index 886e0c8..5471ef7 100644
--- a/cpu/mpc86xx/mp.h
+++ b/cpu/mpc86xx/mp.h
@@ -3,5 +3,6 @@
void setup_mp(void);
void cpu_mp_lmb_reserve(struct lmb *lmb);
+u32 determine_mp_bootpg(void);
#endif
diff --git a/cpu/mpc86xx/release.S b/cpu/mpc86xx/release.S
index 95efbb4..67a6f2b 100644
--- a/cpu/mpc86xx/release.S
+++ b/cpu/mpc86xx/release.S
@@ -41,7 +41,6 @@
* Core 0 must copy this to a 1M aligned region and set BPTR
* to point to it.
*/
-#if (CONFIG_NUM_CPUS > 1)
.align 12
.globl __secondary_start_page
__secondary_start_page:
@@ -166,4 +165,3 @@ invl2:
blr
/* Never Returns, Running in Linux Now */
-#endif
diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h
index 9d66101..d8042fb 100644
--- a/include/configs/MPC8641HPCN.h
+++ b/include/configs/MPC8641HPCN.h
@@ -36,6 +36,7 @@
#define CONFIG_MPC86xx 1 /* MPC86xx */
#define CONFIG_MPC8641 1 /* MPC8641 specific */
#define CONFIG_MPC8641HPCN 1 /* MPC8641HPCN board specific */
+#define CONFIG_MP 1 /* support multiple processors */
#define CONFIG_NUM_CPUS 2 /* Number of CPUs in the system */
#define CONFIG_LINUX_RESET_VEC 0x100 /* Reset vector used by Linux */
/*#define CONFIG_PHYS_64BIT 1*/ /* Place devices in 36-bit space */
diff --git a/include/configs/sbc8641d.h b/include/configs/sbc8641d.h
index 1008812..ef0f627 100644
--- a/include/configs/sbc8641d.h
+++ b/include/configs/sbc8641d.h
@@ -40,6 +40,7 @@
#define CONFIG_MPC86xx 1 /* MPC86xx */
#define CONFIG_MPC8641 1 /* MPC8641 specific */
#define CONFIG_SBC8641D 1 /* SBC8641D board specific */
+#define CONFIG_MP 1 /* support multiple processors */
#define CONFIG_NUM_CPUS 2 /* Number of CPUs in the system */
#define CONFIG_LINUX_RESET_VEC 0x100 /* Reset vector used by Linux */
--
1.5.6.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper.
2009-04-01 16:06 [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support Kumar Gala
@ 2009-04-01 16:06 ` Kumar Gala
2009-04-01 16:06 ` [U-Boot] [PATCH 3/3] 85xx/86xx: Ensure MP boot page is not used Kumar Gala
2009-04-01 18:35 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Becky Bruce
2009-04-01 18:34 ` [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support Becky Bruce
` (2 subsequent siblings)
3 siblings, 2 replies; 9+ messages in thread
From: Kumar Gala @ 2009-04-01 16:06 UTC (permalink / raw)
To: u-boot
Match determine_mp_bootpg() that was added for 86xx. We need this to
address a bug introduced in v2009.03 with 86xx MP booting. We have to
make sure to reserve the region of memory used for the MP bootpg() so
other u-boot code doesn't use it.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
* fix up based on tweak to patch 1/3
cpu/mpc85xx/fdt.c | 9 ++-------
cpu/mpc85xx/mp.c | 25 +++++++++++--------------
cpu/mpc85xx/mp.h | 1 +
3 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/cpu/mpc85xx/fdt.c b/cpu/mpc85xx/fdt.c
index 2d36c24..26a8f48 100644
--- a/cpu/mpc85xx/fdt.c
+++ b/cpu/mpc85xx/fdt.c
@@ -39,13 +39,8 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
{
int off;
ulong spin_tbl_addr = get_spin_addr();
- u32 bootpg, id = get_my_id();
-
- /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
- if ((u64)gd->ram_size > 0xfffff000)
- bootpg = 0xfffff000;
- else
- bootpg = gd->ram_size - 4096;
+ u32 bootpg = determine_mp_bootpg();
+ u32 id = get_my_id();
off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
while (off != -FDT_ERR_NOTFOUND) {
diff --git a/cpu/mpc85xx/mp.c b/cpu/mpc85xx/mp.c
index 3338c1a..8ddd81d 100644
--- a/cpu/mpc85xx/mp.c
+++ b/cpu/mpc85xx/mp.c
@@ -112,6 +112,15 @@ int cpu_release(int nr, int argc, char *argv[])
return 0;
}
+u32 determine_mp_bootpg(void)
+{
+ /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
+ if ((u64)gd->ram_size > 0xfffff000)
+ return (0xfffff000);
+
+ return (gd->ram_size - 4096);
+}
+
ulong get_spin_addr(void)
{
extern ulong __secondary_start_page;
@@ -188,13 +197,7 @@ static void pq3_mp_up(unsigned long bootpg)
void cpu_mp_lmb_reserve(struct lmb *lmb)
{
- u32 bootpg;
-
- /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
- if ((u64)gd->ram_size > 0xfffff000)
- bootpg = 0xfffff000;
- else
- bootpg = gd->ram_size - 4096;
+ u32 bootpg = determine_mp_bootpg();
lmb_reserve(lmb, bootpg, 4096);
}
@@ -203,13 +206,7 @@ void setup_mp(void)
{
extern ulong __secondary_start_page;
ulong fixup = (ulong)&__secondary_start_page;
- u32 bootpg;
-
- /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
- if ((u64)gd->ram_size > 0xfffff000)
- bootpg = 0xfffff000;
- else
- bootpg = gd->ram_size - 4096;
+ u32 bootpg = determine_mp_bootpg();
memcpy((void *)bootpg, (void *)fixup, 4096);
flush_cache(bootpg, 4096);
diff --git a/cpu/mpc85xx/mp.h b/cpu/mpc85xx/mp.h
index 4329286..71423ef 100644
--- a/cpu/mpc85xx/mp.h
+++ b/cpu/mpc85xx/mp.h
@@ -5,6 +5,7 @@ ulong get_spin_addr(void);
void setup_mp(void);
u32 get_my_id(void);
void cpu_mp_lmb_reserve(struct lmb *lmb);
+u32 determine_mp_bootpg(void);
#define BOOT_ENTRY_ADDR_UPPER 0
#define BOOT_ENTRY_ADDR_LOWER 1
--
1.5.6.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 3/3] 85xx/86xx: Ensure MP boot page is not used
2009-04-01 16:06 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Kumar Gala
@ 2009-04-01 16:06 ` Kumar Gala
2009-04-01 19:00 ` Wolfgang Denk
2009-04-01 18:35 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Becky Bruce
1 sibling, 1 reply; 9+ messages in thread
From: Kumar Gala @ 2009-04-01 16:06 UTC (permalink / raw)
To: u-boot
We had a bug on 86xx in which the boot page used to bring up secondary
cores was being overwritten and used for the malloc region in u-boot.
We need to reserve the region of memory that the boot page is going to
be put at so nothing uses it.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
* No real change, just here for completeness
lib_ppc/board.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 3b93e4e..6eeca02 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -79,6 +79,10 @@
#include <asm/mmu.h>
#endif
+#ifdef CONFIG_MP
+extern u32 determine_mp_bootpg(void);
+#endif
+
#ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
extern int update_flash_size (int flash_size);
#endif
@@ -444,6 +448,15 @@ void board_init_f (ulong bootflag)
addr = CONFIG_SYS_SDRAM_BASE + get_effective_memsize();
+#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
+ /* We need to make sure the location we intend to put secondary core
+ * boot code is reserved and not used by any part of u-boot */
+ if (addr > determine_mp_bootpg()) {
+ addr = determine_mp_bootpg();
+ debug ("Reserving MP boot page to %08lx\n", addr);
+ }
+#endif
+
#ifdef CONFIG_LOGBUFFER
#ifndef CONFIG_ALT_LB_ADDR
/* reserve kernel log buffer */
--
1.5.6.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support
2009-04-01 16:06 [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support Kumar Gala
2009-04-01 16:06 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Kumar Gala
@ 2009-04-01 18:34 ` Becky Bruce
2009-04-01 19:00 ` Wolfgang Denk
2009-04-01 20:11 ` Kim Phillips
3 siblings, 0 replies; 9+ messages in thread
From: Becky Bruce @ 2009-04-01 18:34 UTC (permalink / raw)
To: u-boot
On Apr 1, 2009, at 11:06 AM, Kumar Gala wrote:
> * Use CONFIG_MP instead of CONFIG_NUM_CPUS to match 85xx
> * Introduce determine_mp_bootpg() helper. We'll need this to
> address a
> bug introduced in v2009.03 with 86xx MP booting. We have to make
> sure
> to reserve the region of memory used for the MP bootpg() so other
> u-boot code doesn't use it.
> * Added dummy versions of cpu_status() & cpu_release() to allow
> cmd_mp.c
> to build and work. In the future we should look at implementing
> cpu_release(). This could be common w/85xx if we use spin tables on
> 86xx.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
> * removed change to 85xx code
> * added comments about cpu_status() & cpu_release()
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
>
>
> board/freescale/mpc8641hpcn/mpc8641hpcn.c | 2 +-
> board/sbc8641d/sbc8641d.c | 2 +-
> cpu/mpc86xx/Makefile | 7 ++--
> cpu/mpc86xx/fdt.c | 12 ++-----
> cpu/mpc86xx/mp.c | 50 ++++++++++++++++++
> +----------
> cpu/mpc86xx/mp.h | 1 +
> cpu/mpc86xx/release.S | 2 -
> include/configs/MPC8641HPCN.h | 1 +
> include/configs/sbc8641d.h | 1 +
> 9 files changed, 44 insertions(+), 34 deletions(-)
>
> diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/
> freescale/mpc8641hpcn/mpc8641hpcn.c
> index 1e35dfa..ef0095a 100644
> --- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
> +++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
> @@ -375,7 +375,7 @@ void board_reset(void)
> ;
> }
>
> -#if (CONFIG_NUM_CPUS > 1)
> +#ifdef CONFIG_MP
> extern void cpu_mp_lmb_reserve(struct lmb *lmb);
>
> void board_lmb_reserve(struct lmb *lmb)
> diff --git a/board/sbc8641d/sbc8641d.c b/board/sbc8641d/sbc8641d.c
> index fc1f07d..9f69638 100644
> --- a/board/sbc8641d/sbc8641d.c
> +++ b/board/sbc8641d/sbc8641d.c
> @@ -414,7 +414,7 @@ void board_reset(void)
> #endif
> }
>
> -#if (CONFIG_NUM_CPUS > 1)
> +#ifdef CONFIG_MP
> extern void cpu_mp_lmb_reserve(struct lmb *lmb);
>
> void board_lmb_reserve(struct lmb *lmb)
> diff --git a/cpu/mpc86xx/Makefile b/cpu/mpc86xx/Makefile
> index 34a9755..f1af64e 100644
> --- a/cpu/mpc86xx/Makefile
> +++ b/cpu/mpc86xx/Makefile
> @@ -31,10 +31,9 @@ LIB = $(obj)lib$(CPU).a
> START = start.o
> SOBJS = cache.o
>
> -ifneq ($(CONFIG_NUM_CPUS),1)
> -COBJS-y += mp.o
> -SOBJS += release.o
> -endif
> +SOBJS-$(CONFIG_MP) += release.o
> +SOBJS += $(SOBJS-y)
> +COBJS-$(CONFIG_MP) += mp.o
> COBJS-y += traps.o
> COBJS-y += cpu.o
> COBJS-y += cpu_init.o
> diff --git a/cpu/mpc86xx/fdt.c b/cpu/mpc86xx/fdt.c
> index 383b06b..ee2eb0b 100644
> --- a/cpu/mpc86xx/fdt.c
> +++ b/cpu/mpc86xx/fdt.c
> @@ -15,9 +15,9 @@ DECLARE_GLOBAL_DATA_PTR;
>
> void ft_cpu_setup(void *blob, bd_t *bd)
> {
> -#if (CONFIG_NUM_CPUS > 1)
> +#ifdef CONFIG_MP
> int off;
> - u32 bootpg;
> + u32 bootpg = determine_mp_bootpg();
> #endif
>
> do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
> @@ -48,13 +48,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
> "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
> #endif
>
> -#if (CONFIG_NUM_CPUS > 1)
> - /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
> - if (gd->ram_size > 0xfffff000)
> - bootpg = 0xfff00000;
> - else
> - bootpg = gd->ram_size - (1024 * 1024);
> -
> +#ifdef CONFIG_MP
> /* Reserve the boot page so OSes dont use it */
> off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
> if (off < 0)
> diff --git a/cpu/mpc86xx/mp.c b/cpu/mpc86xx/mp.c
> index 5014401..e17f5e1 100644
> --- a/cpu/mpc86xx/mp.c
> +++ b/cpu/mpc86xx/mp.c
> @@ -8,16 +8,42 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> -#if (CONFIG_NUM_CPUS > 1)
> -void cpu_mp_lmb_reserve(struct lmb *lmb)
> +int cpu_reset(int nr)
> +{
> + volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
> + volatile ccsr_pic_t *pic = &immr->im_pic;
> + out_be32(&pic->pir, 1 << nr);
> + (void)in_be32(&pic->pir);
> + out_be32(&pic->pir, 0x0);
> +
> + return 0;
> +}
> +
> +int cpu_status(int nr)
> +{
> + /* dummy function so common/cmd_mp.c will build */
> + return 0;
> +}
> +
> +int cpu_release(int nr, int argc, char *argv[])
> {
> - u32 bootpg;
> + /* dummy function so common/cmd_mp.c will build
> + * should be implemented in the future */
> + return 1;
> +}
>
> +u32 determine_mp_bootpg(void)
> +{
> /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
> if ((u64)gd->ram_size > 0xfffff000)
> - bootpg = 0xfff00000;
> - else
> - bootpg = gd->ram_size - (1024 * 1024);
> + return (0xfff00000);
> +
> + return (gd->ram_size - (1024 * 1024));
> +}
> +
> +void cpu_mp_lmb_reserve(struct lmb *lmb)
> +{
> + u32 bootpg = determine_mp_bootpg();
>
> /* tell u-boot we stole a page */
> lmb_reserve(lmb, bootpg, 4096);
> @@ -31,18 +57,9 @@ void setup_mp(void)
> {
> extern ulong __secondary_start_page;
> ulong fixup = (ulong)&__secondary_start_page;
> - u32 bootpg;
> + u32 bootpg = determine_mp_bootpg();
> u32 bootpg_va;
>
> - /*
> - * If we have 4G or more of memory, put the boot page at 4Gb-1M.
> - * Otherwise, put it at the very end of RAM.
> - */
> - if (gd->ram_size > 0xfffff000)
> - bootpg = 0xfff00000;
> - else
> - bootpg = gd->ram_size - (1024 * 1024);
> -
> if (bootpg >= CONFIG_SYS_MAX_DDR_BAT_SIZE) {
> /* We're not covered by the DDR mapping, set up BAT */
> write_bat(DBAT7, CONFIG_SYS_SCRATCH_VA | BATU_BL_128K |
> @@ -65,4 +82,3 @@ void setup_mp(void)
> out_be32((uint *)(CONFIG_SYS_CCSRBAR + 0x20), 0x80000000 |
> (bootpg >> 12));
> }
> -#endif
> diff --git a/cpu/mpc86xx/mp.h b/cpu/mpc86xx/mp.h
> index 886e0c8..5471ef7 100644
> --- a/cpu/mpc86xx/mp.h
> +++ b/cpu/mpc86xx/mp.h
> @@ -3,5 +3,6 @@
>
> void setup_mp(void);
> void cpu_mp_lmb_reserve(struct lmb *lmb);
> +u32 determine_mp_bootpg(void);
>
> #endif
> diff --git a/cpu/mpc86xx/release.S b/cpu/mpc86xx/release.S
> index 95efbb4..67a6f2b 100644
> --- a/cpu/mpc86xx/release.S
> +++ b/cpu/mpc86xx/release.S
> @@ -41,7 +41,6 @@
> * Core 0 must copy this to a 1M aligned region and set BPTR
> * to point to it.
> */
> -#if (CONFIG_NUM_CPUS > 1)
> .align 12
> .globl __secondary_start_page
> __secondary_start_page:
> @@ -166,4 +165,3 @@ invl2:
> blr
>
> /* Never Returns, Running in Linux Now */
> -#endif
> diff --git a/include/configs/MPC8641HPCN.h b/include/configs/
> MPC8641HPCN.h
> index 9d66101..d8042fb 100644
> --- a/include/configs/MPC8641HPCN.h
> +++ b/include/configs/MPC8641HPCN.h
> @@ -36,6 +36,7 @@
> #define CONFIG_MPC86xx 1 /* MPC86xx */
> #define CONFIG_MPC8641 1 /* MPC8641 specific */
> #define CONFIG_MPC8641HPCN 1 /* MPC8641HPCN board specific */
> +#define CONFIG_MP 1 /* support multiple processors */
> #define CONFIG_NUM_CPUS 2 /* Number of CPUs in the system */
> #define CONFIG_LINUX_RESET_VEC 0x100 /* Reset vector used by Linux */
> /*#define CONFIG_PHYS_64BIT 1*/ /* Place devices in 36-bit space */
> diff --git a/include/configs/sbc8641d.h b/include/configs/sbc8641d.h
> index 1008812..ef0f627 100644
> --- a/include/configs/sbc8641d.h
> +++ b/include/configs/sbc8641d.h
> @@ -40,6 +40,7 @@
> #define CONFIG_MPC86xx 1 /* MPC86xx */
> #define CONFIG_MPC8641 1 /* MPC8641 specific */
> #define CONFIG_SBC8641D 1 /* SBC8641D board specific */
> +#define CONFIG_MP 1 /* support multiple processors */
> #define CONFIG_NUM_CPUS 2 /* Number of CPUs in the
> system */
> #define CONFIG_LINUX_RESET_VEC 0x100 /* Reset vector used by
> Linux */
>
> --
> 1.5.6.6
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper.
2009-04-01 16:06 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Kumar Gala
2009-04-01 16:06 ` [U-Boot] [PATCH 3/3] 85xx/86xx: Ensure MP boot page is not used Kumar Gala
@ 2009-04-01 18:35 ` Becky Bruce
1 sibling, 0 replies; 9+ messages in thread
From: Becky Bruce @ 2009-04-01 18:35 UTC (permalink / raw)
To: u-boot
On Apr 1, 2009, at 11:06 AM, Kumar Gala wrote:
> Match determine_mp_bootpg() that was added for 86xx. We need this to
> address a bug introduced in v2009.03 with 86xx MP booting. We have to
> make sure to reserve the region of memory used for the MP bootpg() so
> other u-boot code doesn't use it.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
>
> ---
> * fix up based on tweak to patch 1/3
>
> cpu/mpc85xx/fdt.c | 9 ++-------
> cpu/mpc85xx/mp.c | 25 +++++++++++--------------
> cpu/mpc85xx/mp.h | 1 +
> 3 files changed, 14 insertions(+), 21 deletions(-)
>
> diff --git a/cpu/mpc85xx/fdt.c b/cpu/mpc85xx/fdt.c
> index 2d36c24..26a8f48 100644
> --- a/cpu/mpc85xx/fdt.c
> +++ b/cpu/mpc85xx/fdt.c
> @@ -39,13 +39,8 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
> {
> int off;
> ulong spin_tbl_addr = get_spin_addr();
> - u32 bootpg, id = get_my_id();
> -
> - /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
> - if ((u64)gd->ram_size > 0xfffff000)
> - bootpg = 0xfffff000;
> - else
> - bootpg = gd->ram_size - 4096;
> + u32 bootpg = determine_mp_bootpg();
> + u32 id = get_my_id();
>
> off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu",
> 4);
> while (off != -FDT_ERR_NOTFOUND) {
> diff --git a/cpu/mpc85xx/mp.c b/cpu/mpc85xx/mp.c
> index 3338c1a..8ddd81d 100644
> --- a/cpu/mpc85xx/mp.c
> +++ b/cpu/mpc85xx/mp.c
> @@ -112,6 +112,15 @@ int cpu_release(int nr, int argc, char *argv[])
> return 0;
> }
>
> +u32 determine_mp_bootpg(void)
> +{
> + /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
> + if ((u64)gd->ram_size > 0xfffff000)
> + return (0xfffff000);
> +
> + return (gd->ram_size - 4096);
> +}
> +
> ulong get_spin_addr(void)
> {
> extern ulong __secondary_start_page;
> @@ -188,13 +197,7 @@ static void pq3_mp_up(unsigned long bootpg)
>
> void cpu_mp_lmb_reserve(struct lmb *lmb)
> {
> - u32 bootpg;
> -
> - /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
> - if ((u64)gd->ram_size > 0xfffff000)
> - bootpg = 0xfffff000;
> - else
> - bootpg = gd->ram_size - 4096;
> + u32 bootpg = determine_mp_bootpg();
>
> lmb_reserve(lmb, bootpg, 4096);
> }
> @@ -203,13 +206,7 @@ void setup_mp(void)
> {
> extern ulong __secondary_start_page;
> ulong fixup = (ulong)&__secondary_start_page;
> - u32 bootpg;
> -
> - /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
> - if ((u64)gd->ram_size > 0xfffff000)
> - bootpg = 0xfffff000;
> - else
> - bootpg = gd->ram_size - 4096;
> + u32 bootpg = determine_mp_bootpg();
>
> memcpy((void *)bootpg, (void *)fixup, 4096);
> flush_cache(bootpg, 4096);
> diff --git a/cpu/mpc85xx/mp.h b/cpu/mpc85xx/mp.h
> index 4329286..71423ef 100644
> --- a/cpu/mpc85xx/mp.h
> +++ b/cpu/mpc85xx/mp.h
> @@ -5,6 +5,7 @@ ulong get_spin_addr(void);
> void setup_mp(void);
> u32 get_my_id(void);
> void cpu_mp_lmb_reserve(struct lmb *lmb);
> +u32 determine_mp_bootpg(void);
>
> #define BOOT_ENTRY_ADDR_UPPER 0
> #define BOOT_ENTRY_ADDR_LOWER 1
> --
> 1.5.6.6
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support
2009-04-01 16:06 [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support Kumar Gala
2009-04-01 16:06 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Kumar Gala
2009-04-01 18:34 ` [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support Becky Bruce
@ 2009-04-01 19:00 ` Wolfgang Denk
2009-04-01 20:11 ` Kim Phillips
3 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2009-04-01 19:00 UTC (permalink / raw)
To: u-boot
Dear Kumar Gala,
In message <1238601989-6251-1-git-send-email-galak@kernel.crashing.org> you wrote:
> * Use CONFIG_MP instead of CONFIG_NUM_CPUS to match 85xx
> * Introduce determine_mp_bootpg() helper. We'll need this to address a
> bug introduced in v2009.03 with 86xx MP booting. We have to make sure
> to reserve the region of memory used for the MP bootpg() so other
> u-boot code doesn't use it.
> * Added dummy versions of cpu_status() & cpu_release() to allow cmd_mp.c
> to build and work. In the future we should look at implementing
> cpu_release(). This could be common w/85xx if we use spin tables on
> 86xx.
...
> diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
> index 1e35dfa..ef0095a 100644
> --- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
> +++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
> @@ -375,7 +375,7 @@ void board_reset(void)
> ;
> }
>
> -#if (CONFIG_NUM_CPUS > 1)
> +#ifdef CONFIG_MP
> extern void cpu_mp_lmb_reserve(struct lmb *lmb);
We should have a prototype somewhere, and get rid of this extern.
...
> diff --git a/cpu/mpc86xx/Makefile b/cpu/mpc86xx/Makefile
> index 34a9755..f1af64e 100644
> --- a/cpu/mpc86xx/Makefile
> +++ b/cpu/mpc86xx/Makefile
> @@ -31,10 +31,9 @@ LIB = $(obj)lib$(CPU).a
> START = start.o
> SOBJS = cache.o
>
> -ifneq ($(CONFIG_NUM_CPUS),1)
> -COBJS-y += mp.o
> -SOBJS += release.o
> -endif
> +SOBJS-$(CONFIG_MP) += release.o
> +SOBJS += $(SOBJS-y)
> +COBJS-$(CONFIG_MP) += mp.o
> COBJS-y += traps.o
> COBJS-y += cpu.o
> COBJS-y += cpu_init.o
Please keep list sorted.
...
> diff --git a/cpu/mpc86xx/mp.c b/cpu/mpc86xx/mp.c
> index 5014401..e17f5e1 100644
> --- a/cpu/mpc86xx/mp.c
> +++ b/cpu/mpc86xx/mp.c
> @@ -8,16 +8,42 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> -#if (CONFIG_NUM_CPUS > 1)
> -void cpu_mp_lmb_reserve(struct lmb *lmb)
> +int cpu_reset(int nr)
> +{
> + volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
> + volatile ccsr_pic_t *pic = &immr->im_pic;
> + out_be32(&pic->pir, 1 << nr);
> + (void)in_be32(&pic->pir);
> + out_be32(&pic->pir, 0x0);
Please add some comment to explain what you are doing here, and why.
Best regards,
Wolfgang Denk
--
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
An age is called Dark not because the light fails to shine, but
because people refuse to see it. -- James Michener, "Space"
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 3/3] 85xx/86xx: Ensure MP boot page is not used
2009-04-01 16:06 ` [U-Boot] [PATCH 3/3] 85xx/86xx: Ensure MP boot page is not used Kumar Gala
@ 2009-04-01 19:00 ` Wolfgang Denk
0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2009-04-01 19:00 UTC (permalink / raw)
To: u-boot
Dear Kumar Gala,
In message <1238601989-6251-3-git-send-email-galak@kernel.crashing.org> you wrote:
> We had a bug on 86xx in which the boot page used to bring up secondary
> cores was being overwritten and used for the malloc region in u-boot.
>
> We need to reserve the region of memory that the boot page is going to
> be put at so nothing uses it.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
> * No real change, just here for completeness
...
> +#ifdef CONFIG_MP
> +extern u32 determine_mp_bootpg(void);
> +#endif
Please provide a prototype in some appropriate header file so we can
get rid of this "extern".
> #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
> extern int update_flash_size (int flash_size);
> #endif
> @@ -444,6 +448,15 @@ void board_init_f (ulong bootflag)
>
> addr = CONFIG_SYS_SDRAM_BASE + get_effective_memsize();
>
> +#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
> + /* We need to make sure the location we intend to put secondary core
> + * boot code is reserved and not used by any part of u-boot */
Incorrect multiline comment.
Best regards,
Wolfgang Denk
--
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
If all you have is a hammer, everything looks like a nail.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support
2009-04-01 16:06 [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support Kumar Gala
` (2 preceding siblings ...)
2009-04-01 19:00 ` Wolfgang Denk
@ 2009-04-01 20:11 ` Kim Phillips
2009-04-01 20:15 ` Kumar Gala
3 siblings, 1 reply; 9+ messages in thread
From: Kim Phillips @ 2009-04-01 20:11 UTC (permalink / raw)
To: u-boot
On Wed, 1 Apr 2009 11:06:27 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:
> -#if (CONFIG_NUM_CPUS > 1)
> -void cpu_mp_lmb_reserve(struct lmb *lmb)
> +int cpu_reset(int nr)
> +{
> + volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
> + volatile ccsr_pic_t *pic = &immr->im_pic;
blank line here
> + out_be32(&pic->pir, 1 << nr);
> + (void)in_be32(&pic->pir);
> + out_be32(&pic->pir, 0x0);
can be two setbits32
> +u32 determine_mp_bootpg(void)
> +{
> /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
> if ((u64)gd->ram_size > 0xfffff000)
> - bootpg = 0xfff00000;
> - else
> - bootpg = gd->ram_size - (1024 * 1024);
> + return (0xfff00000);
> +
> + return (gd->ram_size - (1024 * 1024));
? this line not reached
Kim
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support
2009-04-01 20:11 ` Kim Phillips
@ 2009-04-01 20:15 ` Kumar Gala
0 siblings, 0 replies; 9+ messages in thread
From: Kumar Gala @ 2009-04-01 20:15 UTC (permalink / raw)
To: u-boot
On Apr 1, 2009, at 3:11 PM, Kim Phillips wrote:
> On Wed, 1 Apr 2009 11:06:27 -0500
> Kumar Gala <galak@kernel.crashing.org> wrote:
>
>> -#if (CONFIG_NUM_CPUS > 1)
>> -void cpu_mp_lmb_reserve(struct lmb *lmb)
>> +int cpu_reset(int nr)
>> +{
>> + volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
>> + volatile ccsr_pic_t *pic = &immr->im_pic;
>
> blank line here
>
>> + out_be32(&pic->pir, 1 << nr);
>> + (void)in_be32(&pic->pir);
>> + out_be32(&pic->pir, 0x0);
>
> can be two setbits32
this is now a noop.
>> +u32 determine_mp_bootpg(void)
>> +{
>> /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
>> if ((u64)gd->ram_size > 0xfffff000)
>> - bootpg = 0xfff00000;
>> - else
>> - bootpg = gd->ram_size - (1024 * 1024);
>> + return (0xfff00000);
>> +
>> + return (gd->ram_size - (1024 * 1024));
>
> ? this line not reached
the diff is funny here, look again its:
if (foo)
return A
return B;
- k
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-04-01 20:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-01 16:06 [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support Kumar Gala
2009-04-01 16:06 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Kumar Gala
2009-04-01 16:06 ` [U-Boot] [PATCH 3/3] 85xx/86xx: Ensure MP boot page is not used Kumar Gala
2009-04-01 19:00 ` Wolfgang Denk
2009-04-01 18:35 ` [U-Boot] [PATCH 2/3] 85xx: Introduce determine_mp_bootpg() helper Becky Bruce
2009-04-01 18:34 ` [U-Boot] [PATCH v2 1/3] 86xx: Cleanup MP support Becky Bruce
2009-04-01 19:00 ` Wolfgang Denk
2009-04-01 20:11 ` Kim Phillips
2009-04-01 20:15 ` Kumar Gala
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.