Skip to content

RFC Move the address of FW_JUMP_FDT_ADDR forward

Andrew Jones opensbi 1 version New

Get series with b4
b4 am 20220811124919.jdlwdp5rigpbomm3@kamzik

Versions newest first

  1. v1 RFC Latest0 patches 0 repliesNew

Patches in v1 No applies recorded yet

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/0] Move the address of FW_JUMP_FDT_ADDR forward
Quoted 5 lines · Nylon Chen

From: "Nylon.Chen" <[email protected]>

A while ago.
when we boot from QEMU by OpenSBI Jump mode with initramfs kerenl.

Quoted 7 lines

The kernel encountered panic because the kernel's section was overwritten, and the address was FW_JUMP_FDT_ADDR.

we find out the the rule $(FW_TEXT_START) + 0x2200000 in platform/generic/config.mk

The situation is our kernel size big than it.

This implies opensbi is being used as a FW_PAYLOAD firmware.

Quoted 10 lines

e.g.

# readelf -h vmlinux 
init.bss's LMA is "0x00000000024a96a0", and when we use this rule, it
exceeds its size.

0x24a96a0 > 0x2200000

After our experiment, we can add offset FW_JUMP_FDT_ADDR, and the problem is solved.

Since this is a FW_PAYLOAD firmware you should be adjusting FW_PAYLOAD_FDT_ADDR. Adjusting FW_JUMP_FDT_ADDR only works because by default FW_PAYLOAD_FDT_ADDR = FW_JUMP_FDT_ADDR (for the generic platform).

Quoted 3 lines

But in my opinion, this is not a good method because the next time the kernel size increases, the same situation occurs again.

I haven't tried it, but I think it should be possible to embed the FDT into the kernel (CONFIG_BUILTIN_DTB) and then ensure FW_PAYLOAD_FDT_ADDR is *not* defined. Doing that will hopefully keep opensbi from overwriting the payload and linux will still find the DTB without looking at a1 for it. Taking that approach (if it works) would avoid having to adjust FW_PAYLOAD_FDT_ADDR for different payload sizes.

Quoted 3 lines

So maybe we can move the address forward and normalize the address to FW_JUMP_FDT_ADDR?

These types of defaults are impossible to get right for everybody. IMHO, what's there today should stay as is and we should work at making it as easy as possible to adjust at build- and/or run- time when necessary.

Thanks,
drew