mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Jim Mattson <jmattson@google.com>
Cc: <pbonzini@redhat.com>, <seanjc@google.com>, <kvm@vger.kernel.org>,
	<x86@kernel.org>, <linux-kernel@vger.kernel.org>,
	<zhao1.liu@intel.com>
Subject: Re: [PATCH v8 12/20] KVM: x86: Support REX2-prefixed opcode decode
Date: Tue, 17 Nov 2026 10:38:10 -0800	[thread overview]
Message-ID: <0e87373f-1f2d-4b2d-99f4-4072f3d14b66@intel.com> (raw)
In-Reply-To: <CALMp9eSZ7V=rOByRveQqCgAgnj_AwRKFa19X4_+4xRJh88H4sQ@mail.gmail.com>

On 11/6/2026 6:07 AM, Jim Mattson wrote:
> On Thu, Nov 5, 2026 at 8:48 PM Jim Mattson <jmattson@google.com> wrote:
>>
>> "ud" is defined as I(SrcNone, emulate_ud), and SrcNone is 0. Jumping to
>> done_modrm with opcode.flags == 0 sets ctxt->d = 0, which then hits:
>>
>>          /* Unrecognised? */
>>          if (ctxt->d == 0)
>>                  return EMULATION_FAILED;
>>
>> before ctxt->execute is ever set. As a result, rex2_invalid() always
>> returns EMULATION_FAILED instead of injecting #UD.
> 
> Once again, on EMULATION_FAILED,  x86_emulate_instruction() will raise #UD.
> 
> That leaves only this question on this patch...

So I add the Undefined tag explicitly here:

   -static const struct opcode ud = I(SrcNone, emulate_ud);
   +static const struct opcode ud = I(SrcNone | Undefined, emulate_ud);

>> Does hardware raise #UD on 0x48 0x66 0xD5, or does the intervening legacy
>> prefix nullify the REX prefix as in legacy encodings?

Yes, it is nullified and this behavior should be preserved, I think. I 
was also able to verify this on an APX-prototyped system.

> 
> The text clearly permits 0x48 0x66 0xD5, since the REX prefix doesn't
> *immediately* precede the REX2 prefix. The table is unclear.

I'll pass this documentation feedback along to the relevant folks.

Thanks,
Chang

  reply	other threads:[~2026-11-17 18:38 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 21:07 [PATCH v8 00/20] KVM: x86: Enable APX for guests Chang S. Bae
2026-09-30 21:07 ` [PATCH v8 01/20] KVM: x86: Extend VCPU registers for EGPRs Chang S. Bae
2026-11-05 23:42   ` Jim Mattson
2026-11-06  5:32     ` Chang S. Bae
2026-09-30 21:07 ` [PATCH v8 02/20] KVM: VMX: Save guest EGPRs in VCPU cache Chang S. Bae
2026-11-05 23:52   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 03/20] KVM: x86: Support APX state for XSAVE ABI Chang S. Bae
2026-11-06  0:13   ` Jim Mattson
2026-11-06  5:33     ` Chang S. Bae
2026-11-06  5:46       ` Jim Mattson
2026-11-06  5:57         ` Chang S. Bae
2026-09-30 21:07 ` [PATCH v8 04/20] KVM: VMX: Refactor VMX instruction information access Chang S. Bae
2026-11-06  0:17   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 05/20] KVM: VMX: Refactor instruction information decoding Chang S. Bae
2026-11-06  0:19   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 06/20] KVM: VMX: Remove unused control-register access defines Chang S. Bae
2026-11-06  0:20   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 07/20] KVM: VMX: Refactor register index retrieval from exit qualification Chang S. Bae
2026-11-06  0:22   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 08/20] KVM: VMX: Support instruction information extension Chang S. Bae
2026-11-06  0:40   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 09/20] KVM: nVMX: Propagate extended instruction information Chang S. Bae
2026-11-06  0:53   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 10/20] KVM: x86: Support EGPR accessing and tracking for emulator Chang S. Bae
2026-11-06  0:55   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 11/20] KVM: x86: Handle EGPR index and REX2-incompatible opcodes Chang S. Bae
2026-11-06  4:34   ` Jim Mattson
2026-11-06 13:53     ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 12/20] KVM: x86: Support REX2-prefixed opcode decode Chang S. Bae
2026-11-06  4:48   ` Jim Mattson
2026-11-06 14:07     ` Jim Mattson
2026-11-17 18:38       ` Chang S. Bae [this message]
2026-09-30 21:07 ` [PATCH v8 13/20] KVM: x86: Reject EVEX-prefixed instructions Chang S. Bae
2026-11-06  4:56   ` Jim Mattson
2026-11-06 14:17     ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 14/20] KVM: x86: Move KVM_SUPPORTED_{XCR0,XSS} into kvm_x86_vendor_init() Chang S. Bae
2026-11-06  4:58   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 15/20] KVM: x86: Guard valid XCR0.APX settings Chang S. Bae
2026-11-06  5:00   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 16/20] KVM: x86: Add APX to supported XCR0 Chang S. Bae
2026-11-06  5:01   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 17/20] KVM: x86: Expose APX foundation feature to userspace Chang S. Bae
2026-11-06  5:05   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 18/20] KVM: x86: Expose APX sub-features " Chang S. Bae
2026-09-30 21:07 ` [PATCH v8 19/20] KVM: x86: selftests: Add APX state and ABI test Chang S. Bae
2026-11-06  5:31   ` Jim Mattson
2026-09-30 21:07 ` [PATCH v8 20/20] KVM: x86: selftests: Add APX state handling and XCR0 sanity checks Chang S. Bae
2026-11-06  5:36   ` Jim Mattson
2026-10-01 20:29 ` [PATCH v8 00/20] KVM: x86: Enable APX for guests Chang S. Bae
2026-11-04  0:45   ` Chang S. Bae

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=0e87373f-1f2d-4b2d-99f4-4072f3d14b66@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=x86@kernel.org \
    --cc=zhao1.liu@intel.com \
    /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

all inboxes | Powered by JetHome®