Skip to contentSkip to conversation

ppc: e500: Bump ppce500 u-boot to v2021.04

PATCH In review Bin Meng 2 participants 7 messages Apr 6, 2021 – Apr 8, 2021

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

cover ppc: e500: Bump ppce500 u-boot to v2021.04

This series bumps the u-boot.e500 to v2021.04, which fixed a long overdue broken pci issue caused by QEMU changes since Nov 2014.

While we are here, add a reST documentation for the ppce500 machine.

Please pull the full contents (binary) from https://github.com/lbmeng/qemu/
ppc branch.

Bin Meng (3):
roms/Makefile: Update ppce500 u-boot build directory name roms/u-boot: Bump ppce500 u-boot to v2021.04 to fix broken pci support docs/system: ppc: Add documentation for ppce500 machine

 docs/system/ppc/ppce500.rst | 156 ++++++++++++++++++++++++++++++++++++
 docs/system/target-ppc.rst  |   1 +
 pc-bios/u-boot.e500         | Bin 349148 -> 406920 bytes
 roms/Makefile               |   8 +-
 roms/u-boot                 |   2 +-
 5 files changed, 162 insertions(+), 5 deletions(-)
 create mode 100644 docs/system/ppc/ppce500.rst
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/3 roms/Makefile: Update ppce500 u-boot build directory name

Currently building ppce500 u-boot image results in

modified: roms/u-boot (untracked content)

As roms/u-boot/.gitignore indicates, update the build directory name to build-e500 to eliminate this message.

---

 roms/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
roms/Makefile +4 -4
index 5ffe3317ac..eeb5970348 100644
@@ -154,10 +154,10 @@ slof:
 	cp SLOF/boot_rom.bin ../pc-bios/slof.bin
 
 u-boot.e500:
-	$(MAKE) -C u-boot O=build.e500 qemu-ppce500_config
+	$(MAKE) -C u-boot O=build-e500 qemu-ppce500_config
 	$(MAKE) -C u-boot CROSS_COMPILE=$(powerpc_cross_prefix) \
-		O=build.e500
-	$(powerpc_cross_prefix)strip u-boot/build.e500/u-boot -o \
+		O=build-e500
+	$(powerpc_cross_prefix)strip u-boot/build-e500/u-boot -o \
 		../pc-bios/u-boot.e500
 
 u-boot.sam460:
@@ -205,7 +205,7 @@ clean:
 	$(MAKE) -C ipxe/src veryclean
 	$(MAKE) -C edk2/BaseTools clean
 	$(MAKE) -C SLOF clean
-	rm -rf u-boot/build.e500
+	rm -rf u-boot/build-e500
 	$(MAKE) -C u-boot-sam460ex distclean
 	$(MAKE) -C skiboot clean
 	$(MAKE) -f Makefile.edk2 clean
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 2/3 roms/u-boot: Bump ppce500 u-boot to v2021.04 to fix broken pci support

In reply to Bin Meng

When QEMU originally supported the ppce500 machine back in Jan 2014, it was created with a 1:1 mapping of PCI bus address. Things seemed to change rapidly that in Nov 2014 with the following QEMU commits:

commit e6b4e5f4795b ("PPC: e500: Move CCSR and MMIO space to upper end of address space")

and

commit cb3778a0455a ("PPC: e500 pci host: Add support for ATMUs")

the PCI memory and IO physical address were moved to beyond 4 GiB, but PCI bus address remained below 4 GiB, hence a non-identity mapping was created. Unfortunately corresponding U-Boot updates were missed along with the QEMU changes and the U-Boot QEMU ppce500 PCI support has been broken since then, until this issue was fixed recently in U-Boot mainline v2021.04 release, specifically by the following U-Boot series:

http://patchwork.ozlabs.org/project/uboot/list/?series=230985&state=*

The cross-compilation toolchain used to build the U-Boot image is:
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/10.1.0/x86_64-gcc-10.1.0-nolibc-powerpc-linux.tar.xz

---

 pc-bios/u-boot.e500 | Bin 349148 -> 406920 bytes
 roms/u-boot         |   2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/u-boot.e500 binary +0 -0
index 732660f348..d2e29f81d6 100644
Binary files a/pc-bios/u-boot.e500 and b/pc-bios/u-boot.e500 differ
roms/u-boot +1 -1
index d3689267f9..b46dd116ce 160000
@@ -1 +1 @@
-Subproject commit d3689267f92c5956e09cc7d1baa4700141662bff
+Subproject commit b46dd116ce03e235f2a7d4843c6278e1da44b5e1
Signature · 1 line
2.25.1
author
#3 lore raw

PATCH 3/3 docs/system: ppc: Add documentation for ppce500 machine

In reply to Bin Meng

This adds detailed documentation for PowerPC ppce500 machine, including the following information:

- Supported devices
- Hardware configuration information
- Boot options
- Running Linux kernel
- Running U-Boot

---

 docs/system/ppc/ppce500.rst | 156 ++++++++++++++++++++++++++++++++++++
 docs/system/target-ppc.rst  |   1 +
 2 files changed, 157 insertions(+)
 create mode 100644 docs/system/ppc/ppce500.rst
docs/system/ppc/ppce500.rst new file +156 -0
new file mode 100644
index 0000000000..7a815c1881
@@ -0,0 +1,156 @@
+ppce500 generic platform (``ppce500``)
+======================================
+
+QEMU for PPC supports a special ``ppce500`` machine designed for emulation and
+virtualization purposes.
+
+Supported devices
+-----------------
+
+The ``ppce500`` machine supports the following devices:
+
+* PowerPC e500 series core (e500v2/e500mc/e5500/e6500)
+* Configuration, Control, and Status Register (CCSR)
+* Multicore Programmable Interrupt Controller (MPIC) with MSI support
+* 1 16550A UART device
+* 1 Freescale MPC8xxx I2C controller
+* 1 Pericom pt7c4338 RTC via I2C
+* 1 Freescale MPC8xxx GPIO controller
+* Power-off functionality via one GPIO pin
+* 1 Freescale MPC8xxx PCI host controller
+* VirtIO devices via PCI bus
+
+Hardware configuration information
+----------------------------------
+
+The ``ppce500`` machine automatically generates a device tree blob ("dtb")
+which it passes to the guest, if there is no ``-dtb`` option. This provides
+information about the addresses, interrupt lines and other configuration of
+the various devices in the system.
+
+If users want to provide their own DTB, they can use the ``-dtb`` option.
+These DTBs should have the following requirements:
+
+* The number of subnodes under /cpus node should match QEMU's ``-smp`` option
+* The /memory reg size should match QEMU’s selected ram_size via ``-m``
+
+Both ``qemu-system-ppc`` and ``qemu-system-ppc64`` provide emulation for the
+following 32-bit PowerPC CPUs:
+
+* e500v2
+* e500mc
+
+Additionally ``qemu-system-ppc64`` provides support for the following 64-bit
+PowerPC CPUs:
+
+* e5500
+* e6500
+
+The CPU type can be specified via the ``-cpu`` command line. If not specified,
+it creates a machine with e500v2 core. The following example shows an e6500
+based machine creation:
+
+.. code-block:: bash
+
+  $ qemu-system-ppc64 -nographic -M ppce500 -cpu e6500
+
+Boot options
+------------
+
+The ``ppce500`` machine can start using the standard -kernel functionality
+for loading a payload like an OS kernel (e.g.: Linux), or U-Boot firmware.
+
+When -bios is omitted, the default pc-bios/u-boot.e500 firmware image is used
+as the BIOS. QEMU follows below truth table to select which payload to execute:
+
+===== ========== =======
+-bios    -kernel payload
+===== ========== =======
+    N          N  u-boot
+    N          Y  kernel
+    Y don't care  u-boot
+===== ========== =======
+
+When both -bios and -kernel are present, QEMU loads U-Boot and U-Boot in turns
+automatically loads the kernel image specified by the -kernel parameter via
+U-Boot's built-in "bootm" command, hence a legacy uImage format is required in
+such senario.
+
+Running Linux kernel
+--------------------
+
+Linux mainline v5.11 release is tested at the time of writing. To build a
+Linux mainline kernel that can be booted by the ``ppce500`` machine in
+64-bit mode, simply configure the kernel using the defconfig configuration:
+
+.. code-block:: bash
+
+  $ export ARCH=powerpc
+  $ export CROSS_COMPILE=powerpc-linux-
+  $ make corenet64_smp_defconfig
+  $ make menuconfig
+
+then manually select the following configuration:
+
+  Platform support > Freescale Book-E Machine Type > QEMU generic e500 platform
+
+To boot the newly built Linux kernel in QEMU with the ``ppce500`` machine:
+
+.. code-block:: bash
+
+  $ qemu-system-ppc64 -M ppce500 -cpu e5500 -smp 4 -m 2G \
+      -display none -serial stdio \
+      -kernel vmlinux \
+      -initrd /path/to/rootfs.cpio \
+      -append "root=/dev/ram"
+
+To build a Linux mainline kernel that can be booted by the ``ppce500`` machine
+in 32-bit mode, use the same 64-bit configuration steps except the defconfig
+file should use corenet32_smp_defconfig.
+
+To boot the 32-bit Linux kernel:
+
+.. code-block:: bash
+
+  $ qemu-system-ppc{64|32} -M ppce500 -cpu e500mc -smp 4 -m 2G \
+      -display none -serial stdio \
+      -kernel vmlinux \
+      -initrd /path/to/rootfs.cpio \
+      -append "root=/dev/ram"
+
+Running U-Boot
+--------------
+
+U-Boot mainline v2021.04 release is tested at the time of writing. To build a
+U-Boot mainline bootloader that can be booted by the ``ppce500`` machine, use
+the qemu-ppce500_defconfig with similar commands as described above for Linux:
+
+.. code-block:: bash
+
+  $ export CROSS_COMPILE=powerpc-linux-
+  $ make qemu-ppce500_defconfig
+
+You will get u-boot file in the build tree.
+
+When U-Boot boots, you will notice the following if using with ``-cpu e6500``:
+
+.. code-block:: none
+
+  CPU:   Unknown, Version: 0.0, (0x00000000)
+  Core:  e6500, Version: 2.0, (0x80400020)
+
+This is because we only specified a core name to QEMU and it does not have a
+meaningful SVR value which represents an actual SoC that integrates such core.
+You can specify a real world SoC device that QEMU has built-in support but all
+these SoCs are e500v2 based MPC85xx series, hence you cannot test anything
+built for P4080 (e500mc), P5020 (e5500) and T2080 (e6500).
+
+By default a VirtIO standard PCI networking device is connected as an ethernet
+interface at PCI address 0.1.0, but we can switch that to an e1000 NIC by:
+
+.. code-block:: bash
+
+  $ qemu-system-ppc -M ppce500 -smp 4 -m 2G \
+                    -display none -serial stdio \
+                    -bios u-boot \
+                    -nic tap,ifname=tap0,script=no,downscript=no,model=e1000
docs/system/target-ppc.rst +1 -0
index 67905b8f2a..4f6eb93b17 100644
@@ -20,5 +20,6 @@ help``.
    ppc/embedded
    ppc/powermac
    ppc/powernv
+   ppc/ppce500
    ppc/prep
    ppc/pseries
Signature · 1 line
2.25.1
#4 lore raw
In reply to Bin Meng
Quoted 7 lines · Bin Meng

This series bumps the u-boot.e500 to v2021.04, which fixed a long overdue broken pci issue caused by QEMU changes since Nov 2014.

While we are here, add a reST documentation for the ppce500 machine.

Please pull the full contents (binary) from https://github.com/lbmeng/qemu/
ppc branch.

This is much to late to go into ppc-for-6.0, but I'm happy to queue it for 6.1. However, I'm not sure which branch from your site I need to pull in.

Quoted 15 lines

Bin Meng (3):
roms/Makefile: Update ppce500 u-boot build directory name roms/u-boot: Bump ppce500 u-boot to v2021.04 to fix broken pci support docs/system: ppc: Add documentation for ppce500 machine

 docs/system/ppc/ppce500.rst | 156 ++++++++++++++++++++++++++++++++++++
 docs/system/target-ppc.rst  |   1 +
 pc-bios/u-boot.e500         | Bin 349148 -> 406920 bytes
 roms/Makefile               |   8 +-
 roms/u-boot                 |   2 +-
 5 files changed, 162 insertions(+), 5 deletions(-)
 create mode 100644 docs/system/ppc/ppce500.rst
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
author
#5 lore raw

Hi David,

Quoted 5 lines · David Gibson
Quoted 3 lines · Bin Meng

This series bumps the u-boot.e500 to v2021.04, which fixed a long overdue broken pci issue caused by QEMU changes since Nov 2014.

Quoted 7 lines
Quoted 4 lines

While we are here, add a reST documentation for the ppce500 machine.

Please pull the full contents (binary) from https://github.com/lbmeng/qemu/
ppc branch.

This is much to late to go into ppc-for-6.0, but I'm happy to queue it for 6.1.

I think this should go 6.0 because it is a bug fix for the long overdue broken pci support in the U-Boot binary that QEMU ships.

Quoted 2 lines

However, I'm not sure which branch from your site I need to pull in.

It's the ppc branch, as I mentioned in this cover letter.

Quoted 7 lines
Quoted 7 lines

Bin Meng (3):
roms/Makefile: Update ppce500 u-boot build directory name roms/u-boot: Bump ppce500 u-boot to v2021.04 to fix broken pci support docs/system: ppc: Add documentation for ppce500 machine

Regards,
Bin

#6 lore raw
Quoted 11 lines · Bin Meng

Hi David,

Quoted 7 lines · David Gibson
Quoted 5 lines · Bin Meng

This series bumps the u-boot.e500 to v2021.04, which fixed a long overdue broken pci issue caused by QEMU changes since Nov 2014.

While we are here, add a reST documentation for the ppce500 machine.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Please pull the full contents (binary) from https://github.com/lbmeng/qemu/
ppc branch.

This is much to late to go into ppc-for-6.0, but I'm happy to queue it for 6.1.

I think this should go 6.0 because it is a bug fix for the long overdue broken pci support in the U-Boot binary that QEMU ships.

No. If we were early in the hard freeze, then maybe. But this certainly isn't a regression - it's been broken for 6+ years, which means we don't have a case to put it in rc3.

Quoted 5 lines
Quoted 3 lines

However, I'm not sure which branch from your site I need to pull in.

It's the ppc branch, as I mentioned in this cover letter.

Sorry, I missed that. I've now merged these patches into ppc-for-6.1.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson