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>,
	"Chang S. Bae" <chang.seok.bae@intel.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 01/20] KVM: x86: Extend VCPU registers for EGPRs
Date: Thu, 5 Nov 2026 21:32:53 -0800	[thread overview]
Message-ID: <efcdac63-8422-4a60-9ea2-da790e1f0846@intel.com> (raw)
In-Reply-To: <CALMp9eTMteQ7WpPv++Ds_LZY_1MydqtwHy=7zsUEgrfRempbeA@mail.gmail.com>

On 11/5/26 15:42, Jim Mattson wrote:
> 
> In kvm_vcpu_reset(), KVM unconditionally zeroes the entire vcpu->arch.regs
> array on both RESET and INIT:
> 
>      /* All GPRs except RDX (handled below) are zeroed on RESET/INIT. */
>      memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs));
> 
> However, according to the Intel APX Architecture Specification (rev. 9.0),
> section 3.1.4.1.1 and Table 3.7, R16-R31 are unchanged on INIT:
> 
>    The main difference between EGPRs and legacy GPRs, is that EGPRs are not
>    enabled by default (specifically XCR0-enabled) in 64-bit mode, and their
>    INIT behavior is XMM-like; in that EGPRs and many other XSAVE-enabled
>    register states are un-changed on INIT events as shown in Table 3.7.
> 
> By extending NR_VCPU_GENERAL_PURPOSE_REGS to include VCPU_REGS_R16 through
> VCPU_REGS_R31 without updating kvm_vcpu_reset(), KVM will erroneously zero
> R16-R31 when init_event is true.

Appreciate the review!

This was overlooked since switched away from XSAVE to the VCPU cache. 
Initially, I thought okay to keep along with other XSTATEs:

   The specification deliberately scopes out some areas. For example,
   Sections 3.1.4.4.2–7 note that initialization and reset behaviors
   follow existing XSTATE conventions.

Yes, you're right. The reset needs to be adjusted.

Thanks,
Chang

  reply	other threads:[~2026-11-06  5:33 UTC|newest]

Thread overview: 46+ 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 [this message]
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-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-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-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=efcdac63-8422-4a60-9ea2-da790e1f0846@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®