I am struggling with booting a 2nd Linux Kernel using kexec on arm32 (stm32mp157f-dk2) with Arm Trusted Firmware enabled.
I have an initramfs with minimal utilities along with kexec, in that initramfs I first mount the real rootfs containing a 2nd kernel and respective dtb file.
Then I am trying to load the 2nd kernel via kexec using:
/sbin/kexec -i -l kernel0.img --dtb dtb0.img --reuse-cmdline
after that I am issuing the command to execute the new kernel with kexec -e
but I am getting below error:
/ # kexec -e
[ 17.473385] kexec_core: Starting new kernel
[ 17.550479] CPU1 killed.
[ 17.580569] Bye!
ERROR: Illegal access to 0xffff0000:
ERROR: FAIL_ID = 0x4c0
ERROR: Non-Secure
ERROR: Privilege
ERROR: Read
PANIC at PC : 0x2ffc9739
Exception mode=0x00000016 at: 0x2ffc9739
I tried looking at the stm memory firewall configuration in Arm Trusted Firmware dtb file and also referred the memory map in section Memory map and register boundary addresses in STM reference manual.
Added some prints in Arm Trusted Firmware to try to figure out what’s happening and found out that Linux Kernel is trying to read something from address 0xffff0000
which causes a fault and TZC catches it as FIQ.
The prints that I added displays information are show below, refer the error message TZC address: 0x5c006020
:
/ # /sbin/kexec -d -i -l /container/kernel0.img --dtb /container/dtb0.img --reus
e-cmdline
Try gzip decompression.
Try LZMA decompression.
kernel: 0xb6583008 kernel_size: 0x7ac572
MEMORY RANGES
00000000c0000000-00000000d3ffffff (0)
00000000d8000000-00000000dfffffff (0)
zImage header: 0xacc27a00 0x00000000 0x00000000
zImage requires 0x007bd572 bytes
Kernel: address=0xc0008000 size=0x026b2b3a
DT : address=0xc26bc000 size=0x0003b178
kexec_load: entry = 0xc0008000 flags = 0x280000
nr_segments = 2
segment[0].buf = 0xb6583008
segment[0].bufsz = 0x7ac576
segment[0].mem = 0xc0008000
segment[0].memsz = 0x7ad000
segment[1].buf = 0xb6547008
segment[1].bufsz = 0x3b178
segment[1].mem = 0xc26bc000
segment[1].memsz = 0x3c000
/ # kexec -e
[ 17.473385] kexec_core: Starting new kernel
[ 17.550479] CPU1 killed.
[ 17.580569] Bye!
ERROR: base: 0x5c006000 FAIL_ADDRESS_LOW_OFF: 0x20
ERROR: filter: 0x0 FILTER_OFFSET: 0x10
ERROR: TZC address: 0x5c006020
ERROR: Value at address: 0xffff0000
ERROR: Illegal access to 0xffff0000:
ERROR: FAIL_ID = 0x4c0
ERROR: Non-Secure
ERROR: Privilege
ERROR: Read
PANIC at PC : 0x2ffc9739
Exception mode=0x00000016 at: 0x2ffc9739