kvm: vmx: Introduce VMCS12_MAX_FIELD_INDEX

"Linux Kernel Mailing List" <[email protected]> Sat, 10 Feb 2018 22:00:21 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/5b15706dbf5bdf0c9708ca9bb1f37e95e315daf2
Commit:     5b15706dbf5bdf0c9708ca9bb1f37e95e315daf2
Parent:     44900ba65e16ab3c6608e105654f38f54d030caa
Refname:    refs/heads/master
Author:     Jim Mattson <[email protected]>
AuthorDate: Fri Dec 22 12:11:12 2017 -0800
Committer:  Radim Krčmář <[email protected]>
CommitDate: Tue Jan 16 16:49:58 2018 +0100

    kvm: vmx: Introduce VMCS12_MAX_FIELD_INDEX
    
    This is the highest index value used in any supported VMCS12 field
    encoding. It is used to populate the IA32_VMX_VMCS_ENUM MSR.
    
    Signed-off-by: Jim Mattson <[email protected]>
    Signed-off-by: Paolo Bonzini <[email protected]>
    Signed-off-by: Radim Krčmář <[email protected]>
---
 arch/x86/kvm/vmx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bdd3f155efae..bbfbed714dec 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -407,6 +407,12 @@ struct __packed vmcs12 {
  */
 #define VMCS12_SIZE 0x1000
 
+/*
+ * VMCS12_MAX_FIELD_INDEX is the highest index value used in any
+ * supported VMCS12 field encoding.
+ */
+#define VMCS12_MAX_FIELD_INDEX 0x17
+
 /*
  * The nested_vmx structure is part of vcpu_vmx, and holds information we need
  * for correct emulation of VMX (i.e., nested VMX) on this vcpu.
@@ -2923,7 +2929,7 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
 	rdmsrl(MSR_IA32_VMX_CR4_FIXED1, vmx->nested.nested_vmx_cr4_fixed1);
 
 	/* highest index: VMX_PREEMPTION_TIMER_VALUE */
-	vmx->nested.nested_vmx_vmcs_enum = 0x2e;
+	vmx->nested.nested_vmx_vmcs_enum = VMCS12_MAX_FIELD_INDEX << 1;
 }
 
 /*
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html