Skip to content

Commit

Permalink
ar71xx: fix lzma loader performance issues
Browse files Browse the repository at this point in the history
Some bootloaders set a cache cohenrency to a very slow mode. Use code from
Linux kernel to set it to "Cacheable, noncoherent, write-back, write
allocate".

Perfomance impact is significant on TP-Link EAP245 board, kernel
decompression time fall from 33 seconds to less than 1.

Signed-off-by: Julien Dusser <julien.dusser@free.fr>
  • Loading branch information
j-d-r authored and nbd168 committed Oct 24, 2017
1 parent 06e4105 commit 8c5702f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions target/linux/ar71xx/image/lzma-loader/src/head.S
Expand Up @@ -42,6 +42,19 @@ LEAF(startup)
mtc0 t0, CP0_STATUS
ehb

/*
* Some bootloaders set the 'Kseg0 coherency algorithm' to
* 'Cacheable, noncoherent, write-through, no write allocate'
* and this cause performance issues. Let's go and change it to
* 'Cacheable, noncoherent, write-back, write allocate'
*/
mfc0 t0, CP0_CONFIG
li t1, ~7 #~CONF_CM_CMASK
and t0, t1
ori t0, 3 #CONF_CM_CACHABLE_NONCOHERENT
mtc0 t0, CP0_CONFIG
nop

mtc0 zero, CP0_COUNT
mtc0 zero, CP0_COMPARE
ehb
Expand Down

0 comments on commit 8c5702f

Please sign in to comment.