From 9b7a5aa27b964c176d0b00867524039d12a378be Mon Sep 17 00:00:00 2001 From: He Sheng Date: Wed, 27 Jul 2022 09:16:21 +0800 Subject: [PATCH] sw64: remove unused members from pcb_struct Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I56OLG -------------------------------- Since we have removed hmcall swpctx invocations, some members of struct pcb_struct become useless. This patch removes them to reduce the struct size. As a result, struct processor_state is simplified too. Signed-off-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/include/asm/suspend.h | 2 +- arch/sw_64/include/asm/thread_info.h | 5 ----- arch/sw_64/kernel/asm-offsets.c | 3 +-- arch/sw_64/kernel/hibernate_asm.S | 6 ++---- arch/sw_64/kernel/process.c | 1 - arch/sw_64/kernel/traps.c | 1 - 6 files changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/sw_64/include/asm/suspend.h b/arch/sw_64/include/asm/suspend.h index 83fd413fd6e2..de6d97a0aff6 100644 --- a/arch/sw_64/include/asm/suspend.h +++ b/arch/sw_64/include/asm/suspend.h @@ -39,7 +39,7 @@ struct processor_state { struct callee_saved_fpregs fpregs; unsigned long fpcr; #ifdef CONFIG_HIBERNATION - struct pcb_struct pcb; + unsigned long sp; struct vcpucb vcb; #endif }; diff --git a/arch/sw_64/include/asm/thread_info.h b/arch/sw_64/include/asm/thread_info.h index 8e4e1f372d73..7cdafaec62e4 100644 --- a/arch/sw_64/include/asm/thread_info.h +++ b/arch/sw_64/include/asm/thread_info.h @@ -15,13 +15,8 @@ typedef struct { struct pcb_struct { - unsigned long ksp; unsigned long usp; - unsigned long ptbr; - unsigned int pcc; - unsigned int asn; unsigned long tp; - unsigned long flags; unsigned long da_match, da_mask; unsigned long dv_match, dv_mask; unsigned long dc_ctl; diff --git a/arch/sw_64/kernel/asm-offsets.c b/arch/sw_64/kernel/asm-offsets.c index 9e6c338a5edd..56c5daaa413c 100644 --- a/arch/sw_64/kernel/asm-offsets.c +++ b/arch/sw_64/kernel/asm-offsets.c @@ -33,9 +33,8 @@ void foo(void) OFFSET(PSTATE_FPREGS, processor_state, fpregs); OFFSET(PSTATE_FPCR, processor_state, fpcr); #ifdef CONFIG_HIBERNATION - OFFSET(PSTATE_PCB, processor_state, pcb); + OFFSET(PSTATE_SP, processor_state, sp); #endif - OFFSET(PCB_KSP, pcb_struct, ksp); OFFSET(PBE_ADDR, pbe, address); OFFSET(PBE_ORIG_ADDR, pbe, orig_address); OFFSET(PBE_NEXT, pbe, next); diff --git a/arch/sw_64/kernel/hibernate_asm.S b/arch/sw_64/kernel/hibernate_asm.S index 3acbcdbae0b3..23bab0d6edd8 100644 --- a/arch/sw_64/kernel/hibernate_asm.S +++ b/arch/sw_64/kernel/hibernate_asm.S @@ -30,8 +30,7 @@ ENTRY(swsusp_arch_suspend) rfpcr $f0 fstd $f0, PSTATE_FPCR($16) - ldi $1, PSTATE_PCB($16) - stl sp, PCB_KSP($1) + stl sp, PSTATE_SP($16) call swsusp_save ldi $16, hibernate_state ldi $1, PSTATE_REGS($16) @@ -112,8 +111,7 @@ $hibernate_setfpec_over: vldd $f8, CALLEE_F8($1) vldd $f9, CALLEE_F9($1) - ldi $1, PSTATE_PCB($16) - ldl sp, PCB_KSP($1) + ldl sp, PSTATE_SP($16) ldi $8, 0x3fff bic sp, $8, $8 diff --git a/arch/sw_64/kernel/process.c b/arch/sw_64/kernel/process.c index 31e95e722e81..e1689d25f77d 100644 --- a/arch/sw_64/kernel/process.c +++ b/arch/sw_64/kernel/process.c @@ -160,7 +160,6 @@ copy_thread(unsigned long clone_flags, unsigned long usp, struct pt_regs *childregs = task_pt_regs(p); struct pt_regs *regs = current_pt_regs(); - childti->pcb.flags = 7; /* set FEN, clear everything else */ p->thread.sp = (unsigned long) childregs; if (unlikely(p->flags & PF_KTHREAD)) { diff --git a/arch/sw_64/kernel/traps.c b/arch/sw_64/kernel/traps.c index ff32330d73ab..a54db1d7045b 100644 --- a/arch/sw_64/kernel/traps.c +++ b/arch/sw_64/kernel/traps.c @@ -283,7 +283,6 @@ do_entIF(unsigned long inst_type, struct pt_regs *regs) * attacks. So turn the bleeding FPU back on and be done * with it. */ - current_thread_info()->pcb.flags |= 1; fpu_enable(); return; -- GitLab