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

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

x86/fpu: Move legacy check to fpu__init_system_xstate()



Now that legacy code can execute fpu__init_cpu_xstate() in
xsave_init(), we can move the once per boot legacy check into
fpu__init_system_xstate(), where it belongs.

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 e84611fc
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -653,6 +653,11 @@ void fpu__init_system_xstate(void)
{
	unsigned int eax, ebx, ecx, edx;

	if (!cpu_has_xsave) {
		pr_info("x86/fpu: Legacy x87 FPU detected.\n");
		return;
	}

	if (boot_cpu_data.cpuid_level < XSTATE_CPUID) {
		WARN(1, "x86/fpu: XSTATE_CPUID missing!\n");
		return;
@@ -711,14 +716,6 @@ void xsave_init(void)
{
	static char on_boot_cpu = 1;

	if (!cpu_has_xsave) {
		if (on_boot_cpu) {
			on_boot_cpu = 0;
			pr_info("x86/fpu: Legacy x87 FPU detected.\n");
		}
		return;
	}

	if (on_boot_cpu) {
		on_boot_cpu = 0;
		fpu__init_system_xstate();