summaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorJinyang He <hejinyang@loongson.cn>2020-12-04 09:11:46 +0800
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2020-12-05 11:23:16 +0100
commitc0aac3a51cb6364bed367ee3e1a96ed414f386b4 (patch)
tree8060c444efab3db3ea963d68bf441f8c2c933f4b /arch/mips
parent4f1682b8a97dc24e57e8bcb62b23c216d8425266 (diff)
MIPS: KASLR: Avoid endless loop in sync_icache if synci_step is zero
Most platforms do not need to do synci instruction operations when synci_step is 0. But for example, the synci implementation on Loongson64 platform has some changes. On the one hand, it ensures that the memory access instructions have been completed. On the other hand, it guarantees that all prefetch instructions need to be fetched again. And its address information is useless. Thus, only one synci operation is required when synci_step is 0 on Loongson64 platform. I guess that some other platforms have similar implementations on synci, so add judgment conditions in `while` to ensure that at least all platforms perform synci operations once. For those platforms that do not need synci, they just do one more operation similar to nop. Signed-off-by: Jinyang He <hejinyang@loongson.cn> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/relocate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
index 57bdd2761c78..47aeb3350a76 100644
--- a/arch/mips/kernel/relocate.c
+++ b/arch/mips/kernel/relocate.c
@@ -64,7 +64,7 @@ static void __init sync_icache(void *kbase, unsigned long kernel_length)
: "r" (kbase));
kbase += step;
- } while (kbase < kend);
+ } while (step && kbase < kend);
/* Completion barrier */
__sync();