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

Commit 3c6dffa9 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

x86/fpu: Rename user_has_fpu() to fpregs_active()



Rename this function in line with the new FPU nomenclature.

Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
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 be7436d5
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -358,7 +358,7 @@ static inline void __fpregs_activate(struct fpu *fpu)
 * to save the FP state - we'll just take a #NM
 * to save the FP state - we'll just take a #NM
 * fault and get the FPU access back.
 * fault and get the FPU access back.
 */
 */
static inline int user_has_fpu(void)
static inline int fpregs_active(void)
{
{
	return current->thread.fpu.fpregs_active;
	return current->thread.fpu.fpregs_active;
}
}
@@ -557,7 +557,7 @@ static inline void user_fpu_begin(void)
	struct fpu *fpu = &current->thread.fpu;
	struct fpu *fpu = &current->thread.fpu;


	preempt_disable();
	preempt_disable();
	if (!user_has_fpu())
	if (!fpregs_active())
		fpregs_activate(fpu);
		fpregs_activate(fpu);
	preempt_enable();
	preempt_enable();
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -310,7 +310,7 @@ int copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size)
			sizeof(struct user_i387_ia32_struct), NULL,
			sizeof(struct user_i387_ia32_struct), NULL,
			(struct _fpstate_ia32 __user *) buf) ? -1 : 1;
			(struct _fpstate_ia32 __user *) buf) ? -1 : 1;


	if (user_has_fpu()) {
	if (fpregs_active()) {
		/* Save the live register state to the user directly. */
		/* Save the live register state to the user directly. */
		if (copy_fpregs_to_sigframe(buf_fx))
		if (copy_fpregs_to_sigframe(buf_fx))
			return -1;
			return -1;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1882,7 +1882,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
	 * If the FPU is not active (through the host task or
	 * If the FPU is not active (through the host task or
	 * the guest vcpu), then restore the cr0.TS bit.
	 * the guest vcpu), then restore the cr0.TS bit.
	 */
	 */
	if (!user_has_fpu() && !vmx->vcpu.guest_fpu_loaded)
	if (!fpregs_active() && !vmx->vcpu.guest_fpu_loaded)
		stts();
		stts();
	load_gdt(this_cpu_ptr(&host_gdt));
	load_gdt(this_cpu_ptr(&host_gdt));
}
}
+3 −3
Original line number Original line Diff line number Diff line
@@ -251,7 +251,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
	 * we set it now, so we can trap and pass that trap to the Guest if it
	 * we set it now, so we can trap and pass that trap to the Guest if it
	 * uses the FPU.
	 * uses the FPU.
	 */
	 */
	if (cpu->ts && user_has_fpu())
	if (cpu->ts && fpregs_active())
		stts();
		stts();


	/*
	/*
@@ -283,7 +283,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
		wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
		wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);


	/* Clear the host TS bit if it was set above. */
	/* Clear the host TS bit if it was set above. */
	if (cpu->ts && user_has_fpu())
	if (cpu->ts && fpregs_active())
		clts();
		clts();


	/*
	/*
@@ -301,7 +301,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
	 * a different CPU. So all the critical stuff should be done
	 * a different CPU. So all the critical stuff should be done
	 * before this.
	 * before this.
	 */
	 */
	else if (cpu->regs->trapnum == 7 && !user_has_fpu())
	else if (cpu->regs->trapnum == 7 && !fpregs_active())
		fpu__restore();
		fpu__restore();
}
}