SDM[1] has stated that many VMCS fields' existence depend on some other VMX feature's status. In nested case, VMCS12 shall respect this, i.e., L0's VMCS configuration for L1 has limited the L1's VMX "physical" capability, some vmcs12.fields shall appear not exist when L1 vmread/vmwrite. This patch set 1) Add a bitmap in nested_vmx to reflect vmcs12 fields' existence 2) Implement those update functions according to dependencies stated in SDM and update dynamically 3) Make VMCS12 read/write respect this 4) Make nested MSR_IA32_VMX_VMCS_ENUM read-only and respect this [1] Notes in SDM Vol.3, Appedix B FIELD ENCODING IN VMCS --- This patch set is a follow-up to Sean's suggestion in ba1f82456b (Dynamically compute max VMCS index for vmcs12). Robert Hoo (5): KVM: x86: nVMX: Add vmcs12 field existence bitmap in nested_vmx KVM: x86: nVMX: Update VMCS12 fields existence when nVMX MSRs are set KVM: x86: nVMX: VMCS12 field's read/write respects field existence bitmap KVM: x86: nVMX: Respect vmcs12 field existence when calc vmx_vmcs_enum_msr KVM: x86: nVMX: Ignore user space set value to MSR_IA32_VMX_VMCS_ENUM arch/x86/kvm/vmx/nested.c | 68 +++++-- arch/x86/kvm/vmx/nested.h | 1 + arch/x86/kvm/vmx/vmcs12.c | 363 ++++++++++++++++++++++++++++++++++++++ arch/x86/kvm/vmx/vmcs12.h | 69 ++++++-- arch/x86/kvm/vmx/vmx.c | 17 +- arch/x86/kvm/vmx/vmx.h | 3 + 6 files changed, 499 insertions(+), 22 deletions(-) base-commit: 32bdc01988413031c6e743714c2b40bdd773e5db -- 2.27.0