提交 45133eca 编写于 作者: N Nadav Har'El 提交者: Avi Kivity

KVM: SVM: Fix TSC MSR read in nested SVM

When the TSC MSR is read by an L2 guest (when L1 allowed this MSR to be
read without exit), we need to return L2's notion of the TSC, not L1's.

The current code incorrectly returned L1 TSC, because svm_get_msr() was also
used in x86.c where this was assumed, but now that these places call the new
svm_read_l1_tsc(), the MSR read can be fixed.
Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
Tested-by: NJoerg Roedel <joerg.roedel@amd.com>
Acked-by: NJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 27fc51b2
...@@ -2923,9 +2923,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data) ...@@ -2923,9 +2923,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
switch (ecx) { switch (ecx) {
case MSR_IA32_TSC: { case MSR_IA32_TSC: {
struct vmcb *vmcb = get_host_vmcb(svm); *data = svm->vmcb->control.tsc_offset +
*data = vmcb->control.tsc_offset +
svm_scale_tsc(vcpu, native_read_tsc()); svm_scale_tsc(vcpu, native_read_tsc());
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册