[0/2] ARM: decompressor: support AUTO_ZRELADDR and appended DTB

Message ID 20240119201356.7903-1-ansuelsmth@gmail.com
Headers
Series ARM: decompressor: support AUTO_ZRELADDR and appended DTB |

Message

Christian Marangi Jan. 19, 2024, 8:12 p.m. UTC
  This series try to address a long lasting problem with legacy device
that require an appended DTB and the use of AUTO_ZRELADDR.

With these device AUTO_ZRELADDR is not possible if for some reason at
the start of the RAM it's needed to reserve some space. (example qcom SoC
that allocate reserved space for SMEM)

In the current implementation with appended DTB and AUTO_ZRELADDR,
the memory start is only derived from the PC register and it can't be
changed by declaring additional info in the DTS.

In a normal setup, we have an intentional undocumented chosen property
to handle this and the memory node to declare the start of the memory.

With this applied and ARM_ATAG_DTB_COMPAT_IGNORE_MEM enabled (more 
info in the related patch) ipq806x can boot right away with AUTO_ZRELADDR
enabled and a correct memory node defined in DTS.

It's needed to ignore MEM ATAGs as most of the time the values from the
bootloader are hardcoded and OEM didn't care to actually provide them
resulting in funny situation where a Netgear R7800 with 512Mb of RAM
have Uboot passing 1.7GB of RAM with ATAGS.

I'm open to any suggestion on how this can be improved and I would love
some additional testing on other legacy platform but I assume this will
permit many legacy device to be correctly supported without having to
hardcode address.

Christian Marangi (2):
  ARM: decompressor: support memory start validation for appended DTB
  ARM: decompressor: add option to ignore MEM ATAGs

 arch/arm/Kconfig                        | 12 ++++++++++++
 arch/arm/boot/compressed/atags_to_fdt.c | 10 ++++++++++
 arch/arm/boot/compressed/head.S         | 22 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)
  

Comments

Geert Uytterhoeven Jan. 20, 2024, 11:19 a.m. UTC | #1
Hi Christian,

On Fri, Jan 19, 2024 at 9:14 PM Christian Marangi <ansuelsmth@gmailcom> wrote:
> With this applied and ARM_ATAG_DTB_COMPAT_IGNORE_MEM enabled (more
> info in the related patch) ipq806x can boot right away with AUTO_ZRELADDR
> enabled and a correct memory node defined in DTS.
>
> It's needed to ignore MEM ATAGs as most of the time the values from the
> bootloader are hardcoded and OEM didn't care to actually provide them
> resulting in funny situation where a Netgear R7800 with 512Mb of RAM
> have Uboot passing 1.7GB of RAM with ATAGS.

I guess you still need other values from ATAGS, so building a kernel
without CONFIG_ARM_ATAG_DTB_COMPAT is not an option?

Gr{oetje,eeting}s,

                        Geert
  
Christian Marangi Jan. 20, 2024, 5:10 p.m. UTC | #2
On Sat, Jan 20, 2024 at 12:19:33PM +0100, Geert Uytterhoeven wrote:
> Hi Christian,
> 
> On Fri, Jan 19, 2024 at 9:14 PM Christian Marangi <ansuelsmth@gmail.com> wrote:
> > With this applied and ARM_ATAG_DTB_COMPAT_IGNORE_MEM enabled (more
> > info in the related patch) ipq806x can boot right away with AUTO_ZRELADDR
> > enabled and a correct memory node defined in DTS.
> >
> > It's needed to ignore MEM ATAGs as most of the time the values from the
> > bootloader are hardcoded and OEM didn't care to actually provide them
> > resulting in funny situation where a Netgear R7800 with 512Mb of RAM
> > have Uboot passing 1.7GB of RAM with ATAGS.
> 
> I guess you still need other values from ATAGS, so building a kernel
> without CONFIG_ARM_ATAG_DTB_COMPAT is not an option?
>

As I said in the other patch, yes DTB_COMPAT is still needed for
bootargs passed from the bootloader via ATAGs. Sorry for not making this
detail more clear in the cover letter.