Commit ad0f6980 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

x86: Allow forward compatibility mode for FPU

At the moment we refuse to restore if CPU mismatch
at FPU related features. Strictly speaking this is
not required.

We can allow to restore on the node with xsave capability
even if the node was created on cpu which has fxsave
capability only.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent eee9ad2b
......@@ -317,12 +317,8 @@ static bool valid_xsave_frame(CoreEntry *core)
}
if (cpu_has_feature(X86_FEATURE_XSAVE)) {
if (!core->thread_info->fpregs->xsave) {
pr_err("FPU xsave area is missing, "
"but host cpu requires it\n");
return false;
}
if (core->thread_info->fpregs->xsave->n_ymmh_space < ARRAY_SIZE(x->ymmh.ymmh_space)) {
if (core->thread_info->fpregs->xsave &&
core->thread_info->fpregs->xsave->n_ymmh_space < ARRAY_SIZE(x->ymmh.ymmh_space)) {
pr_err("Corruption in FPU ymmh_space area "
"(got %li but %li expected)\n",
(long)core->thread_info->fpregs->xsave->n_ymmh_space,
......@@ -402,6 +398,12 @@ int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
void *magic2;
x->xsave_hdr.xstate_bv = XSTATE_FP | XSTATE_SSE | XSTATE_YMM;
/*
* fpregs->xsave pointer might not present on image so we
* simply clear out all ymm registers.
*/
if (core->thread_info->fpregs->xsave)
assign_array(x->ymmh, core->thread_info->fpregs->xsave, ymmh_space);
fpx_sw->magic1 = FP_XSTATE_MAGIC1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment