|
| 1 | +ppce500 generic platform (``ppce500``) |
| 2 | +====================================== |
| 3 | + |
| 4 | +QEMU for PPC supports a special ``ppce500`` machine designed for emulation and |
| 5 | +virtualization purposes. |
| 6 | + |
| 7 | +Supported devices |
| 8 | +----------------- |
| 9 | + |
| 10 | +The ``ppce500`` machine supports the following devices: |
| 11 | + |
| 12 | +* PowerPC e500 series core (e500v2/e500mc/e5500/e6500) |
| 13 | +* Configuration, Control, and Status Register (CCSR) |
| 14 | +* Multicore Programmable Interrupt Controller (MPIC) with MSI support |
| 15 | +* 1 16550A UART device |
| 16 | +* 1 Freescale MPC8xxx I2C controller |
| 17 | +* 1 Pericom pt7c4338 RTC via I2C |
| 18 | +* 1 Freescale MPC8xxx GPIO controller |
| 19 | +* Power-off functionality via one GPIO pin |
| 20 | +* 1 Freescale MPC8xxx PCI host controller |
| 21 | +* VirtIO devices via PCI bus |
| 22 | + |
| 23 | +Hardware configuration information |
| 24 | +---------------------------------- |
| 25 | + |
| 26 | +The ``ppce500`` machine automatically generates a device tree blob ("dtb") |
| 27 | +which it passes to the guest, if there is no ``-dtb`` option. This provides |
| 28 | +information about the addresses, interrupt lines and other configuration of |
| 29 | +the various devices in the system. |
| 30 | + |
| 31 | +If users want to provide their own DTB, they can use the ``-dtb`` option. |
| 32 | +These DTBs should have the following requirements: |
| 33 | + |
| 34 | +* The number of subnodes under /cpus node should match QEMU's ``-smp`` option |
| 35 | +* The /memory reg size should match QEMU’s selected ram_size via ``-m`` |
| 36 | + |
| 37 | +Both ``qemu-system-ppc`` and ``qemu-system-ppc64`` provide emulation for the |
| 38 | +following 32-bit PowerPC CPUs: |
| 39 | + |
| 40 | +* e500v2 |
| 41 | +* e500mc |
| 42 | + |
| 43 | +Additionally ``qemu-system-ppc64`` provides support for the following 64-bit |
| 44 | +PowerPC CPUs: |
| 45 | + |
| 46 | +* e5500 |
| 47 | +* e6500 |
| 48 | + |
| 49 | +The CPU type can be specified via the ``-cpu`` command line. If not specified, |
| 50 | +it creates a machine with e500v2 core. The following example shows an e6500 |
| 51 | +based machine creation: |
| 52 | + |
| 53 | +.. code-block:: bash |
| 54 | +
|
| 55 | + $ qemu-system-ppc64 -nographic -M ppce500 -cpu e6500 |
| 56 | +
|
| 57 | +Boot options |
| 58 | +------------ |
| 59 | + |
| 60 | +The ``ppce500`` machine can start using the standard -kernel functionality |
| 61 | +for loading a payload like an OS kernel (e.g.: Linux), or U-Boot firmware. |
| 62 | + |
| 63 | +When -bios is omitted, the default pc-bios/u-boot.e500 firmware image is used |
| 64 | +as the BIOS. QEMU follows below truth table to select which payload to execute: |
| 65 | + |
| 66 | +===== ========== ======= |
| 67 | +-bios -kernel payload |
| 68 | +===== ========== ======= |
| 69 | + N N u-boot |
| 70 | + N Y kernel |
| 71 | + Y don't care u-boot |
| 72 | +===== ========== ======= |
| 73 | + |
| 74 | +When both -bios and -kernel are present, QEMU loads U-Boot and U-Boot in turns |
| 75 | +automatically loads the kernel image specified by the -kernel parameter via |
| 76 | +U-Boot's built-in "bootm" command, hence a legacy uImage format is required in |
| 77 | +such senario. |
| 78 | + |
| 79 | +Running Linux kernel |
| 80 | +-------------------- |
| 81 | + |
| 82 | +Linux mainline v5.11 release is tested at the time of writing. To build a |
| 83 | +Linux mainline kernel that can be booted by the ``ppce500`` machine in |
| 84 | +64-bit mode, simply configure the kernel using the defconfig configuration: |
| 85 | + |
| 86 | +.. code-block:: bash |
| 87 | +
|
| 88 | + $ export ARCH=powerpc |
| 89 | + $ export CROSS_COMPILE=powerpc-linux- |
| 90 | + $ make corenet64_smp_defconfig |
| 91 | + $ make menuconfig |
| 92 | +
|
| 93 | +then manually select the following configuration: |
| 94 | + |
| 95 | + Platform support > Freescale Book-E Machine Type > QEMU generic e500 platform |
| 96 | + |
| 97 | +To boot the newly built Linux kernel in QEMU with the ``ppce500`` machine: |
| 98 | + |
| 99 | +.. code-block:: bash |
| 100 | +
|
| 101 | + $ qemu-system-ppc64 -M ppce500 -cpu e5500 -smp 4 -m 2G \ |
| 102 | + -display none -serial stdio \ |
| 103 | + -kernel vmlinux \ |
| 104 | + -initrd /path/to/rootfs.cpio \ |
| 105 | + -append "root=/dev/ram" |
| 106 | +
|
| 107 | +To build a Linux mainline kernel that can be booted by the ``ppce500`` machine |
| 108 | +in 32-bit mode, use the same 64-bit configuration steps except the defconfig |
| 109 | +file should use corenet32_smp_defconfig. |
| 110 | + |
| 111 | +To boot the 32-bit Linux kernel: |
| 112 | + |
| 113 | +.. code-block:: bash |
| 114 | +
|
| 115 | + $ qemu-system-ppc{64|32} -M ppce500 -cpu e500mc -smp 4 -m 2G \ |
| 116 | + -display none -serial stdio \ |
| 117 | + -kernel vmlinux \ |
| 118 | + -initrd /path/to/rootfs.cpio \ |
| 119 | + -append "root=/dev/ram" |
| 120 | +
|
| 121 | +Running U-Boot |
| 122 | +-------------- |
| 123 | + |
| 124 | +U-Boot mainline v2021.04 release is tested at the time of writing. To build a |
| 125 | +U-Boot mainline bootloader that can be booted by the ``ppce500`` machine, use |
| 126 | +the qemu-ppce500_defconfig with similar commands as described above for Linux: |
| 127 | + |
| 128 | +.. code-block:: bash |
| 129 | +
|
| 130 | + $ export CROSS_COMPILE=powerpc-linux- |
| 131 | + $ make qemu-ppce500_defconfig |
| 132 | +
|
| 133 | +You will get u-boot file in the build tree. |
| 134 | + |
| 135 | +When U-Boot boots, you will notice the following if using with ``-cpu e6500``: |
| 136 | + |
| 137 | +.. code-block:: none |
| 138 | +
|
| 139 | + CPU: Unknown, Version: 0.0, (0x00000000) |
| 140 | + Core: e6500, Version: 2.0, (0x80400020) |
| 141 | +
|
| 142 | +This is because we only specified a core name to QEMU and it does not have a |
| 143 | +meaningful SVR value which represents an actual SoC that integrates such core. |
| 144 | +You can specify a real world SoC device that QEMU has built-in support but all |
| 145 | +these SoCs are e500v2 based MPC85xx series, hence you cannot test anything |
| 146 | +built for P4080 (e500mc), P5020 (e5500) and T2080 (e6500). |
| 147 | + |
| 148 | +By default a VirtIO standard PCI networking device is connected as an ethernet |
| 149 | +interface at PCI address 0.1.0, but we can switch that to an e1000 NIC by: |
| 150 | + |
| 151 | +.. code-block:: bash |
| 152 | +
|
| 153 | + $ qemu-system-ppc -M ppce500 -smp 4 -m 2G \ |
| 154 | + -display none -serial stdio \ |
| 155 | + -bios u-boot \ |
| 156 | + -nic tap,ifname=tap0,script=no,downscript=no,model=e1000 |
0 commit comments