Commit 5f3c6a6c authored by Haozhong Zhang's avatar Haozhong Zhang Committed by Sasha Levin

KVM: VMX: Fix host initiated access to guest MSR_TSC_AUX

[ Upstream commit 81b1b9ca ]

The current handling of accesses to guest MSR_TSC_AUX returns error if
vcpu does not support rdtscp, though those accesses are initiated by
host. This can result in the reboot failure of some versions of
QEMU. This patch fixes this issue by passing those host initiated
accesses for further handling instead.
Signed-off-by: default avatarHaozhong Zhang <haozhong.zhang@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent a3fe4599
...@@ -2691,7 +2691,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) ...@@ -2691,7 +2691,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
msr_info->data = vcpu->arch.ia32_xss; msr_info->data = vcpu->arch.ia32_xss;
break; break;
case MSR_TSC_AUX: case MSR_TSC_AUX:
if (!to_vmx(vcpu)->rdtscp_enabled) if (!to_vmx(vcpu)->rdtscp_enabled && !msr_info->host_initiated)
return 1; return 1;
/* Otherwise falls through */ /* Otherwise falls through */
default: default:
...@@ -2797,7 +2797,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) ...@@ -2797,7 +2797,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
clear_atomic_switch_msr(vmx, MSR_IA32_XSS); clear_atomic_switch_msr(vmx, MSR_IA32_XSS);
break; break;
case MSR_TSC_AUX: case MSR_TSC_AUX:
if (!vmx->rdtscp_enabled) if (!vmx->rdtscp_enabled && !msr_info->host_initiated)
return 1; return 1;
/* Check reserved bit, higher 32 bits should be zero */ /* Check reserved bit, higher 32 bits should be zero */
if ((data >> 32) != 0) if ((data >> 32) != 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment