From: Tom Rini <trini@konsulko.com>
To: Walter Lozano <walter.lozano@collabora.com>
Cc: Peter Robinson <pbrobinson@gmail.com>,
u-boot@lists.denx.de, Martyn Welch <martyn@collabora.com>,
Matthias Brugger <mbrugger@suse.com>,
Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH] board: rpi: Update memory layout for Aarch64
Date: Thu, 18 Jul 2024 07:52:19 -0600 [thread overview]
Message-ID: <20240718135219.GV561963@bill-the-cat> (raw)
In-Reply-To: <1f85166d-5ec9-48bb-b4d9-6a76158e0d4e@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 5009 bytes --]
On Wed, Jul 17, 2024 at 03:32:00PM -0300, Walter Lozano wrote:
>
>
> On 7/17/24 12:44, Tom Rini wrote:
> > On Wed, Jul 17, 2024 at 11:59:50AM +0100, Peter Robinson wrote:
> > > On Tue, 16 Jul 2024 at 18:21, Tom Rini <trini@konsulko.com> wrote:
> > > >
> > > > On Tue, Jul 16, 2024 at 02:16:02PM -0300, Walter Lozano wrote:
> > > >
> > > > > ARM and Aarch64 have different restrictions and trying to accommodate
> > > > > larger kernels like the ones used in distros can be challenging. For this
> > > > > reason, separate the layout and rearrange the map for Aarch64 to support
> > > > > kernels larger than 36 MB.
> > > > >
> > > > > Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> > > > > ---
> > > > >
> > > > > board/raspberrypi/rpi/rpi.env | 25 ++++++++++++++++++-------
> > > > > 1 file changed, 18 insertions(+), 7 deletions(-)
> > > > >
> > > > > diff --git a/board/raspberrypi/rpi/rpi.env b/board/raspberrypi/rpi/rpi.env
> > > > > index 30228285edd..37c7f6a920e 100644
> > > > > --- a/board/raspberrypi/rpi/rpi.env
> > > > > +++ b/board/raspberrypi/rpi/rpi.env
> > > > > @@ -42,13 +42,19 @@ dfu_alt_info+=zImage fat 0 1
> > > > > * For Aarch64, the kernel image is uncompressed and must be loaded at
> > > > > * text_offset bytes (specified in the header of the Image) into a 2MB
> > > > > * boundary. The 'booti' command relocates the image if necessary. Linux uses
> > > > > - * a default text_offset of 0x80000. In summary, loading at 0x80000
> > > > > - * satisfies all these constraints and reserving memory up to 0x02400000
> > > > > - * permits fairly large (roughly 36M) kernels.
> > > > > + * a default text_offset of 0x80000. However, loading it at 0x80000
> > > > > + * will allow to reserve only up to 0x02400000 which permits medium size
> > > > > + * kernels (roughly 36M). This is good enough for customized kernels but
> > > > > + * not for distros which by default enable drivers for many different
> > > > > + * boards. Under these circumstances, using 0x00200000 provides room for
> > > > > + * larger kernels.
> > > > > *
> > > > > * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't
> > > > > * conflict with something else. Reserving 1M for each of them at
> > > > > - * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty.
> > > > > + * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty for ARM.
> > > > > + *
> > > > > + * For Aarch64, since the kernel is placed in different location,
> > > > > + * accommodate them to reserver 1M for each of them.
> > > > > *
> > > > > * On ARM, both the DTB and any possible initrd must be loaded such that they
> > > > > * fit inside the lowmem mapping in Linux. In practice, this usually means not
> > > > > @@ -62,16 +68,21 @@ dfu_alt_info+=zImage fat 0 1
> > > > > * large initrds before they start colliding with U-Boot.
> > > > > */
> > > > > #ifdef CONFIG_ARM64
> > > > > +pxefile_addr_r=0x00080000
> > > > > +scriptaddr=0x00100000
> > > > > +kernel_addr_r=0x00200000
> > > > > +fdt_addr_r=0x03400000
> > > > > +ramdisk_addr_r=0x03500000
> > > > > fdt_high=ffffffffffffffff
> > > > > initrd_high=ffffffffffffffff
> > > > > #else
> > > > > -fdt_high=ffffffff
> > > > > -initrd_high=ffffffff
> > > > > -#endif
> > > > > kernel_addr_r=0x00080000
> > > > > scriptaddr=0x02400000
> > > > > pxefile_addr_r=0x02500000
> > > > > fdt_addr_r=0x02600000
> > > > > ramdisk_addr_r=0x02700000
> > > > > +fdt_high=ffffffff
> > > > > +initrd_high=ffffffff
> > > > > +#endif
> > > > >
> > > > > boot_targets=mmc usb pxe dhcp
> > > >
> > > > We need to drop the disabling of device tree / initrd relocation as
> > > > that's sure not going to help matters. What's the minimum amount of
> > > > memory an aarch64 Pi will have? I really prefer reserving 128MiB (even
> > > > if that's not the maximum Linux Kernel Image size anymore) and then
> > > > device tree and then initrd.
> > >
> > > 512Mb on the Zero2W and RPi3A.
> > >
> > > We've not seen an issue here on the very large Fedora kernel, but I
> > > suspect that's because using UEFI mitigates this somewhat because here
> > > we're actually loading shim/grub.
> >
> > OK, that should be enough to put a 128MiB spot for kernel, then 512KiB
> > for device tree, and then rest for initrd, and not be disabling
> > relocation (and thus preventing U-Boot from fixing failures).
> >
>
> Thanks for the feedback! If I understood it correctly a layout like the
> the one bellow would be the right thing. The only difference is in
> device tree for which is reserved a bit more.
>
> pxefile_addr_r=0x00080000
> scriptaddr=0x00100000
> kernel_addr_r=0x00200000
> fdt_addr_r=0x09800000
> ramdisk_addr_r=0x09900000
>
> If this matches the expectations I will prepare the V2.
Looks right to me, Peter or Matthias ? Thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
prev parent reply other threads:[~2024-07-18 13:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 17:16 [PATCH] board: rpi: Update memory layout for Aarch64 Walter Lozano
2024-07-16 17:21 ` Tom Rini
2024-07-17 10:59 ` Peter Robinson
2024-07-17 15:44 ` Tom Rini
2024-07-17 18:32 ` Walter Lozano
2024-07-18 13:52 ` Tom Rini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240718135219.GV561963@bill-the-cat \
--to=trini@konsulko.com \
--cc=martyn@collabora.com \
--cc=mbrugger@suse.com \
--cc=pbrobinson@gmail.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
--cc=walter.lozano@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox