Commit 4d734558 authored by Tang Jinyang's avatar Tang Jinyang Committed by guzitao
Browse files

sw64: fix PTBR save/restore for hibernation

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



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

For C4, both CSR:PTBR_USR and CSR:PTBR_SYS have to be saved/restored
to make hibernation work.

Signed-off-by: default avatarTang Jinyang <tangjinyang@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent b9ad17a0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -15,7 +15,12 @@ void save_processor_state(void)
	vcb->ksp = rdksp();
	vcb->usp = rdusp();
	vcb->soft_tid = rtid();
#if defined(CONFIG_SUBARCH_C3B)
	vcb->ptbr = rdptbr();
#elif defined(CONFIG_SUBARCH_C4)
	vcb->ptbr_usr = sw64_read_csr(CSR_PTBR_USR);
	vcb->ptbr_sys = sw64_read_csr(CSR_PTBR_SYS);
#endif
}

void restore_processor_state(void)
@@ -25,7 +30,12 @@ void restore_processor_state(void)
	wrksp(vcb->ksp);
	wrusp(vcb->usp);
	wrtp(vcb->soft_tid);
#if defined(CONFIG_SUBARCH_C3B)
	wrptbr(vcb->ptbr);
#elif defined(CONFIG_SUBARCH_C4)
	sw64_write_csr_imb(vcb->ptbr_usr, CSR_PTBR_USR);
	sw64_write_csr_imb(vcb->ptbr_sys, CSR_PTBR_SYS);
#endif
	sflush();
	tbiv();
}
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
#include <asm/asm-offsets.h>
#include <asm/page.h>
#include <asm/regdef.h>
#include <asm/csr.h>

	.macro SAVE_KTP
#ifdef CONFIG_SUBARCH_C3B