提交 579e633e 编写于 作者: A Anton Blanchard 提交者: Michael Ellerman

powerpc: create flush_all_to_thread()

Create a single function that flushes everything (FP, VMX, VSX, SPE).
Doing this all at once means we only do one MSR write.
Signed-off-by: NAnton Blanchard <anton@samba.org>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 c2085059
...@@ -27,6 +27,7 @@ extern void giveup_vsx(struct task_struct *); ...@@ -27,6 +27,7 @@ extern void giveup_vsx(struct task_struct *);
extern void enable_kernel_spe(void); extern void enable_kernel_spe(void);
extern void load_up_spe(struct task_struct *); extern void load_up_spe(struct task_struct *);
extern void giveup_all(struct task_struct *); extern void giveup_all(struct task_struct *);
extern void flush_all_to_thread(struct task_struct *);
extern void switch_booke_debug_regs(struct debug_reg *new_debug); extern void switch_booke_debug_regs(struct debug_reg *new_debug);
#ifdef CONFIG_PPC_FPU #ifdef CONFIG_PPC_FPU
......
...@@ -367,6 +367,23 @@ void giveup_all(struct task_struct *tsk) ...@@ -367,6 +367,23 @@ void giveup_all(struct task_struct *tsk)
} }
EXPORT_SYMBOL(giveup_all); EXPORT_SYMBOL(giveup_all);
void flush_all_to_thread(struct task_struct *tsk)
{
if (tsk->thread.regs) {
preempt_disable();
BUG_ON(tsk != current);
giveup_all(tsk);
#ifdef CONFIG_SPE
if (tsk->thread.regs->msr & MSR_SPE)
tsk->thread.spefscr = mfspr(SPRN_SPEFSCR);
#endif
preempt_enable();
}
}
EXPORT_SYMBOL(flush_all_to_thread);
#ifdef CONFIG_PPC_ADV_DEBUG_REGS #ifdef CONFIG_PPC_ADV_DEBUG_REGS
void do_send_trap(struct pt_regs *regs, unsigned long address, void do_send_trap(struct pt_regs *regs, unsigned long address,
unsigned long error_code, int signal_code, int breakpt) unsigned long error_code, int signal_code, int breakpt)
...@@ -1137,10 +1154,7 @@ release_thread(struct task_struct *t) ...@@ -1137,10 +1154,7 @@ release_thread(struct task_struct *t)
*/ */
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
{ {
flush_fp_to_thread(src); flush_all_to_thread(src);
flush_altivec_to_thread(src);
flush_vsx_to_thread(src);
flush_spe_to_thread(src);
/* /*
* Flush TM state out so we can copy it. __switch_to_tm() does this * Flush TM state out so we can copy it. __switch_to_tm() does this
* flush but it removes the checkpointed state from the current CPU and * flush but it removes the checkpointed state from the current CPU and
......
...@@ -20,9 +20,7 @@ void save_processor_state(void) ...@@ -20,9 +20,7 @@ void save_processor_state(void)
* flush out all the special registers so we don't need * flush out all the special registers so we don't need
* to save them in the snapshot * to save them in the snapshot
*/ */
flush_fp_to_thread(current); flush_all_to_thread(current);
flush_altivec_to_thread(current);
flush_spe_to_thread(current);
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
hard_irq_disable(); hard_irq_disable();
......
...@@ -2700,9 +2700,8 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu) ...@@ -2700,9 +2700,8 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
goto out; goto out;
} }
flush_fp_to_thread(current); flush_all_to_thread(current);
flush_altivec_to_thread(current);
flush_vsx_to_thread(current);
vcpu->arch.wqp = &vcpu->arch.vcore->wq; vcpu->arch.wqp = &vcpu->arch.vcore->wq;
vcpu->arch.pgdir = current->mm->pgd; vcpu->arch.pgdir = current->mm->pgd;
vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST; vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册