commit | 20e245a061ddbe1cfbf22f0b3eed07c4e5d1cd5b | [log] [tgz] |
---|---|---|
author | Ryan Grimm <grimm@linux.ibm.com> | Mon Jul 18 11:46:20 2022 -0400 |
committer | Reza Arbab <arbab@linux.ibm.com> | Wed Aug 03 12:02:01 2022 -0500 |
tree | 31fc7e832ffe0cd9306292e8daa73d53ff416354 | |
parent | 4d27f0375de64645194a5ca6a5b85cef42524d0e [diff] |
mambo: Fix backtrace when trace mixes endian code In the case of LE kernel and BE skiboot, the bt functions triggers an illegal address when the kernel has a stack pointer in skiboot. For example, in copy_and_flush: pc: 0x000000000000C25C +0x000000000000C25C lr: 0x000000000000C240 +0x000000000000C240 stack:0x0000000031C13D20 0x8428023000000000 +0x8428023000000000 Illegal Address 0x001EC13100000007 The bad address is from mem_display_64 and is fixed up by inverting the LE bit: systemsim % mem_display_64 [ expr 0x0000000031C13D20 ] 1 0x103EC13100000000 systemsim % mem_display_64 [ expr 0x0000000031C13D20 ] 0 0x0000000031C13E10 This patch tests the pointer by catching the illegal access and inverting the LE bit. Now the stack trace looks good: pc: 0x000000000000C254 +0x000000000000C254 lr: 0x000000000000C240 +0x000000000000C240 stack:0x0000000031C13D20 0x0000000030022884 .load_and_boot_kernel+0xc6c stack:0x0000000031C13E10 0x0000000030023344 .main_cpu_entry+0x8bc Opal calls also look good too now: pc: 0x0000000030028588 .cpu_idle_delay+0xb8 lr: 0x000000003002856C .cpu_idle_delay+0x9c stack:0x0000000031C13A10 0x0000000030028514 .cpu_idle_delay+0x44 stack:0x0000000031C13AB0 0x000000003002D6C0 .time_wait_nopoll+0x34 stack:0x0000000031C13B20 0x000000003002D77C .time_wait+0xa8 stack:0x0000000031C13BA0 0x000000003002821C .cpu_wait_job+0x3c stack:0x0000000031C13C40 0x0000000030029554 .opal_reinit_cpus+0x3c0 stack:0x0000000031C13D10 0x00000000300038AC opal_entry+0x14c stack:0x000000000071FDA0 0xC0000000000537B0 opal_call+0x40 stack:0x000000000071FE60 0xC00000000005450C opal_reinit_cpus+0x20 stack:0x000000000071FED0 0xC00000000065FDAC opal_configure_cores+0x48 stack:0x000000000071FF00 0xC000000000656554 early_setup+0x134 Signed-off-by: Ryan Grimm <grimm@linux.ibm.com> Reviewed-by: Dan HorĂ¡k <dan@danny.cz> Acked-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
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/
Documentation: http://open-power.github.io/skiboot/doc/index.html
OPAL firmware (OpenPower Abstraction Layer) comes in several parts.
A simplified flow of what happens when the power button is pressed is:
Here, the OPAL image is three parts:
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.rst for a more in depth overview of skiboot.
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 make \ xz-utils libmbedtls-dev CROSS=powerpc64le-linux-gnu- make -j`nproc`
To build on Fedora:
dnf install gcc-powerpc64le-linux-gnu binutils-powerpc64-linux-gnu gcc make \ diffutils findutils expect valgrind-devel dtc openssl-devel xz \ mbedtls-devel CROSS=powerpc64le-linux-gnu- make -j`nproc`
(The little-endian powerpc64le compilers in Ubuntu and Fedora are actually bi-endian and can compile skiboot even though it's big-endian. We recommend installing a little-endian toolchain if you plan on building other projects.)
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
We use Sphinx to produce various documentation from reStructuredText (preferred) and Markdown. The Sphinx documentation has a useful primer for reStructuredText here. And the docutils website has a nice quick reference for the basic constructes.
Building on Fedora
dnf install python3-sphinx python3-recommonmark.noarch pip install -r doc/requirements.txt make -C doc/ html SPHINXBUILD=sphinx-build-3
On Ubuntu:
Patches welcome!
View the output using doc/_build/html/index.html
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 version 2.8 implements the ‘powernv’ machine model and is sufficient to run skiboot:
qemu-system-ppc64 -M powernv -m 3G -nographic -L /path/to/skiboot/
To run a boot-to-bootloader test you need a Linux kernel image ‘zImage.epapr’. Build one using the opal_defconfig
config for op-build. See https://github.com/open-power/op-build/ on how to build, or download one from https://github.com/open-power/op-build/releases/ .
Drop zImage.epapr in the skiboot directory and the skiboot test suite will automatically pick it up. You can also run a combined skiboot and Linux test in Qemu (version 3.0+):
qemu-system-ppc64 -M powernv -m 3G -nographic -kernel zImage.epapr -L /path/to/skiboot/
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.
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.
The Skiboot build process produces a bunch of different outputs. This is what they are, and where you should use them:
skiboot.elf: The output of the linker. Don't flash to a system, but useful when debugging
skiboot.lid: The raw binary object, named .lid because IBM. Flash this on really old P8 systems, the POWER Functional Simulator (mambo), or FSP systems
skiboot.lid.stb: Lid wrapped with secure boot header. Use on FSP systems
skiboot.lid.xz: Compressed raw binary. Use this on a OpenPower P8
skiboot.lid.xz.stb: Compressed raw binary wrapped with a secure boot header. Use this on OpenPower P9 systems
See LICENSE