RE: [patch 13/31] x86/fpu: Move KVMs FPU swapping to FPU core

From: Liu, Jing2
Date: Fri Oct 15 2021 - 05:20:18 EST



On 10/15/2021 3:14 AM, Thomas Gleixner wrote:
> Paolo,
>
[...]
> >> vcpu_create()
> >>
> >> fpu_init_fpstate_user(guest_fpu, supported_xcr0)
> >>
> >> That will (it does not today) do:
> >>
> >> guest_fpu::__state_perm = supported_xcr0 &
> >> xstate_get_group_perm();
> >>
> >> The you have the information you need right in the guest FPU.
> >
> > Good, I wasn't aware of the APIs that will be there.
>
> Me neither, but that's a pretty obvious consequence of the work I'm doing
> for AMX. So I made it up for you. :)

Do you mean that fpu_init_fpstate_user() will be updated to add
supported_xcr0 later? :)

I'm thinking if guest_fpu::xfd is good to directly initialize as user's
init_fpstate.xfd. Because before guest initializes XFD, "hardware"
is reset value. So it would be better to make guest_fpu::xfd the
same so no need to reload zero before vmenter during this time.

Thanks,
Jing