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

Commit dc1e35c6 authored by Suresh Siddha's avatar Suresh Siddha Committed by Ingo Molnar
Browse files

x86, xsave: enable xsave/xrstor on cpus with xsave support



Enables xsave/xrstor by turning on cr4.osxsave on cpu's which have
the xsave support. For now, features that OS supports/enabled are
FP and SSE.

Signed-off-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent a648bf46
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ obj-y += tsc.o io_delay.o rtc.o

obj-$(CONFIG_X86_TRAMPOLINE)	+= trampoline.o
obj-y				+= process.o
obj-y				+= i387.o
obj-y				+= i387.o xsave.o
obj-y				+= ptrace.o
obj-y				+= ds.o
obj-$(CONFIG_X86_32)		+= tls.o
+8 −0
Original line number Diff line number Diff line
@@ -712,6 +712,14 @@ void __cpuinit cpu_init(void)
	current_thread_info()->status = 0;
	clear_used_math();
	mxcsr_feature_mask_init();

	/*
	 * Boot processor to setup the FP and extended state context info.
	 */
	if (!smp_processor_id())
		init_thread_xstate();

	xsave_init();
}

#ifdef CONFIG_HOTPLUG_CPU
+12 −0
Original line number Diff line number Diff line
@@ -61,6 +61,11 @@ void __init init_thread_xstate(void)
		return;
	}

	if (cpu_has_xsave) {
		xsave_cntxt_init();
		return;
	}

	if (cpu_has_fxsr)
		xstate_size = sizeof(struct i387_fxsave_struct);
#ifdef CONFIG_X86_32
@@ -83,6 +88,13 @@ void __cpuinit fpu_init(void)

	write_cr0(oldcr0 & ~(X86_CR0_TS|X86_CR0_EM)); /* clear TS and EM */

	/*
	 * Boot processor to setup the FP and extended state context info.
	 */
	if (!smp_processor_id())
		init_thread_xstate();
	xsave_init();

	mxcsr_feature_mask_init();
	/* clean state in init */
	current_thread_info()->status = 0;
+0 −1
Original line number Diff line number Diff line
@@ -1228,7 +1228,6 @@ void __init trap_init(void)

	set_bit(SYSCALL_VECTOR, used_vectors);

	init_thread_xstate();
	/*
	 * Should be a barrier for any external CPU state:
	 */
+0 −4
Original line number Diff line number Diff line
@@ -1172,10 +1172,6 @@ void __init trap_init(void)
#ifdef CONFIG_IA32_EMULATION
	set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall);
#endif
	/*
	 * initialize the per thread extended state:
	 */
	init_thread_xstate();
	/*
	 * Should be a barrier for any external CPU state:
	 */
Loading