From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH] x86/PV: hide features dependent on XSAVE when booted with "no-xsave"
Date: Mon, 30 Nov 2015 18:01:43 +0000 [thread overview]
Message-ID: <565C8F07.4070706@citrix.com> (raw)
In-Reply-To: <565C80BA02000078000BA5D6@prv-mh.provo.novell.com>
On 30/11/15 16:00, Jan Beulich wrote:
>>>> On 30.11.15 at 16:38, <andrew.cooper3@citrix.com> wrote:
>> On 30/11/15 15:22, Jan Beulich wrote:
>>>>>> On 30.11.15 at 14:36, <andrew.cooper3@citrix.com> wrote:
>>>> On 30/11/15 11:30, Jan Beulich wrote:
>>>>> It's not well defined whether YMM register presence
>>>>> correlates to AVX, or is simply flagged by the respective XSTATE
>>>>> CPUID bit (or a mixture of both).
>>>> It is indeed not well defined, which is what makes this area of
>>>> functionality so hard to level safely.
>>>>
>>>>> The minimal (and imo more natural) dependency is just the XSTATE bit.
>>>> But it is wrong.
>>>>
>>>> Any VEX encoded SIMD operation unconditionally works on YMM state. In
>>>> the case that XMM registers are encoded with a VEX prefix, the upper 128
>>>> bits of the YMM register are zeroed (SDM Vol 2, 2.3.10). This is
>>>> contrary to legacy SSE instructions which preserve the upper 128 bits.
>>>>
>>>> Therefore, FMA, FMA4 and XOP do have a strict dependency on AVX.
>>> No, if you really want to express it that way, you'll need feature
>>> flags derived from the XSTATE bits.
>> What? That is absurd.
> Sorry, but no, this is not absurd, this is what you can derive from the
> SDM without much guessing. There's nowhere the SDM makes any
> connection between FMA and AVX.
Intel Vol 1 14.5.3 "Detection of FMA" states:
Hardware support for FMA is indicated by CPUID.1:ECX.FMA[bit 12]=1.
Application Software must identify that hardware supports AVX, after
that it must also detect support for FMA by
CPUID.1:ECX.FMA[bit 12].
> The only connections it makes are OSXSAVE and XCR0[2:1], neither of which is formally tied to AVX.
Actually, on further reading,
Intel SDM Vol 3, 2.6, Figure 2-8 states:
XCR0.AVX (bit 2): If 1, AVX instructions can be executed and the XSAVE
feature set can be used to manage the
upper halves of the YMM registers (YMM0-YMM15 in 64-bit mode; otherwise
YMM0-YMM7).
This means that bit 2 has dual meaning, and is not just YMM state. This
does IMO provide a formal tie between AVX and XCRO[2].
I admit that the AMD manuals are far less prescriptive than the Intel.
However, AMD Vol 3 1.9 "Encoding using the VEX and XOP Prefixes" draws
several conclusions, including:
VEX opcode maps 1–3 are also used to encode the FMA4 and FMA instructions
while the FMA/FMA4 instruction description states:
The destination is either an XMM register or a YMM register, as
determined by VEX.L. When the
destination is an XMM register (L = 0), bits [255:128] of the
corresponding YMM register are
cleared.
and also states that a #UD will occur if XCR0[2:1] != '11b', which is
sufficient indication of FMA/FMA4 having a direct link to AVX.
As for XOP, AMD Vol 4, 1.2.2.1 "XMM Register Destinations" states again
that either all YMM is specified, or the the upper 128 bits are cleared
if an XMM register is encoded, as well as each instruction description
specifying a #UD if XCR0[2:1] != '11b'. This logically follows from the
history, where XOP ended up being all the SSE5 instructions which didn't
overlap with AVX.
~Andrew
prev parent reply other threads:[~2015-11-30 18:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 11:05 [PATCH] x86/PV: hide features dependent on XSAVE when booted with "no-xsave" Jan Beulich
2015-11-27 15:05 ` Andrew Cooper
2015-11-30 10:01 ` Jan Beulich
2015-11-30 10:46 ` Andrew Cooper
2015-11-30 11:08 ` Jan Beulich
2015-11-30 11:10 ` Andrew Cooper
2015-11-30 11:30 ` Jan Beulich
2015-11-30 13:36 ` Andrew Cooper
2015-11-30 15:22 ` Jan Beulich
2015-11-30 15:38 ` Andrew Cooper
2015-11-30 16:00 ` Jan Beulich
2015-11-30 18:01 ` Andrew Cooper [this message]
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=565C8F07.4070706@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.