All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RESEND PATCH 0/3] arm: Introduce writel/readl_relaxed accessors
@ 2019-02-10 16:17 Andre Przywara
  2019-02-10 16:17 ` [U-Boot] [RESEND PATCH 1/3] arm: clean up asm/io.h Andre Przywara
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Andre Przywara @ 2019-02-10 16:17 UTC (permalink / raw)
  To: u-boot

Hi, this is a resend of what I posted some weeks ago, just adding the
missing Signed-off-by: in patch 2/3, as pointed out by Philipp. I used
the opportunity to add his Reviewed-by: tags on the first two patches.
(Many thanks for that!) The rest is unchanged.
-------------------

Admittedly this is the long way round to solve some nasty SPL code size
problem, but it looked beneficial to others as well, so here we go:

arch/arm/include/asm/io.h looks like it's been around since the dawn of
time, and was more or less blindly copied from Linux.
We don't use and don't need most of the definitions, and mainline Linux
got rid of them anyway, so patch 1/3 cleans up this header file to
just contain what we need in U-Boot.

Patch 2/3 introduces readl/writel_relaxed accessors, which are cheaper,
but more importantly save one (barrier) instruction per accessor. This
helps to bring down code size, since especially DRAM controller inits in
SPLs tend to do a lot of MMIO.

Consequently patch 3/3 introduces them in the Allwinner H6 DRAM driver,
which reduces the SPL size by a whopping 2KB, due to a twist:
The AArch64 exception table needs to be 2KB aligned, but we don't do
anything special about it the linker script. So depending on where the
code before the vectors ends, we have potentially large padding:
At the moment this last address is 0x1824 for the H6, so the vectors can
only start at 0x2000. By reducing the code size before the vectors by just 
(at least) 9 instructions, the vectors start at 0x1800 and we save most of
the padding.

I understand that the proper solution is to fill the gap before the vectors
with code instead of NOPs, but I couldn't find any obvious way doing this
in the linker script. If anyone has any idea here, I am all ears.

Cheers,
Andre.

Andre Przywara (3):
  arm: clean up asm/io.h
  arm: introduce _relaxed MMIO accessors
  sunxi: H6: use writel_relaxed for DRAM timing register accesses

 arch/arm/include/asm/io.h            | 164 +++--------------------------------
 arch/arm/mach-sunxi/dram_sun50i_h6.c |  79 +++++++++--------
 2 files changed, 54 insertions(+), 189 deletions(-)

-- 
2.14.5

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-04-30 22:06 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-10 16:17 [U-Boot] [RESEND PATCH 0/3] arm: Introduce writel/readl_relaxed accessors Andre Przywara
2019-02-10 16:17 ` [U-Boot] [RESEND PATCH 1/3] arm: clean up asm/io.h Andre Przywara
2019-02-20 12:24   ` Alexander Graf
2019-02-10 16:17 ` [U-Boot] [RESEND PATCH 2/3] arm: introduce _relaxed MMIO accessors Andre Przywara
2019-02-20 12:24   ` Alexander Graf
2019-02-10 16:17 ` [U-Boot] [RESEND PATCH 3/3] sunxi: H6: use writel_relaxed for DRAM timing register accesses Andre Przywara
2019-02-20 12:25   ` Alexander Graf
2019-04-15  6:07 ` [U-Boot] [RESEND PATCH 0/3] arm: Introduce writel/readl_relaxed accessors Jagan Teki
2019-04-15  6:10   ` Chen-Yu Tsai
2019-04-15  6:22     ` Jagan Teki
2019-04-15  7:48       ` André Przywara
2019-04-17 12:00         ` Jagan Teki
2019-04-18  0:37           ` André Przywara
2019-04-18 16:59             ` Jagan Teki
2019-04-18 17:00 ` Jagan Teki
2019-04-25 18:01   ` Jagan Teki
2019-04-29 17:16 ` Jagan Teki
2019-04-30 22:06   ` André Przywara

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.