[U-Boot] [PATCH 0/5] PPC 85xx QEMU: Additional fixes

After the initial round of the e500 QEMU machine patches got merged I realized that we were missing 2 pieces of the puzzle to make everything great:
- KVM support - generic board file
With this patch set I can successfully run u-boot inside of KVM on an e500v2 as well as an e500mc machine. I also no longer get warnings that I should convert the board to the generic board mechanism.
Alex
Alexander Graf (5): PPC 85xx QEMU: Always assume 1 core PPC 85xx QEMU: Don't use HID1 powerpc/mpc85xx: Update TLB CAMs in relocated mode powerpc/mpc85xx: Pass 0 flags to board_init_f PPC 85xx QEMU: Make a generic board file
arch/powerpc/cpu/mpc85xx/cpu_init.c | 1 + arch/powerpc/cpu/mpc85xx/start.S | 3 ++- arch/powerpc/cpu/mpc8xxx/cpu.c | 4 ++-- board/freescale/qemu-ppce500/qemu-ppce500.c | 20 ++++++++++++++++++++ include/configs/qemu-ppce500.h | 1 + 5 files changed, 27 insertions(+), 4 deletions(-)

We only need u-boot to bother about a single core in the QEMU machine. Everything that would require additional knowledge of more cores gets handled by QEMU and passed straight into the payload we execute.
Because of this setup, it would be counterproductive to enable SMP support in u-boot. We would have to rip CPUs out of already existing spin tables and respin them from u-boot. It would be a pretty big mess.
So only assume we have a single core. This fixes errors about CONFIG_MP being disabled.
Signed-off-by: Alexander Graf agraf@suse.de --- arch/powerpc/cpu/mpc8xxx/cpu.c | 4 ++-- board/freescale/qemu-ppce500/qemu-ppce500.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/cpu/mpc8xxx/cpu.c b/arch/powerpc/cpu/mpc8xxx/cpu.c index 35795c4..b95bed7 100644 --- a/arch/powerpc/cpu/mpc8xxx/cpu.c +++ b/arch/powerpc/cpu/mpc8xxx/cpu.c @@ -176,7 +176,7 @@ struct cpu_type *identify_cpu(u32 ver) /* * Return a 32-bit mask indicating which cores are present on this SOC. */ -u32 cpu_mask(void) +__weak u32 cpu_mask(void) { ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR; struct cpu_type *cpu = gd->arch.cpu; @@ -195,7 +195,7 @@ u32 cpu_mask(void) /* * Return the number of cores on this SOC. */ -int cpu_numcores(void) +__weak int cpu_numcores(void) { struct cpu_type *cpu = gd->arch.cpu;
diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c index 3dbb0cf..230870d 100644 --- a/board/freescale/qemu-ppce500/qemu-ppce500.c +++ b/board/freescale/qemu-ppce500/qemu-ppce500.c @@ -346,3 +346,23 @@ ulong get_bus_freq (ulong dummy) get_sys_info(&sys_info); return sys_info.freq_systembus; } + +/* + * Return the number of cores on this SOC. + */ +int cpu_numcores(void) +{ + /* + * The QEMU u-boot target only needs to drive the first core, + * spinning and device tree nodes get driven by QEMU itself + */ + return 1; +} + +/* + * Return a 32-bit mask indicating which cores are present on this SOC. + */ +u32 cpu_mask(void) +{ + return (1 << cpu_numcores()) - 1; +}

For the QEMU machine type, we can plug in either e500v2, e500mc, e5500 or e6500 style cores into the system. U-boot has to work with all of them.
So avoid using HID1 which is not available on e500mc systems to make sure we don't trap on it.
Signed-off-by: Alexander Graf agraf@suse.de --- arch/powerpc/cpu/mpc85xx/start.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S index 0e3c86a..0149146 100644 --- a/arch/powerpc/cpu/mpc85xx/start.S +++ b/arch/powerpc/cpu/mpc85xx/start.S @@ -314,7 +314,7 @@ l2_disabled: #endif mtspr HID0,r0
-#ifndef CONFIG_E500MC +#if !defined(CONFIG_E500MC) && !defined(CONFIG_QEMU_E500) li r0,(HID1_ASTME|HID1_ABE)@l /* Addr streaming & broadcast */ mfspr r3,PVR andi. r3,r3, 0xff

We want to use the TLB mapping helpers in relocated mode as well. These helpers need to have awareness of already occupied TLB entries. We already had them in sync in non-relocated mode, but need to resync them when we move into relocated.
Signed-off-by: Alexander Graf agraf@suse.de --- arch/powerpc/cpu/mpc85xx/cpu_init.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index 36ef232..71bcc45 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -888,6 +888,7 @@ skip_l2: } #endif
+ init_used_tlb_cams();
return 0; }

The new generic board_init_f has an argument now that takes a number of prepopulated gd->flags bits. We don't have any, so let's set this to 0.
Signed-off-by: Alexander Graf agraf@suse.de --- arch/powerpc/cpu/mpc85xx/start.S | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S index 0149146..86883f5 100644 --- a/arch/powerpc/cpu/mpc85xx/start.S +++ b/arch/powerpc/cpu/mpc85xx/start.S @@ -1159,6 +1159,7 @@ _start_cont: isync
bl cpu_init_f + li r3, 0 bl board_init_f isync

On 04/30/2014 10:21 AM, Alexander Graf wrote:
The new generic board_init_f has an argument now that takes a number of prepopulated gd->flags bits. We don't have any, so let's set this to 0.
Signed-off-by: Alexander Graf agraf@suse.de
arch/powerpc/cpu/mpc85xx/start.S | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S index 0149146..86883f5 100644 --- a/arch/powerpc/cpu/mpc85xx/start.S +++ b/arch/powerpc/cpu/mpc85xx/start.S @@ -1159,6 +1159,7 @@ _start_cont: isync
bl cpu_init_f
- li r3, 0 bl board_init_f isync
I have this patch pending already http://patchwork.ozlabs.org/patch/343618/. I can take either one when merging.
York

On 30.04.14 19:28, York Sun wrote:
On 04/30/2014 10:21 AM, Alexander Graf wrote:
The new generic board_init_f has an argument now that takes a number of prepopulated gd->flags bits. We don't have any, so let's set this to 0.
Signed-off-by: Alexander Graf agraf@suse.de
arch/powerpc/cpu/mpc85xx/start.S | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S index 0149146..86883f5 100644 --- a/arch/powerpc/cpu/mpc85xx/start.S +++ b/arch/powerpc/cpu/mpc85xx/start.S @@ -1159,6 +1159,7 @@ _start_cont: isync
bl cpu_init_f
- li r3, 0 bl board_init_f isync
I have this patch pending already http://patchwork.ozlabs.org/patch/343618/. I can take either one when merging.
Ah, sorry, missed that one. The patch is fairly trivial (though debugging it was not - NULL pointer exceptions in printf() are no fun, heh) and you were first, so please just take your patch.
Alex

On 04/30/2014 10:38 AM, Alexander Graf wrote:
On 30.04.14 19:28, York Sun wrote:
On 04/30/2014 10:21 AM, Alexander Graf wrote:
The new generic board_init_f has an argument now that takes a number of prepopulated gd->flags bits. We don't have any, so let's set this to 0.
Signed-off-by: Alexander Graf agraf@suse.de
arch/powerpc/cpu/mpc85xx/start.S | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S index 0149146..86883f5 100644 --- a/arch/powerpc/cpu/mpc85xx/start.S +++ b/arch/powerpc/cpu/mpc85xx/start.S @@ -1159,6 +1159,7 @@ _start_cont: isync
bl cpu_init_f
- li r3, 0 bl board_init_f isync
I have this patch pending already http://patchwork.ozlabs.org/patch/343618/. I can take either one when merging.
Ah, sorry, missed that one. The patch is fairly trivial (though debugging it was not - NULL pointer exceptions in printf() are no fun, heh) and you were first, so please just take your patch.
I should CC you to save you the time of debugging. It took me a while to find it.
York

This patch enables the E500 QEMU board to use the generic cross-arch board infrastructure.
Signed-off-by: Alexander Graf agraf@suse.de --- include/configs/qemu-ppce500.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/qemu-ppce500.h b/include/configs/qemu-ppce500.h index 10e014d..763a47a 100644 --- a/include/configs/qemu-ppce500.h +++ b/include/configs/qemu-ppce500.h @@ -19,6 +19,7 @@
#undef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE 0xf01000 /* 15 MB */ +#define CONFIG_SYS_GENERIC_BOARD
#define CONFIG_SYS_MPC85XX_NO_RESETVEC

On 04/30/2014 12:21 PM, Alexander Graf wrote:
After the initial round of the e500 QEMU machine patches got merged I realized that we were missing 2 pieces of the puzzle to make everything great:
- KVM support
- generic board file
With this patch set I can successfully run u-boot inside of KVM on an e500v2 as well as an e500mc machine. I also no longer get warnings that I should convert the board to the generic board mechanism.
Alex
Alexander Graf (5): PPC 85xx QEMU: Always assume 1 core PPC 85xx QEMU: Don't use HID1 powerpc/mpc85xx: Update TLB CAMs in relocated mode PPC 85xx QEMU: Make a generic board file
Applied to u-boot-mpc85xx/master.
Thanks,
York
participants (2)
-
Alexander Graf
-
York Sun