xstate.c (0ea5c948cb64bab5bc7a5516774eb8536f05aa0d) | xstate.c (10e4b5166df9ff7a2d5316138ca668b42d004422) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * xsave/xrstor support. 4 * 5 * Author: Suresh Siddha <suresh.b.siddha@intel.com> 6 */ 7#include <linux/bitops.h> 8#include <linux/compat.h> --- 164 unchanged lines hidden (view full) --- 173 return; 174 175 cr4_set_bits(X86_CR4_OSXSAVE); 176 177 /* 178 * Must happen after CR4 setup and before xsetbv() to allow KVM 179 * lazy passthrough. Write independent of the dynamic state static 180 * key as that does not work on the boot CPU. This also ensures | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * xsave/xrstor support. 4 * 5 * Author: Suresh Siddha <suresh.b.siddha@intel.com> 6 */ 7#include <linux/bitops.h> 8#include <linux/compat.h> --- 164 unchanged lines hidden (view full) --- 173 return; 174 175 cr4_set_bits(X86_CR4_OSXSAVE); 176 177 /* 178 * Must happen after CR4 setup and before xsetbv() to allow KVM 179 * lazy passthrough. Write independent of the dynamic state static 180 * key as that does not work on the boot CPU. This also ensures |
181 * that any stale state is wiped out from XFD. | 181 * that any stale state is wiped out from XFD. Reset the per CPU 182 * xfd cache too. |
182 */ 183 if (cpu_feature_enabled(X86_FEATURE_XFD)) | 183 */ 184 if (cpu_feature_enabled(X86_FEATURE_XFD)) |
184 wrmsrl(MSR_IA32_XFD, init_fpstate.xfd); | 185 xfd_set_state(init_fpstate.xfd); |
185 186 /* 187 * XCR_XFEATURE_ENABLED_MASK (aka. XCR0) sets user features 188 * managed by XSAVE{C, OPT, S} and XRSTOR{S}. Only XSAVE user 189 * states can be set here. 190 */ 191 xsetbv(XCR_XFEATURE_ENABLED_MASK, fpu_user_cfg.max_features); 192 --- 1646 unchanged lines hidden --- | 186 187 /* 188 * XCR_XFEATURE_ENABLED_MASK (aka. XCR0) sets user features 189 * managed by XSAVE{C, OPT, S} and XRSTOR{S}. Only XSAVE user 190 * states can be set here. 191 */ 192 xsetbv(XCR_XFEATURE_ENABLED_MASK, fpu_user_cfg.max_features); 193 --- 1646 unchanged lines hidden --- |