qemu-ppce500.rst 3.3 KB

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