[PATCH 6/9] KVM: nVMX: Add consistency check for TSC_MULTIPLIER=0

From: Sean Christopherson

Date: Thu Sep 18 2025 - 21:00:08 EST


Add a missing consistency check on the TSC Multiplier being '0'. Per the
SDM:

If the "use TSC scaling" VM-execution control is 1, the TSC-multiplier
must not be zero.

Fixes: d041b5ea9335 ("KVM: nVMX: Enable nested TSC scaling")
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/vmx/nested.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 5ac7ad207ef7..eb838ebeff0f 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -2906,6 +2906,10 @@ static int nested_check_vm_execution_controls(struct kvm_vcpu *vcpu,
}
}

+ if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_TSC_SCALING) &&
+ CC(!vmcs12->tsc_multiplier))
+ return -EINVAL;
+
return 0;
}

--
2.51.0.470.ga7dc726c21-goog