x86/EFI: take care of fully eager FPU around runtime calls Just like in the HVM emulation case we must not set CR0.TS here in fully eager mode. Note that idle vCPU-s never have ->arch.fully_eager_fpu set (for their initialization not going through vcpu_init_fpu()), so we won't hit the respective ASSERT() in vcpu_restore_fpu_eager(). Introduce a "curr" local variable and replace other uses of "current" at the same time. Reported-by: Andrew Cooper Signed-off-by: Jan Beulich --- RFC: Not even compile tested, as I'm writing this from home. --- a/xen/common/efi/runtime.c +++ b/xen/common/efi/runtime.c @@ -118,14 +118,16 @@ struct efi_rs_state efi_rs_enter(void) void efi_rs_leave(struct efi_rs_state *state) { + struct vcpu *curr = current; + if ( !state->cr3 ) return; write_cr3(state->cr3); - if ( is_pv_vcpu(current) && !is_idle_vcpu(current) ) + if ( is_pv_vcpu(curr) && !is_idle_vcpu(curr) ) { struct desc_ptr gdt_desc = { .limit = LAST_RESERVED_GDT_BYTE, - .base = GDT_VIRT_START(current) + .base = GDT_VIRT_START(curr) }; asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); @@ -133,7 +135,10 @@ void efi_rs_leave(struct efi_rs_state *state) irq_exit(); efi_rs_on_cpu = NR_CPUS; spin_unlock(&efi_rs_lock); - stts(); + if ( curr->arch.fully_eager_fpu ) + vcpu_restore_fpu_eager(curr); + else + stts(); } bool efi_rs_using_pgtables(void)