linux/arch/x86/kvm
Haozhong Zhang d7add05458 KVM: x86: Use adjustment in guest cycles when handling MSR_IA32_TSC_ADJUST
When kvm_set_msr_common() handles a guest's write to
MSR_IA32_TSC_ADJUST, it will calcuate an adjustment based on the data
written by guest and then use it to adjust TSC offset by calling a
call-back adjust_tsc_offset(). The 3rd parameter of adjust_tsc_offset()
indicates whether the adjustment is in host TSC cycles or in guest TSC
cycles. If SVM TSC scaling is enabled, adjust_tsc_offset()
[i.e. svm_adjust_tsc_offset()] will first scale the adjustment;
otherwise, it will just use the unscaled one. As the MSR write here
comes from the guest, the adjustment is in guest TSC cycles. However,
the current kvm_set_msr_common() uses it as a value in host TSC
cycles (by using true as the 3rd parameter of adjust_tsc_offset()),
which can result in an incorrect adjustment of TSC offset if SVM TSC
scaling is enabled. This patch fixes this problem.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Cc: stable@vger.linux.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-08-07 13:28:03 +02:00
..
assigned-dev.c VFS: assorted d_backing_inode() annotations 2015-04-15 15:06:59 -04:00
assigned-dev.h KVM: x86: move device assignment out of kvm_host.h 2014-11-24 16:53:50 +01:00
cpuid.c KVM: VMX: fix vmwrite to invalid VMCS 2015-07-10 13:25:25 +02:00
cpuid.h KVM: x86: save/load state on SMM switch 2015-06-04 16:17:46 +02:00
emulate.c KVM: x86: save/load state on SMM switch 2015-06-04 16:17:46 +02:00
i8254.c KVM: x86: make vapics_in_nmi_mode atomic 2015-07-03 18:55:17 +02:00
i8254.h KVM: move iodev.h from virt/kvm/ to include/kvm 2015-03-26 21:43:12 +00:00
i8259.c KVM/ARM changes for v4.1: 2015-04-07 18:09:20 +02:00
ioapic.c KVM: x86: drop unneeded null test 2015-05-07 11:29:47 +02:00
ioapic.h KVM/ARM changes for v4.1: 2015-04-07 18:09:20 +02:00
iommu.c KVM: count number of assigned devices 2015-07-10 13:25:26 +02:00
irq.c KVM: nVMX: fix "acknowledge interrupt on exit" when APICv is in use 2014-08-05 15:00:24 +02:00
irq.h KVM: move iodev.h from virt/kvm/ to include/kvm 2015-03-26 21:43:12 +00:00
irq_comm.c kvm: x86: Deliver MSI IRQ to only lowest prio cpu if msi_redir_hint is true 2015-05-07 11:29:45 +02:00
Kconfig KVM: x86: mark legacy PCI device assignment as deprecated 2015-06-05 17:26:39 +02:00
kvm_cache_regs.h KVM: x86: API changes for SMM support 2015-06-04 16:01:11 +02:00
lapic.c KVM: x86: rename quirk constants to KVM_X86_QUIRK_* 2015-07-23 08:24:42 +02:00
lapic.h KVM: x86: keep track of LVT0 changes under APICv 2015-07-03 18:55:18 +02:00
Makefile KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch 2015-06-23 14:12:14 +02:00
mmu.c KVM: x86: reintroduce kvm_is_mmio_pfn 2015-07-10 13:25:24 +02:00
mmu.h KVM: MMU: fix MTRR update 2015-05-19 20:52:42 +02:00
mmu_audit.c Minor merge needed, due to function move. 2015-07-01 10:49:25 -07:00
mmutrace.h tracing: Rename ftrace_event.h to trace_events.h 2015-05-13 14:05:12 -04:00
mtrr.c KVM: MTRR: Use default type for non-MTRR-covered gfn before WARN_ON 2015-08-05 11:57:57 +02:00
paging_tmpl.h KVM: x86: use vcpu-specific functions to read/write/translate GFNs 2015-06-05 17:26:36 +02:00
pmu.c KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch 2015-06-23 14:12:14 +02:00
pmu.h KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch 2015-06-23 14:12:14 +02:00
pmu_amd.c KVM: x86/vPMU: Implement AMD vPMU code for KVM 2015-06-23 14:12:15 +02:00
pmu_intel.c KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch 2015-06-23 14:12:14 +02:00
svm.c KVM: x86: rename quirk constants to KVM_X86_QUIRK_* 2015-07-23 08:24:42 +02:00
trace.h KVM: x86: save/load state on SMM switch 2015-06-04 16:17:46 +02:00
tss.h KVM: x86: hardware task switching support 2008-04-27 12:00:39 +03:00
vmx.c KVM: x86: rename quirk constants to KVM_X86_QUIRK_* 2015-07-23 08:24:42 +02:00
x86.c KVM: x86: Use adjustment in guest cycles when handling MSR_IA32_TSC_ADJUST 2015-08-07 13:28:03 +02:00
x86.h KVM: x86: introduce kvm_check_has_quirk 2015-07-23 08:22:45 +02:00