diff mbox

[PATCHv3,2/3] x86/fpu: Add a per-domain field to set the width of FIP/FDP

Message ID 56CEE7CB.3040407@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Vrabel Feb. 25, 2016, 11:38 a.m. UTC
On 25/02/16 11:24, Jan Beulich wrote:
>>>> On 25.02.16 at 11:58, <david.vrabel@citrix.com> wrote:
>> @@ -261,7 +261,15 @@ void xsave(struct vcpu *v, uint64_t mask)
>>                           "=m" (*ptr), \
>>                           "a" (lmask), "d" (hmask), "D" (ptr))
>>  
>> -    if ( word_size <= 0 || !is_pv_32bit_vcpu(v) )
>> +    if ( fip_width == 8 )
>> +    {
>> +        XSAVE("0x48,");
>> +    }
>> +    else if ( fip_width == 4 )
>> +    {
>> +        XSAVE("");
>> +    }
>> +    else
> 
> Both conditions would now better also check mask & XSTATE_FP,
> since going these routes (and namely bypassing the FIP check, as
> was done before) is fine when FP state is not being saved.

Is this what you mean?


David

Comments

Jan Beulich Feb. 25, 2016, 11:55 a.m. UTC | #1
>>> On 25.02.16 at 12:38, <david.vrabel@citrix.com> wrote:
> On 25/02/16 11:24, Jan Beulich wrote:
>>>>> On 25.02.16 at 11:58, <david.vrabel@citrix.com> wrote:
>>> @@ -261,7 +261,15 @@ void xsave(struct vcpu *v, uint64_t mask)
>>>                           "=m" (*ptr), \
>>>                           "a" (lmask), "d" (hmask), "D" (ptr))
>>>  
>>> -    if ( word_size <= 0 || !is_pv_32bit_vcpu(v) )
>>> +    if ( fip_width == 8 )
>>> +    {
>>> +        XSAVE("0x48,");
>>> +    }
>>> +    else if ( fip_width == 4 )
>>> +    {
>>> +        XSAVE("");
>>> +    }
>>> +    else
>> 
>> Both conditions would now better also check mask & XSTATE_FP,
>> since going these routes (and namely bypassing the FIP check, as
>> was done before) is fine when FP state is not being saved.
> 
> Is this what you mean?
> 
> --- a/xen/arch/x86/xstate.c
> +++ b/xen/arch/x86/xstate.c
> @@ -261,7 +261,7 @@ void xsave(struct vcpu *v, uint64_t mask)
>                           "=m" (*ptr), \
>                           "a" (lmask), "d" (hmask), "D" (ptr))
> 
> -    if ( fip_width == 8 )
> +    if ( fip_width == 8 || !(mask & XSTATE_FP) )
>      {
>          XSAVE("0x48,");
>      }

Oh, you're right, it's just one of the two that needs it.

Jan
diff mbox

Patch

--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -261,7 +261,7 @@  void xsave(struct vcpu *v, uint64_t mask)
                          "=m" (*ptr), \
                          "a" (lmask), "d" (hmask), "D" (ptr))

-    if ( fip_width == 8 )
+    if ( fip_width == 8 || !(mask & XSTATE_FP) )
     {
         XSAVE("0x48,");
     }