Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0ee2cf6 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

x86/fpu: Rename fpu_finit() to fpstate_init()



Make it clear that we are initializing the in-memory FPU context area,
no the FPU registers.

Also move it to the fpu__*() namespace.

Reviewed-by: default avatarBorislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent a7c2a833
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -19,8 +19,8 @@ struct pt_regs;
struct user_i387_struct;
struct user_i387_struct;


extern int fpstate_alloc_init(struct task_struct *curr);
extern int fpstate_alloc_init(struct task_struct *curr);
extern void fpstate_init(struct fpu *fpu);


extern void fpu_finit(struct fpu *fpu);
extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
extern void math_state_restore(void);
extern void math_state_restore(void);


+4 −4
Original line number Original line Diff line number Diff line
@@ -225,7 +225,7 @@ void fpu_init(void)
	eager_fpu_init();
	eager_fpu_init();
}
}


void fpu_finit(struct fpu *fpu)
void fpstate_init(struct fpu *fpu)
{
{
	if (!cpu_has_fpu) {
	if (!cpu_has_fpu) {
		finit_soft_fpu(&fpu->state->soft);
		finit_soft_fpu(&fpu->state->soft);
@@ -244,7 +244,7 @@ void fpu_finit(struct fpu *fpu)
		fp->fos = 0xffff0000u;
		fp->fos = 0xffff0000u;
	}
	}
}
}
EXPORT_SYMBOL_GPL(fpu_finit);
EXPORT_SYMBOL_GPL(fpstate_init);


int fpstate_alloc(struct fpu *fpu)
int fpstate_alloc(struct fpu *fpu)
{
{
@@ -284,7 +284,7 @@ int fpstate_alloc_init(struct task_struct *curr)
	if (ret)
	if (ret)
		return ret;
		return ret;


	fpu_finit(&curr->thread.fpu);
	fpstate_init(&curr->thread.fpu);


	/* Safe to do for the current task: */
	/* Safe to do for the current task: */
	curr->flags |= PF_USED_MATH;
	curr->flags |= PF_USED_MATH;
@@ -318,7 +318,7 @@ static int fpu__unlazy_stopped(struct task_struct *child)
	if (ret)
	if (ret)
		return ret;
		return ret;


	fpu_finit(&child->thread.fpu);
	fpstate_init(&child->thread.fpu);


	/* Safe to do for stopped child tasks: */
	/* Safe to do for stopped child tasks: */
	child->flags |= PF_USED_MATH;
	child->flags |= PF_USED_MATH;
+1 −1
Original line number Original line Diff line number Diff line
@@ -395,7 +395,7 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size)


		if (__copy_from_user(&fpu->state->xsave, buf_fx, state_size) ||
		if (__copy_from_user(&fpu->state->xsave, buf_fx, state_size) ||
		    __copy_from_user(&env, buf, sizeof(env))) {
		    __copy_from_user(&env, buf, sizeof(env))) {
			fpu_finit(fpu);
			fpstate_init(fpu);
			err = -1;
			err = -1;
		} else {
		} else {
			sanitize_restored_xstate(tsk, &env, xstate_bv, fx_only);
			sanitize_restored_xstate(tsk, &env, xstate_bv, fx_only);
+1 −1
Original line number Original line Diff line number Diff line
@@ -7011,7 +7011,7 @@ int fx_init(struct kvm_vcpu *vcpu)
	if (err)
	if (err)
		return err;
		return err;


	fpu_finit(&vcpu->arch.guest_fpu);
	fpstate_init(&vcpu->arch.guest_fpu);
	if (cpu_has_xsaves)
	if (cpu_has_xsaves)
		vcpu->arch.guest_fpu.state->xsave.xsave_hdr.xcomp_bv =
		vcpu->arch.guest_fpu.state->xsave.xsave_hdr.xcomp_bv =
			host_xcr0 | XSTATE_COMPACTION_ENABLED;
			host_xcr0 | XSTATE_COMPACTION_ENABLED;