Skip to contentSkip to conversation

PPC 85xx QEMU: Additional fixes

PATCH New Alexander Graf 2 participants 10 messages Apr 30, 2014 – May 13, 2014 PowerPC

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/5 PPC 85xx QEMU: Always assume 1 core

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.

---
 arch/powerpc/cpu/mpc8xxx/cpu.c              |    4 ++--
 board/freescale/qemu-ppce500/qemu-ppce500.c |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
arch/powerpc/cpu/mpc8xxx/cpu.c +2 -2
index 35795c4..b95bed7 100644
@@ -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;
 
board/freescale/qemu-ppce500/qemu-ppce500.c +20 -0
index 3dbb0cf..230870d 100644
@@ -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;
+}
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/5 PPC 85xx QEMU: Don't use HID1

In reply to Alexander Graf

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.

---
 arch/powerpc/cpu/mpc85xx/start.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/cpu/mpc85xx/start.S +1 -1
index 0e3c86a..0149146 100644
@@ -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
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/5 powerpc/mpc85xx: Update TLB CAMs in relocated mode

In reply to Alexander Graf

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.

---
 arch/powerpc/cpu/mpc85xx/cpu_init.c |    1 +
 1 file changed, 1 insertion(+)
arch/powerpc/cpu/mpc85xx/cpu_init.c +1 -0
index 36ef232..71bcc45 100644
@@ -888,6 +888,7 @@ skip_l2:
 	}
 #endif
 
+	init_used_tlb_cams();
 
 	return 0;
 }
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/5 powerpc/mpc85xx: Pass 0 flags to board_init_f

In reply to Alexander Graf

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.

---
 arch/powerpc/cpu/mpc85xx/start.S |    1 +
 1 file changed, 1 insertion(+)
arch/powerpc/cpu/mpc85xx/start.S +1 -0
index 0149146..86883f5 100644
@@ -1159,6 +1159,7 @@ _start_cont:
 	isync
 
 	bl	cpu_init_f
+	li	r3, 0
 	bl	board_init_f
 	isync
 
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 4/5 powerpc/mpc85xx: Pass 0 flags to board_init_f

Quoted 14 lines · Alexander Graf

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.

---
 arch/powerpc/cpu/mpc85xx/start.S |    1 +
 1 file changed, 1 insertion(+)
arch/powerpc/cpu/mpc85xx/start.S +0 -0
index 0149146..86883f5 100644

arch/powerpc/cpu/mpc85xx/start.S _start_cont: · line 1165

Quoted 7 lines
arch/powerpc/cpu/mpc85xx/start.S +1 -0
@@ -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

#6 lore raw

PATCH 4/5 powerpc/mpc85xx: Pass 0 flags to board_init_f

Quoted 16 lines · York Sun
Quoted 15 lines · Alexander Graf

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.

---
  arch/powerpc/cpu/mpc85xx/start.S |    1 +
  1 file changed, 1 insertion(+)
arch/powerpc/cpu/mpc85xx/start.S +0 -0
index 0149146..86883f5 100644
@@ -1159,6 +1159,7 @@ _start_cont:
  	isync
 
Quoted 8 lines

arch/powerpc/cpu/mpc85xx/start.S _start_cont: · line 1165

Quoted 6 lines
arch/powerpc/cpu/mpc85xx/start.S +1 -0
  	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

#7 lore raw

PATCH 4/5 powerpc/mpc85xx: Pass 0 flags to board_init_f

Quoted 27 lines · Alexander Graf
Quoted 16 lines · York Sun
Quoted 15 lines · Alexander Graf

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.

---
  arch/powerpc/cpu/mpc85xx/start.S |    1 +
  1 file changed, 1 insertion(+)
arch/powerpc/cpu/mpc85xx/start.S +0 -0
index 0149146..86883f5 100644
@@ -1159,6 +1159,7 @@ _start_cont:
  	isync
 
Quoted 8 lines

arch/powerpc/cpu/mpc85xx/start.S _start_cont: · line 1165

Quoted 6 lines
arch/powerpc/cpu/mpc85xx/start.S +1 -0
  	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.

Quoted 4 lines

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

#8 lore raw

PATCH 5/5 PPC 85xx QEMU: Make a generic board file

In reply to Alexander Graf

This patch enables the E500 QEMU board to use the generic cross-arch board infrastructure.

---
 include/configs/qemu-ppce500.h |    1 +
 1 file changed, 1 insertion(+)
include/configs/qemu-ppce500.h +1 -0
index 10e014d..763a47a 100644
@@ -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
 
Signature · 1 line
1.7.10.4
#9 lore raw

cover PPC 85xx QEMU: Additional fixes

In reply to Alexander Graf
Quoted 12 lines · Alexander Graf

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.

Quoted 7 lines

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