|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libx86: Introduce wrappers for extracting XCR0/XSS from a cpuid policy
>>> On 23.05.19 at 13:59, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 23/05/2019 12:52, Jan Beulich wrote:
>>>>> On 23.05.19 at 12:27, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> --- a/xen/include/xen/lib/x86/cpuid.h
>>> +++ b/xen/include/xen/lib/x86/cpuid.h
>>> @@ -308,6 +308,18 @@ static inline void cpuid_featureset_to_policy(
>>> p->feat._7a1 = fs[FEATURESET_7a1];
>>> }
>>>
>>> +static inline uint64_t cpuid_policy_xcr0(const struct cpuid_policy *p)
>>> +{
>>> + return ((uint64_t)p->xstate.xcr0_high << 32) | p->xstate.xcr0_low;
>>> +}
>>> +
>>> +static inline uint64_t cpuid_policy_xstates(const struct cpuid_policy *p)
>>> +{
>>> + uint64_t val = p->xstate.xcr0_high | p->xstate.xss_high;
>>> +
>>> + return (val << 32) | p->xstate.xcr0_low | p->xstate.xss_low;
>>> +}
>> How about also having cpuid_policy_xss() (or cpuid_policy_xss_max())
>> and then simply making cpuid_policy_xstates() combine the two
>> results?
>
> I started with that, but the resulting code was a little awkward to
> read, and the asm generation was a little worse due to promoting
> everything first.
>
> I don't think we need cpuid_policy_xss{,_max}() until we actually
> implement something for guests (most likely CET at this rate).
Well, let's stick to what you have then.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |