All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/3] spl: add relocation support【请注意,邮件由sjg@google.com代发】
Date: Tue, 21 May 2019 18:28:12 -0600	[thread overview]
Message-ID: <CAPnjgZ2ddzfw7YMo2eB_4QFroO7rK7Hsxo1ndq0QGvUU5CueSA@mail.gmail.com> (raw)
In-Reply-To: <7974385b-fef4-2237-2192-51681c027b56@rock-chips.com>

Hi Andy,

On Tue, 21 May 2019 at 00:51, Andy Yan <andy.yan@rock-chips.com> wrote:
>
> Hi Simon:
>
> On 2019/5/20 下午11:35, Simon Glass wrote:
> > Hi Andy,
> >
> > On Mon, 20 May 2019 at 00:34, Andy Yan <andy.yan@rock-chips.com> wrote:
> >> Hi Simon:
> >>
> >> On 2019/5/19 上午12:26, Simon Glass wrote:
> >>> Hi Andy,
> >>>
> >>> Instead of this could you:
> >>>
> >>> - move ATF?
> >> All rockchip based arm64 ATF run from the start 64KB of dram as this
> >> will give convenient for kernel manage the memory.
> >>
> >> On the other hand, change the ATF load address will break the
> >> compatibility of the exiting firmware.
> >>
> >>> - change the SPL load address so it is not in the way (since TPL can
> >>> load to any address)
> >> The SPL is loaded by bootrom after TPL back to bootrom, so the load
> >> address if fixed by bootrom code.
> > I think you are creating a nightmare here. If you have to do things
> > like this for older and smaller SoCs, OK. But it should not be used
> > for newer ones that can do things properly.
>
>
> Most rockchip based SOC sram is small,  even in the future soc roadmap,
> this situation  will still exist, larger sram means more cost.

I believe the RK3399 has 192KB. What is the minimum size in new chips?

>
> As for the current spl for rockchip soc in mainline, we use a workaround
> by reserve large space at the head of spl(see
> CONFIG_ROCKCHIP_SPL_RESERVE_IRAM ), this generate a very large spl binary.

Yes.

>
> As for my patch, the spl relocation is disabled default, we only enable
> it on necessary platform, so it won't hurt others .

Well it adds more code and complexity. Perhaps it makes sense to add
this, but I want to understand the need.

>
> > The bootrom has so many limitations that it just creates pain.
> >
> >> I know we can build mmc or other storage driver into TPL so we can use
> >> tpl load spl on some platform that sram is big enough, but there are
> >> also many rockchip soc has very small sram, so we tend to only do dram
> >> initialization in tpl, and let bootrom load next stage .
> > See above
> >
> For the consideration of software development, we also want to keep TPL
> clean,  only do dram initialization(as it current status), this make our
> internal dram team work more simple, they don't need to care about other
> modules like mmc.

Yes I understand this, but the boot ROM should be provided as a
library to call into:

int mmc_read(void *addr, int start_block, int end_block)
int spi_read(void *addr, int start_block, int end_block)

Then SPL or TPL can use it without all the strange limitations we have now.

Since you probably already have these functions somewhere in the boot
ROM, you could implement this using a function table somewhere in the
ROM with a magic number before it, so that SPL can find it.

>
>
> >>> - (in extremis) create a function which does a memmove() and a jump,
> >>> copy it somewhere and run it (I think x86 does this)
> > ?
> I am not very understand about this, just a memmove may not work, we
> need to link the code by pie, and fix the rela.dyn sections after copy.
> see arm/relocate_64.S

Well if you don't access absolute addresses (which you generally don't
in ARM) your memmove() and jump code should be relocatable.

Also I wonder what you think of Andre's solution?

[..]

Regards
Simon

  reply	other threads:[~2019-05-22  0:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 12:19 [U-Boot] [PATCH v2 0/3] Enable spl relocation on arm Andy Yan
2019-05-16 12:21 ` [U-Boot] [PATCH v2 1/3] powerpc: Convert CONFIG_SPL_RELOC_TEXT_BASE to Kconfig Andy Yan
2019-05-16 12:21 ` [U-Boot] [PATCH v2 2/3] spl: add relocation support Andy Yan
2019-05-17  8:34   ` Lukasz Majewski
2019-05-17  9:03     ` Andy Yan
2019-05-18 16:26   ` Simon Glass
2019-05-20  6:34     ` [U-Boot] [PATCH v2 2/3] spl: add relocation support【请注意,邮件由sjg@google.com代发】 Andy Yan
2019-05-20 15:35       ` Simon Glass
2019-05-21  6:50         ` Andy Yan
2019-05-22  0:28           ` Simon Glass [this message]
2019-05-22  1:56             ` Andy Yan
2019-05-22 19:39               ` Simon Glass
2019-05-28  8:33                 ` Andy Yan
2019-06-22 19:10                   ` Simon Glass
2019-06-24 10:36                     ` Andy Yan
2019-06-30 13:03                       ` [U-Boot] [PATCH v2 2/3] spl: add relocation support Kever Yang
2019-07-06 17:16                       ` [U-Boot] [PATCH v2 2/3] spl: add relocation support【请注意,邮件由sjg@google.com代发】 Simon Glass
2019-07-07  0:36                         ` Andy Yan
2019-08-13  9:35                           ` Simon Glass
2019-05-20 15:58       ` Andre Przywara
2019-05-22  1:42         ` Andy Yan
2019-05-22 19:39           ` Simon Glass
2019-05-28  8:47             ` Andy Yan
2019-06-22 19:10               ` Simon Glass
2019-05-16 12:22 ` [U-Boot] [PATCH v2 3/3] arm: add spl relocation support for arm Andy Yan

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=CAPnjgZ2ddzfw7YMo2eB_4QFroO7rK7Hsxo1ndq0QGvUU5CueSA@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.