Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Nadav Har'El <nyh@il.ibm.com>
Tested-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>

authored by

Nadav Har'El and committed by
Avi Kivity
45133eca 27fc51b2

+1 -3
+1 -3
arch/x86/kvm/svm.c
··· 2923 2923 2924 2924 switch (ecx) { 2925 2925 case MSR_IA32_TSC: { 2926 - struct vmcb *vmcb = get_host_vmcb(svm); 2927 - 2928 - *data = vmcb->control.tsc_offset + 2926 + *data = svm->vmcb->control.tsc_offset + 2929 2927 svm_scale_tsc(vcpu, native_read_tsc()); 2930 2928 2931 2929 break;