Currently kernel entry in head.S is in DMW address range, firmware is instructed to jump to this address after loading the image. However kernel should not make any assumption on firmware's DMW setting, thus the entry point should be a physical address falls into direct translation region. Fix by applying a calculation to the entry. Note that due to relocation restriction TO_PHYS can't be used, we can only do plus and minus here. Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> --- arch/loongarch/kernel/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/loongarch/kernel/head.S b/arch/loongarch/kernel/head.S index c4f7de2e2805..1a83564023e1 100644 --- a/arch/loongarch/kernel/head.S +++ b/arch/loongarch/kernel/head.S @@ -22,7 +22,7 @@ _head: .word MZ_MAGIC /* "MZ", MS-DOS header */ .org 0x8 - .dword kernel_entry /* Kernel entry point */ + .dword PHYS_LINK_KADDR + (kernel_entry - _head) /* Kernel entry point */ .dword _kernel_asize /* Kernel image effective size */ .quad PHYS_LINK_KADDR /* Kernel image load offset from start of RAM */ .org 0x38 /* 0x20 ~ 0x37 reserved */ -- 2.43.0