[PATCH v2 0/6] KVM: x86: Reg cleanups / prep work for APX

Sean Christopherson posted 6 patches 2 months, 1 week ago
arch/x86/include/asm/kvm_host.h | 32 +++++++++--------
arch/x86/kvm/kvm_cache_regs.h   | 62 +++++++++++++++++++++++----------
arch/x86/kvm/svm/sev.c          |  2 +-
arch/x86/kvm/svm/svm.c          | 16 ++++-----
arch/x86/kvm/svm/svm.h          |  2 +-
arch/x86/kvm/vmx/nested.c       | 10 +++---
arch/x86/kvm/vmx/tdx.c          | 36 +++++++++----------
arch/x86/kvm/vmx/vmx.c          | 52 +++++++++++++--------------
arch/x86/kvm/vmx/vmx.h          | 24 ++++++-------
arch/x86/kvm/x86.c              | 20 +++++------
10 files changed, 143 insertions(+), 113 deletions(-)
[PATCH v2 0/6] KVM: x86: Reg cleanups / prep work for APX
Posted by Sean Christopherson 2 months, 1 week ago
Clean up KVM's register tracking and storage, primarily to prepare for landing
APX, which expands the maximum number of GPRs from 16 to 32.

v2:
 - Call out the RIP is effectively an "EX" reg too (in patch 2). [Paolo]
 - Rework the available/dirty APIs to have an explicit "clear" operation
   for available, and only a full "reset" for dirty. [Yosry, Paolo]

v1: https://lore.kernel.org/all/20260311003346.2626238-1-seanjc@google.com

Sean Christopherson (6):
  KVM: x86: Add dedicated storage for guest RIP
  KVM: x86: Drop the "EX" part of "EXREG" to avoid collision with APX
  KVM: nVMX: Do a bitwise-AND of regs_avail when switching active VMCS
  KVM: x86: Add wrapper APIs to reset dirty/available register masks
  KVM: x86: Track available/dirty register masks as "unsigned long"
    values
  KVM: x86: Use a proper bitmap for tracking available/dirty registers

 arch/x86/include/asm/kvm_host.h | 32 +++++++++--------
 arch/x86/kvm/kvm_cache_regs.h   | 62 +++++++++++++++++++++++----------
 arch/x86/kvm/svm/sev.c          |  2 +-
 arch/x86/kvm/svm/svm.c          | 16 ++++-----
 arch/x86/kvm/svm/svm.h          |  2 +-
 arch/x86/kvm/vmx/nested.c       | 10 +++---
 arch/x86/kvm/vmx/tdx.c          | 36 +++++++++----------
 arch/x86/kvm/vmx/vmx.c          | 52 +++++++++++++--------------
 arch/x86/kvm/vmx/vmx.h          | 24 ++++++-------
 arch/x86/kvm/x86.c              | 20 +++++------
 10 files changed, 143 insertions(+), 113 deletions(-)


base-commit: b89df297a47e641581ee67793592e5c6ae0428f4
-- 
2.53.0.1213.gd9a14994de-goog
Re: [PATCH v2 0/6] KVM: x86: Reg cleanups / prep work for APX
Posted by Paolo Bonzini 1 month, 1 week ago
On 4/10/26 00:42, Sean Christopherson wrote:
> Clean up KVM's register tracking and storage, primarily to prepare for landing
> APX, which expands the maximum number of GPRs from 16 to 32.

Applied to kvm/next, thanks.  Upon rereading the thread I honestly 
didn't see anything worth changing in the commit message of patch 1.

Paolo

> v2:
>   - Call out the RIP is effectively an "EX" reg too (in patch 2). [Paolo]
>   - Rework the available/dirty APIs to have an explicit "clear" operation
>     for available, and only a full "reset" for dirty. [Yosry, Paolo]
> 
> v1: https://lore.kernel.org/all/20260311003346.2626238-1-seanjc@google.com
> 
> Sean Christopherson (6):
>    KVM: x86: Add dedicated storage for guest RIP
>    KVM: x86: Drop the "EX" part of "EXREG" to avoid collision with APX
>    KVM: nVMX: Do a bitwise-AND of regs_avail when switching active VMCS
>    KVM: x86: Add wrapper APIs to reset dirty/available register masks
>    KVM: x86: Track available/dirty register masks as "unsigned long"
>      values
>    KVM: x86: Use a proper bitmap for tracking available/dirty registers
> 
>   arch/x86/include/asm/kvm_host.h | 32 +++++++++--------
>   arch/x86/kvm/kvm_cache_regs.h   | 62 +++++++++++++++++++++++----------
>   arch/x86/kvm/svm/sev.c          |  2 +-
>   arch/x86/kvm/svm/svm.c          | 16 ++++-----
>   arch/x86/kvm/svm/svm.h          |  2 +-
>   arch/x86/kvm/vmx/nested.c       | 10 +++---
>   arch/x86/kvm/vmx/tdx.c          | 36 +++++++++----------
>   arch/x86/kvm/vmx/vmx.c          | 52 +++++++++++++--------------
>   arch/x86/kvm/vmx/vmx.h          | 24 ++++++-------
>   arch/x86/kvm/x86.c              | 20 +++++------
>   10 files changed, 143 insertions(+), 113 deletions(-)
> 
> 
> base-commit: b89df297a47e641581ee67793592e5c6ae0428f4
Re: [PATCH v2 0/6] KVM: x86: Reg cleanups / prep work for APX
Posted by Huang, Kai 2 months, 1 week ago
On Thu, 2026-04-09 at 15:42 -0700, Sean Christopherson wrote:
> Clean up KVM's register tracking and storage, primarily to prepare for landing
> APX, which expands the maximum number of GPRs from 16 to 32.
> 

Tested booting/destroying both normal VMX guest and TD worked fine:

Reviewed-by: Kai Huang <kai.huang@intel.com>
Tested-by: Kai Huang <kai.huang@intel.com>