x86/EFI: take care of fully eager FPU around runtime calls
RFC PATCH 1/1 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.
---
RFC: Not even compile tested, as I'm writing this from home. Also please
excuse the formatting (hence the attachment) - our mail web frontend
doesn't allow anything better.
xen/common/efi/runtime.c +8 -3
@@ -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) }; asmvolatile ("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 )
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.
---
RFC: Not even compile tested, as I'm writing this from home.
xen/common/efi/runtime.c +8 -3
@@ -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) }; asmvolatile ("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 )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel