Skip to content

Enable caches for the RPi2

Alexander Graf u-boot 5 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 4/40 of 5 patches 0 repliesNew
  2. v2 posting 3/40 of 5 patches 0 repliesSuperseded
  3. v2 posting 2/40 of 5 patches 0 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 posting 1/45 patches0 repliesSuperseded
v15 patches0 repliesSuperseded

Patches in v2 posting 4/4 No applies recorded yet

None of the 5 patches the cover letter announces are in this archive.

Reviews trailers per patch

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

Read the v2 thread

Cover letter [U-Boot] [PATCH v2 0/5] Enable caches for the RPi2
Quoted 18 lines · Stephen Warren
Quoted 10 lines · Alexander Graf

This patch set converts the Raspberry Pi 2 system to properly make use of the caches available in it.

Because we're running in HYP mode, we first need to teach U-Boot how to make use of HYP registers and the LPAE page layout which is mandated by hardware when running in HYP mode.

Then while we're at it, also mark the frame buffer cached to speed up screen updates.

Quoted 6 lines

With this patch set, my Raspberry Pi 3 running in AArch32 mode is a *lot* faster than without.

Please verify that the code works on a RPi2 as well and doesn't break the original Pi. In theory it should work, but I only have a 3 to test on available here.

Quoted 6 lines

I did find one quirk with this series (as tested in my rpi_dev branch on github): HDMI console scrolling is now extremely fast for 32-bit builds. However, it's noticeably slower on the 64-bit RPi 3 build. I wonder if the DCACHE_* constants aren't optimal for AArch64? Perhaps this can all be explained instead by RPi 3 needing a slower core clock to support a fixed mini UART frequency; that probably slows down the ARM access to DRAM.

I tried with the latest code and my patches that allow for disabled uart, so that the core shouldn't get slowed down anymore.

It still does feel significantly slower than it should.

We set the memory type to WRITEBACK which translates to index 4 into MAIR

DCACHE_WRITEBACK = 4 << 2,

->

  #define MT_NORMAL               4

So we need to look at what MAIR 4 looks like:

  #define MEMORY_ATTRIBUTES [...] |
        (UL(0xff) << (MT_NORMAL * 8)))

and that is

Normal Memory, Outer Write-back non-transient
Outer Read Allocate
Outer Write Allocate
Normal Memory, Inner Write-back non-transient
Inner Read Allocate
Inner Write Allocate

So we should be using as much cache as we can ;). I'm not quite sure why it's still slower than you'd expect though. Hrm.

Alex