All of lore.kernel.org
 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>
Subject: Re: [PATCH 3/8] x86emul: support BMI1 insns
Date: Mon, 16 Jan 2017 04:19:17 -0700	[thread overview]
Message-ID: <587CBA4502000078001305C7@prv-mh.provo.novell.com> (raw)
In-Reply-To: <06374b36-8815-be17-9e76-cc68912fadbd@citrix.com>

>>> On 13.01.17 at 18:40, <andrew.cooper3@citrix.com> wrote:
> On 13/01/17 15:31, Jan Beulich wrote:
>> @@ -5866,6 +5879,67 @@ x86_emulate(
>>          break;
>>  #endif
>>  
>> +    case X86EMUL_OPC_VEX(0x0f38, 0xf2):    /* andn r/m,r,r */
>> +    case X86EMUL_OPC_VEX(0x0f38, 0xf7):    /* bextr r,r/m,r */
>> +    {
>> +        uint8_t *buf = get_stub(stub);
>> +        typeof(vex) *pvex = container_of(buf + 1, typeof(vex), raw[0]);
>> +
>> +        host_and_vcpu_must_have(bmi1);
>> +        generate_exception_if(vex.l, EXC_UD);
> 
> The manual also states #UD if VEX.W is set.

This is very clearly a doc error: For one, is doesn't _also_ state this,
but says nothing about VEX.L. And the instruction encodings list .W1
variants (as expected) to encode 64-bit operations.

>> +
>> +        buf[0] = 0xc4;
>> +        *pvex = vex;
>> +        pvex->b = 1;
>> +        pvex->r = 1;
>> +        pvex->reg = ~0; /* rAX */
>> +        buf[3] = b;
>> +        buf[4] = 0x09; /* reg=rCX r/m=(%rCX) */
>> +        buf[5] = 0xc3;
>> +
>> +        src.reg = decode_register(~vex.reg & (mode_64bit() ? 0xf : 7),
>> +                                  &_regs, 0);
> 
> Given this construct, and several GPR-encoded vex instructions, how
> about a decode_vex_gpr() wrapper?

That's a good idea.

>> --- a/xen/include/asm-x86/cpufeature.h
>> +++ b/xen/include/asm-x86/cpufeature.h
>> @@ -57,6 +57,7 @@
>>  #define cpu_has_xsave           boot_cpu_has(X86_FEATURE_XSAVE)
>>  #define cpu_has_avx             boot_cpu_has(X86_FEATURE_AVX)
>>  #define cpu_has_lwp             boot_cpu_has(X86_FEATURE_LWP)
>> +#define cpu_has_bmi1            boot_cpu_has(X86_FEATURE_BMI1)
>>  #define cpu_has_mpx             boot_cpu_has(X86_FEATURE_MPX)
>>  #define cpu_has_arch_perfmon    boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
>>  #define cpu_has_rdtscp          boot_cpu_has(X86_FEATURE_RDTSCP)
> 
> After trying this out, we clearly need to alter the position on VEX
> prefixes.  VEX encoded GPR instructions don't fall within the previous
> assumptions made about the dependences of VEX instructions.

Should I fold this in, or do you want to submit it as a separate
patch?

Jan

> --- a/xen/tools/gen-cpuid.py
> +++ b/xen/tools/gen-cpuid.py
> @@ -234,9 +234,11 @@ def crunch_numbers(state):
>          XSAVE: [XSAVEOPT, XSAVEC, XGETBV1, XSAVES,
>                  AVX, MPX, PKU, LWP],
>  
> -        # AVX is taken to mean hardware support for VEX encoded
> instructions,
> -        # 256bit registers, and the instructions themselves.  Each of these
> -        # subsequent instruction groups may only be VEX encoded.
> +        # AVX is taken to mean hardware support for 256bit registers,
> and the
> +        # instructions themselves.  It does not related to the VEX
> prefix (In
> +        # particular, most BMI{1,2} instructions may only be VEX
> encoded but
> +        # operate on GPRs rather than YMM register and can be used without
> +        # enabling xstate).
>          AVX: [FMA, FMA4, F16C, AVX2, XOP],
>  
>          # CX16 is only encodable in Long Mode.  LAHF_LM indicates that the




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-01-16 11:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 15:11 [PATCH 0/8] x86emul: support various ISA extensions Jan Beulich
2017-01-13 15:30 ` [PATCH 1/8] x86emul: support POPCNT Jan Beulich
2017-01-13 16:31   ` Andrew Cooper
2017-01-13 15:31 ` [PATCH 2/8] x86emul: support ADCX/ADOX Jan Beulich
2017-01-13 16:34   ` Andrew Cooper
2017-01-13 15:31 ` [PATCH 3/8] x86emul: support BMI1 insns Jan Beulich
2017-01-13 17:40   ` Andrew Cooper
2017-01-16 11:19     ` Jan Beulich [this message]
2017-01-16 11:59       ` Andrew Cooper
2017-01-16 12:43         ` Jan Beulich
2017-01-16 12:57           ` Jan Beulich
2017-01-16 13:51             ` Andrew Cooper
2017-01-16 13:58               ` Jan Beulich
2017-01-16 14:17                 ` Andrew Cooper
2017-01-16 15:43                   ` Jan Beulich
2017-01-13 15:32 ` [PATCH 4/8] x86emul: support BMI2 insns Jan Beulich
2017-01-13 18:20   ` Andrew Cooper
2017-01-16 11:32     ` Jan Beulich
2017-01-13 15:32 ` [PATCH 5/8] x86emul: support TBM insns Jan Beulich
2017-01-13 18:48   ` Andrew Cooper
2017-01-16 11:36     ` Jan Beulich
2017-01-16 14:52       ` Andrew Cooper
2017-01-16 15:45         ` Jan Beulich
2017-01-13 15:34 ` [PATCH 6/8] x86emul: support RDRAND/RDSEED Jan Beulich
2017-01-13 18:55   ` Andrew Cooper
2017-01-13 15:34 ` [PATCH 7/8] x86emul: support RDPID Jan Beulich
2017-01-13 19:00   ` Andrew Cooper
2017-01-13 15:35 ` [PATCH 8/8] x86emul: rename the no_writeback label Jan Beulich
2017-01-13 19:01   ` Andrew Cooper

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=587CBA4502000078001305C7@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@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 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.