[GIT PULL] KVM: x86: VMX and PAT MSRs cleanup

From: Sean Christopherson
Date: Fri Sep 13 2024 - 21:15:06 EST


The theme of this pull request is to clean up the VMX MSR macros. The PAT MSR
changes (reviewed by tglx) are included here as they allowed for an even more
aggressive cleanup of the VMX macros related to memtypes, e.g. for specifying
the EPT walk memtype in EPTPs.

The following changes since commit 47ac09b91befbb6a235ab620c32af719f8208399:

Linux 6.11-rc4 (2024-08-18 13:17:27 -0700)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-pat_vmx_msrs-6.12

for you to fetch changes up to 566975f6ecd85247bd8989884d7b909d5a456da1:

KVM: nVMX: Use macros and #defines in vmx_restore_vmx_misc() (2024-08-22 11:25:54 -0700)

----------------------------------------------------------------
KVM VMX and x86 PAT MSR macro cleanup for 6.12:

- Add common defines for the x86 architectural memory types, i.e. the types
that are shared across PAT, MTRRs, VMCSes, and EPTPs.

- Clean up the various VMX MSR macros to make the code self-documenting
(inasmuch as possible), and to make it less painful to add new macros.

----------------------------------------------------------------
Sean Christopherson (5):
x86/cpu: KVM: Add common defines for architectural memory types (PAT, MTRRs, etc.)
x86/cpu: KVM: Move macro to encode PAT value to common header
KVM: x86: Stuff vCPU's PAT with default value at RESET, not creation
KVM: nVMX: Add a helper to encode VMCS info in MSR_IA32_VMX_BASIC
KVM VMX: Move MSR_IA32_VMX_MISC bit defines to asm/vmx.h

Xin Li (5):
KVM: VMX: Move MSR_IA32_VMX_BASIC bit defines to asm/vmx.h
KVM: VMX: Track CPU's MSR_IA32_VMX_BASIC as a single 64-bit value
KVM: nVMX: Use macros and #defines in vmx_restore_vmx_basic()
KVM: VMX: Open code VMX preemption timer rate mask in its accessor
KVM: nVMX: Use macros and #defines in vmx_restore_vmx_misc()

arch/x86/include/asm/msr-index.h | 34 +++++++++++++---------
arch/x86/include/asm/vmx.h | 40 +++++++++++++++++++-------
arch/x86/kernel/cpu/mtrr/mtrr.c | 6 ++++
arch/x86/kvm/vmx/capabilities.h | 10 +++----
arch/x86/kvm/vmx/nested.c | 62 +++++++++++++++++++++++++++-------------
arch/x86/kvm/vmx/nested.h | 2 +-
arch/x86/kvm/vmx/vmx.c | 30 +++++++++----------
arch/x86/kvm/x86.c | 4 +--
arch/x86/kvm/x86.h | 3 +-
arch/x86/mm/pat/memtype.c | 36 +++++++----------------
10 files changed, 132 insertions(+), 95 deletions(-)