[PATCH v8 02/14] MIPS: Fix set_uncached_handler for ebase in XKPHYS

From: Gregory CLEMENT
Date: Fri Feb 16 2024 - 12:42:55 EST


From: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>

ebase might reside in XKPHYS if memblock is unable to allocate memory
within the KSEG0 physical range.

To map EBASE into uncached space, we convert it back to its physical
address and utilize the new CKSEG1ADDR_OR_64BIT helper for mapping.

Co-developed-by: Vladimir Kondratiev <vladimir.kondratiev@xxxxxxxxx>
Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@xxxxxxxxx>
Co-developed-by: Gregory CLEMENT <gregory.clement@xxxxxxxxxxx>
Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
Signed-off-by: Gregory CLEMENT <gregory.clement@xxxxxxxxxxx>
---
arch/mips/kernel/traps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index c3cc6fff9d80a..075bb08543eca 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -2293,7 +2293,7 @@ static const char panic_null_cerr[] =
void set_uncached_handler(unsigned long offset, void *addr,
unsigned long size)
{
- unsigned long uncached_ebase = CKSEG1ADDR(ebase);
+ unsigned long uncached_ebase = CKSEG1ADDR_OR_64BIT(__pa(ebase));

if (!addr)
panic(panic_null_cerr);
--
2.43.0