[xen stable-4.8] x86/EFI: fix FPU state handling around runtime calls
Author: Jan Beulich <[hidden email]>
AuthorDate: Thu Jun 28 11:19:43 2018 +0200
Commit: Jan Beulich <[hidden email]>
CommitDate: Thu Jun 28 11:19:43 2018 +0200
x86/EFI: fix FPU state handling around runtime calls
There are two issues. First, the nonlazy xstates were never restored
after returning from the runtime call.
Secondly, with the fully_eager_fpu mitigation for XSA-267 / LazyFPU, the
unilateral stts() is no longer correct, and hits an assertion later when
a lazy state restore tries to occur for a fully eager vcpu.
Fix both of these issues by calling vcpu_restore_fpu_eager(). As EFI
runtime services can be used in the idle context, the idle assertion
needs to move until after the fully_eager_fpu check.
Introduce a "curr" local variable and replace other uses of "current"
at the same time.
Reported-by: Andrew Cooper <[hidden email]>
Signed-off-by: Jan Beulich <[hidden email]>
Signed-off-by: Andrew Cooper <[hidden email]>
Tested-by: Juergen Gross <[hidden email]>
master commit: 437211cb696515ee5bd5dae0ab72866c9f382a33
master date: 2018-06-21 11:35:46 +0200
xen/arch/x86/i387.c | 4 ++--
xen/common/efi/runtime.c | 8 +++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 279878fab8..992d4d21c1 100644
@@ -209,12 +209,12 @@ static inline void fpu_fxsave(struct vcpu *v)
/* Restore FPU state whenever VCPU is schduled in. */
void vcpu_restore_fpu_eager(struct vcpu *v)
/* Restore nonlazy extended state (i.e. parts not tracked by CR0.TS). */
if ( !v->arch.fully_eager_fpu && !v->arch.nonlazy_xstate_used )