[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1606878005-11427-1-git-send-email-hejinyang@loongson.cn>
Date: Wed, 2 Dec 2020 11:00:05 +0800
From: Jinyang He <hejinyang@...ngson.cn>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] MIPS: KASLR: Fix sync_icache() trapped in loop when synci_step is zero
Reading synci_step by using rdhwr instruction may return zero if no cache
need be synchronized. On the one hand, to make sure all load operation and
store operation finished we do __sync() for every platform. On the other
hand, some platform need operate synci one time although step is zero.
Signed-off-by: Jinyang He <hejinyang@...ngson.cn>
---
arch/mips/kernel/relocate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
index 57bdd276..47aeb33 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();
--
2.1.0
Powered by blists - more mailing lists