xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH] libx86: Introduce wrappers for extracting XCR0/XSS from a cpuid policy
Date: Thu, 23 May 2019 06:08:14 -0600	[thread overview]
Message-ID: <5CE68D2E0200007800231B13@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <2c57c495-3149-f883-ac6c-3db50334d21b@citrix.com>

>>> On 23.05.19 at 13:59, <andrew.cooper3@citrix.com> wrote:
> On 23/05/2019 12:52, Jan Beulich wrote:
>>>>> On 23.05.19 at 12:27, <andrew.cooper3@citrix.com> 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Jan Beulich" <JBeulich@suse.com>
To: "Andrew Cooper" <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH] libx86: Introduce wrappers for extracting XCR0/XSS from a cpuid policy
Date: Thu, 23 May 2019 06:08:14 -0600	[thread overview]
Message-ID: <5CE68D2E0200007800231B13@prv1-mh.provo.novell.com> (raw)
Message-ID: <20190523120814.Qx3YWCw4VQFEUr7TIE02qxXLDlk47PuYXfh3TgYwovY@z> (raw)
In-Reply-To: <2c57c495-3149-f883-ac6c-3db50334d21b@citrix.com>

>>> On 23.05.19 at 13:59, <andrew.cooper3@citrix.com> wrote:
> On 23/05/2019 12:52, Jan Beulich wrote:
>>>>> On 23.05.19 at 12:27, <andrew.cooper3@citrix.com> 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-05-23 12:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 15:50 [PATCH] libx86: Elide more empty CPUID leaves when serialising a policy Andrew Cooper
2019-05-22 15:50 ` [Xen-devel] " Andrew Cooper
2019-05-23  8:33 ` Jan Beulich
2019-05-23  8:33   ` [Xen-devel] " Jan Beulich
2019-05-23 10:38   ` Andrew Cooper
2019-05-23 10:38     ` [Xen-devel] " Andrew Cooper
2019-05-23 10:27 ` [PATCH] libx86: Introduce wrappers for extracting XCR0/XSS from a cpuid policy Andrew Cooper
2019-05-23 10:27   ` [Xen-devel] " Andrew Cooper
2019-05-23 11:52   ` Jan Beulich
2019-05-23 11:52     ` [Xen-devel] " Jan Beulich
2019-05-23 11:59     ` Andrew Cooper
2019-05-23 11:59       ` [Xen-devel] " Andrew Cooper
2019-05-23 12:08       ` Jan Beulich [this message]
2019-05-23 12:08         ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5CE68D2E0200007800231B13@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).