blob: 82b50a01de7ed48fac401327b9a4eb2fbe613047 [file] [log] [blame]
Bin Mengb75ca062021-02-25 17:22:59 +08001.. SPDX-License-Identifier: GPL-2.0+
2.. Copyright (C) 2021, Bin Meng <bmeng.cn@gmail.com>
3
4QEMU PPC E500
5=============
6
7QEMU for PPC supports a special 'ppce500' machine designed for emulation and
8virtualization purposes. This document describes how to run U-Boot under it.
9
Pali Rohára17be962022-12-20 21:06:26 +010010The QEMU ppce500 machine models a generic PowerPC e500 virtual machine with
Bin Mengb75ca062021-02-25 17:22:59 +080011support for the VirtIO standard networking device connected to the built-in
12PCI host controller. Some common devices in the CCSBAR space are modeled,
13including MPIC, 16550A UART devices, GPIO, I2C and PCI host controller with
14MSI delivery to MPIC. It uses device-tree to pass configuration information
15to guest software.
16
17Building U-Boot
18---------------
19Set the CROSS_COMPILE environment variable as usual, and run::
20
21 $ make qemu-ppce500_defconfig
22 $ make
23
24Running U-Boot
25--------------
26The minimal QEMU command line to get U-Boot up and running is::
27
28 $ qemu-system-ppc -nographic -machine ppce500 -bios u-boot
29
30You can also run U-Boot using 'qemu-system-ppc64'::
31
32 $ qemu-system-ppc64 -nographic -machine ppce500 -bios u-boot
33
34The commands above create a target with 128 MiB memory by default. A freely
35configurable amount of RAM can be created via the '-m' parameter. For example,
36'-m 2G' creates 2 GiB memory for the target, and the memory node in the
37embedded DTB created by QEMU reflects the new setting.
38
39Both qemu-system-ppc and qemu-system-ppc64 provide emulation for the following
4032-bit PowerPC CPUs:
41
Pali Rohára17be962022-12-20 21:06:26 +010042* e500v1
Bin Mengb75ca062021-02-25 17:22:59 +080043* e500v2
44* e500mc
45
46Additionally qemu-system-ppc64 provides support for the following 64-bit CPUs:
47
48* e5500
49* e6500
50
51The CPU type can be specified via the '-cpu' command line. If not specified,
52it creates a machine with e500v2 core. The following example shows an e6500
53based machine creation::
54
55 $ qemu-system-ppc64 -nographic -machine ppce500 -cpu e6500 -bios u-boot
56
57When U-Boot boots, you will notice the following::
58
59 CPU: Unknown, Version: 0.0, (0x00000000)
60 Core: e6500, Version: 2.0, (0x80400020)
61
62This is because we only specified a core name to QEMU and it does not have a
63meaningful SVR value which represents an actual SoC that integrates such core.
64You can specify a real world SoC device that QEMU has built-in support but all
Pali Rohára17be962022-12-20 21:06:26 +010065these SoCs are e500v1/e500v2 based MPC85xx series, hence you cannot test anything
66built for P10xx/P2010/P2020 (e500v2), P204x/P304x/P40xx (e500mc), P50xx/T10xx (e5500)
67and T208x/T4080/T4160/T4240 (e6500).
Bin Mengb75ca062021-02-25 17:22:59 +080068
69By default a VirtIO standard PCI networking device is connected as an ethernet
70interface at PCI address 0.1.0, but we can switch that to an e1000 NIC by::
71
72 $ qemu-system-ppc -nographic -machine ppce500 -bios u-boot \
73 -nic tap,ifname=tap0,script=no,downscript=no,model=e1000
74
Bin Meng5b5dd692021-03-14 20:15:06 +080075The QEMU ppce500 machine can also dynamically instantiate an eTSEC device if
76"-device eTSEC" is given to QEMU::
77
78 -netdev tap,ifname=tap0,script=no,downscript=no,id=net0 -device eTSEC,netdev=net0
79
Bin Mengb75ca062021-02-25 17:22:59 +080080VirtIO BLK driver is also enabled to support booting from a disk image where
81a kernel image is stored. Append the following to QEMU::
82
83 -drive file=disk.img,format=raw,id=disk0 -device virtio-blk-pci,drive=disk0
84
85Pericom pt7c4338 RTC is supported so we can use the 'date' command::
86
87 => date
88 Date: 2021-02-18 (Thursday) Time: 15:33:20
89
90Additionally, 'poweroff' command is supported to shut down the QEMU session::
91
92 => poweroff
93 poweroff ...
94
95These have been tested in QEMU 5.2.0.