linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: Make sure ebase address is in KSEG0
@ 2019-11-21 11:30 Huacai Chen
  2019-11-22 18:47 ` Paul Burton
  0 siblings, 1 reply; 7+ messages in thread
From: Huacai Chen @ 2019-11-21 11:30 UTC (permalink / raw)
  To: Paul Burton, Ralf Baechle, James Hogan
  Cc: linux-mips, linux-mips, Fuxin Zhang, Zhangjin Wu, Jiaxun Yang,
	Huacai Chen, Huacai Chen

Dynamically allocated ebase address above 0x20000000 can be triggered
by some special physical memory layout, or just by a "big kernel + big
initrd + big swiotlb" configuration.

For MIPS32, ebase address above 0x20000000 is unusable, for MIPS64 it
is usable but this case is warned. However, this warning is useless
because it is unfixable in a specific system configuration. So we just
use CKSEG0 as a fallback.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/kernel/traps.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 9d9b2a4..7393f33 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -2306,10 +2306,15 @@ void __init trap_init(void)
 		 * EVA is special though as it allows segments to be rearranged
 		 * and to become uncached during cache error handling.
 		 */
-		if (!IS_ENABLED(CONFIG_EVA) && !WARN_ON(ebase_pa >= 0x20000000))
+		if (ebase_pa < 0x20000000)
 			ebase = CKSEG0ADDR(ebase_pa);
-		else
+		else if (IS_ENABLED(CONFIG_EVA))
 			ebase = (unsigned long)phys_to_virt(ebase_pa);
+		else {
+			memblock_free(ebase_pa, vec_size);
+			ebase = CKSEG0;
+			memblock_reserve(virt_to_phys((void *)ebase), vec_size);
+		}
 	}
 
 	if (cpu_has_mmips) {
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-26  1:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 11:30 [PATCH] MIPS: Make sure ebase address is in KSEG0 Huacai Chen
2019-11-22 18:47 ` Paul Burton
2019-11-23  5:08   ` Jiaxun Yang
2019-11-23  6:11     ` Jiaxun Yang
2019-11-24  4:00       ` Huacai Chen
2019-11-25 23:42         ` Paul Burton
2019-11-26  1:55           ` Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).