Commit 6c32d436 authored by Wu Liliu's avatar Wu Liliu Committed by guzitao
Browse files

sw64: fix save_ktp compatibility for C3

Sunway inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBDJNZ



--------------------------------

Commit 388c8e2bbf53 ("sw64: introduce new entry framework for C4") moves
save_ktp() to head.S, and breaks compatibility with old firmware because
hmcall_wrktp was not implemented.

To fix it, save_ktp() should come after fixup_hmcall().

Fixes: 388c8e2bbf53 ("sw64: introduce new entry framework for C4")
Signed-off-by: default avatarWu Liliu <wuliliu@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent 4d734558
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -230,13 +230,18 @@ __CALL_HMC_W1(wrtp, unsigned long);
/* Invalidate all user TLB with current UPN and VPN */
#define tbiu()		__tbi(4, /* no second argument */)

#ifndef CONFIG_SUBARCH_C3B
#if defined(CONFIG_SUBARCH_C4)
__CALL_HMC_W2(wrap_asid, unsigned long, unsigned long);
#else
static inline void save_ktp(void)
{
	__asm__ __volatile__("csrw $8, 0xef");
}
#elif defined(CONFIG_SUBARCH_C3B)
static inline void wrap_asid(unsigned long asid, unsigned long ptbr)
{
	tbivp();
}
#define save_ktp()     wrktp()
#endif

#endif /* !__ASSEMBLY__ */
+1 −0
Original line number Diff line number Diff line
@@ -6,5 +6,6 @@
asmlinkage __visible void __init sw64_start_kernel(void)
{
	fixup_hmcall();
	save_ktp();
	start_kernel();
}
+0 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ __start:
1:	ldgp	$29, 0($27)
	/* We need to get current_task_info loaded up...  */
	ldi	$8, init_task
	SAVE_KTP
	ldl	$30, TASK_STACK($8)
	/* ... and find our stack ... */
	ldi	$30, ASM_THREAD_SIZE($30)