aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Dusser <julien.dusser@free.fr>2017-07-19 14:52:35 +0200
committerFelix Fietkau <nbd@nbd.name>2017-10-24 13:24:04 +0200
commit8c5702f2a07cebfbee6f9e628b63d88b8806ca1b (patch)
treedb2ce879a3a0a19d441362f1dc681dc8e742b6dd
parent06e41056aab12f5fb6c35789d0bde71bcf1dc90e (diff)
downloadupstream-8c5702f2a07cebfbee6f9e628b63d88b8806ca1b.tar.gz
upstream-8c5702f2a07cebfbee6f9e628b63d88b8806ca1b.tar.bz2
upstream-8c5702f2a07cebfbee6f9e628b63d88b8806ca1b.zip
ar71xx: fix lzma loader performance issues
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>
-rw-r--r--target/linux/ar71xx/image/lzma-loader/src/head.S13
1 files changed, 13 insertions, 0 deletions
diff --git a/target/linux/ar71xx/image/lzma-loader/src/head.S b/target/linux/ar71xx/image/lzma-loader/src/head.S
index 47a7c9bd63..d414b14d11 100644
--- a/target/linux/ar71xx/image/lzma-loader/src/head.S
+++ b/target/linux/ar71xx/image/lzma-loader/src/head.S
@@ -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