提交 300f972d 编写于 作者: T Thomas Gleixner 提交者: Lin Wang

x86/fpu: Add fpu_state_config::legacy_features

mainline inclusion
from mainline-v5.16-rc1
commit c33f0a81
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I590ZC
CVE: NA

Intel-SIG: commit c33f0a81 x86/fpu: Add fpu_state_config::legacy_features.

--------------------------------

The upcoming prctl() which is required to request the permission for a
dynamically enabled feature will also provide an option to retrieve the
supported features. If the CPU does not support XSAVE, the supported
features would be 0 even when the CPU supports FP and SSE.

Provide separate storage for the legacy feature set to avoid that and fill
in the bits in the legacy init function.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Signed-off-by: NChang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: NBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211021225527.10184-6-chang.seok.bae@intel.comSigned-off-by: NLin Wang <lin.x.wang@intel.com>
上级 40388d86
......@@ -503,6 +503,13 @@ struct fpu_state_config {
* be requested by user space before usage.
*/
u64 default_features;
/*
* @legacy_features:
*
* Features which can be reported back to user space
* even without XSAVE support, i.e. legacy features FP + SSE
*/
u64 legacy_features;
};
/* FPU state configuration information */
......
......@@ -193,12 +193,15 @@ static void __init fpu__init_system_xstate_size_legacy(void)
* Note that the size configuration might be overwritten later
* during fpu__init_system_xstate().
*/
if (!cpu_feature_enabled(X86_FEATURE_FPU))
if (!cpu_feature_enabled(X86_FEATURE_FPU)) {
size = sizeof(struct swregs_state);
else if (cpu_feature_enabled(X86_FEATURE_FXSR))
} else if (cpu_feature_enabled(X86_FEATURE_FXSR)) {
size = sizeof(struct fxregs_state);
else
fpu_user_cfg.legacy_features = XFEATURE_MASK_FPSSE;
} else {
size = sizeof(struct fregs_state);
fpu_user_cfg.legacy_features = XFEATURE_MASK_FP;
}
fpu_kernel_cfg.max_size = size;
fpu_kernel_cfg.default_size = size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册