[PATCH RFC v1 08/10] KVM: nVMX: Use sanitized required-1 bits for VMX control MSRs

From: Vitaly Kuznetsov
Date: Wed Jun 22 2022 - 12:45:35 EST


Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
---
arch/x86/kvm/vmx/nested.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 8cc2187b5556..ede6314a641e 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -6553,9 +6553,6 @@ void nested_vmx_setup_ctls_msrs(struct vmcs_config *vmcs_conf, u32 ept_caps)
{
struct nested_vmx_msrs *msrs = &vmcs_conf->nested;

- /* Take the allowed-1 bits from KVM's sanitized VMCS configuration. */
- u32 ignore_high;
-
/*
* Note that as a general rule, the high half of the MSRs (bits in
* the control fields which may be 1) should be initialized by the
@@ -6572,8 +6569,7 @@ void nested_vmx_setup_ctls_msrs(struct vmcs_config *vmcs_conf, u32 ept_caps)
*/

/* pin-based controls */
- rdmsr(MSR_IA32_VMX_PINBASED_CTLS, msrs->pinbased_ctls_low, ignore_high);
- msrs->pinbased_ctls_low |=
+ msrs->pinbased_ctls_low = vmcs_conf->pin_based_exec_ctrl_req1 |
PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR;

msrs->pinbased_ctls_high = vmcs_conf->pin_based_exec_ctrl;
--
2.35.3