phb4: Add link training trace mode

Add a mode to PHB4 to trace training process closely. This activates
as soon as PERST is deasserted and produces human readable output of
the process.

This may increase training times since it duplicates some of the
training code.  This code has it's own simple checks for fence and
timeout but will fall through to the default training code once done.

Output produced, looks like the "TRACE:" lines below:

  [    3.410799664,7] PHB#0001[0:1]: FRESET: Starts
  [    3.410802000,7] PHB#0001[0:1]: FRESET: Prepare for link down
  [    3.410806624,7] PHB#0001[0:1]: FRESET: Assert skipped
  [    3.410808848,7] PHB#0001[0:1]: FRESET: Deassert
  [    3.410812176,3] PHB#0001[0:1]: TRACE: 0x0000000101000000  0ms
  [    3.417170176,3] PHB#0001[0:1]: TRACE: 0x0000100101000000 12ms presence
  [    3.436289104,3] PHB#0001[0:1]: TRACE: 0x0000180101000000 49ms training
  [    3.436373312,3] PHB#0001[0:1]: TRACE: 0x00001d0811000000 49ms trained
  [    3.436420752,3] PHB#0001[0:1]: TRACE: Link trained.
  [    3.436967856,7] PHB#0001[0:1]: LINK: Start polling
  [    3.437482240,7] PHB#0001[0:1]: LINK: Electrical link detected
  [    3.437996864,7] PHB#0001[0:1]: LINK: Link is up
  [    4.438000048,7] PHB#0001[0:1]: LINK: Link is stable

Enabled via nvram using:
  nvram -p ibm,skiboot --update-config pci-tracing=true

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2 files changed
tree: e3bad6c50ff72ed7e0c3f8fd0bc6794b83c0c07a
  1. asm/
  2. ccan/
  3. core/
  4. doc/
  5. external/
  6. hdata/
  7. hw/
  8. include/
  9. libc/
  10. libfdt/
  11. libflash/
  12. libpore/
  13. libstb/
  14. libxz/
  15. opal-ci/
  16. platforms/
  17. test/
  18. .gitignore
  19. .travis.yml
  20. CONTRIBUTING.md
  21. coverity-model.c
  22. extract-gcov.c
  23. LICENCE
  24. make_offsets.sh
  25. make_version.sh
  26. Makefile
  27. Makefile.main
  28. Makefile.rules
  29. README.md
  30. skiboot.lds.S
  31. skiboot.spec
README.md

skiboot

Firmware for OpenPower systems.

Source: https://github.com/open-power/skiboot

Mailing list: skiboot@lists.ozlabs.org

Info/subscribe: https://lists.ozlabs.org/listinfo/skiboot

Archives: https://lists.ozlabs.org/pipermail/skiboot/

Patchwork: http://patchwork.ozlabs.org/project/skiboot/list/

Overview

OPAL firmware (OpenPower Abstraction Layer) comes in several parts.

A simplified flow of what happens when the power button is pressed is:

  1. The baseboard management controller (BMC) powers the system on.
  2. The BMC selects the master chip and releases the self-boot engines (SBEs) on the POWER8 chips, master last.
  3. The BMC relinquishes control of the flexible service interface (FSI) SCAN/SCOM engines.
  4. The hostboot firmware IPLs the system. It initiates a secondary power-on sequence through a digital power systems sweep (DPSS).
  5. The hostboot firmware loads the OPAL image and moves all processors to their execution starting points.

Here, the OPAL image is three parts:

  1. skiboot (includes OPAL runtime services)
  2. skiroot - the bootloader environment
    • kernel
    • initramfs (containing petitboot bootloader)

They may be all part of one payload or three separate images (depending on platform).

The bootloader will kexec a host kernel (probably linux). The host OS can make OPAL calls. The OPAL API is documented in doc/opal-api/ (there are missing parts, patches are welcome!)

See doc/overview.txt for a more in depth overview of skiboot.

Building

Any host OS can build and test skiboot provided it has a C cross compiler for big endian powerpc64. All good Linux distributions (and several bad ones) provide a packaged compiler that can be installed through the usual package management tools.

To build on Ubuntu:

apt-get install gcc-powerpc64le-linux-gnu gcc valgrind \
	expect libssl-dev device-tree-compiler
CROSS=powerpc64-linux-gnu- make -j`nproc`

To build on Fedora:

dnf install gcc-powerpc64-linux-gnu binutils-powerpc64-linux-gnu gcc make \
    diffutils findutils expect valgrind-devel dtc openssl-devel
CROSS=powerpc64-linux-gnu- make -j`nproc`

On any POWER system with a bi-endian system compiler:

CROSS="" make -j`nproc`

Alternatively, pre-built cross compilers for x86 systems can be downloaded from here: https://www.kernel.org/pub/tools/crosstool/ When using these compilers add /opt/cross/gcc-4.8.0-nolibc/powerpc64-linux/bin/ to your PATH. Once this is done skiboot can be compiler by just running make

Testing

Skiboot comes with a set of unit tests that can be run on your desktop. They can can be run with:

make check

To test in a simulator, install the IBM POWER8 Functional Simulator from: http://www-304.ibm.com/support/customercare/sas/f/pwrfs/home.html Also see external/mambo/README.md

Qemu (as of 2.2.0) is not suitable as it does not (yet) implement the HyperVisor mode of the POWER8 processor. See https://www.flamingspork.com/blog/2015/08/28/running-opal-in-qemu-the-powernv-platform/ for instructions on how to use a work-in-progress patchset to qemu that may be suitable for some work.

To run a boot-to-bootloader test, you'll need a zImage.papr built using the mambo_defconfig config for op-build. See https://github.com/open-power/op-build/ on howto build. Drop zImage.epapr in the skiboot directory and the skiboot test suite will automatically pick it up.

See opal-ci/README for further testing instructions.

To test on real hardware, you will need to understand how to flash new skiboot onto your system. This will vary from platform to platform.

You may want to start with external/boot-tests/boot_test.sh as it can (provided the correct usernames/passwords) automatically flash a new skiboot onto ASTBMC based OpenPower machines.

Hacking

All patches should be sent to the mailing list with linux-kernel style ‘Signed-Off-By’. The following git commands are your friends:

git commit -s
git format-patch

You probably want to read the linux https://kernel.org/doc/html/latest/process/submitting-patches.html as much of it applies to skiboot.

License

See LICENSE