aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.h
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2016-06-20 22:28:02 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-06-27 15:30:38 +0200
commit8d93c874ac899bfdf0ad3787baef684a0c878c2c (patch)
treeda1c4185a08082c0ef8fad9440b5573b5dcbf8e8 /arch/x86/kvm/x86.h
parentpvclock: Get rid of __pvclock_read_cycles in function pvclock_read_flags (diff)
downloadlinux-dev-8d93c874ac899bfdf0ad3787baef684a0c878c2c.tar.xz
linux-dev-8d93c874ac899bfdf0ad3787baef684a0c878c2c.zip
KVM: x86: move nsec_to_cycles from x86.c to x86.h
Move the inline function nsec_to_cycles from x86.c to x86.h, as the next patch uses it from lapic.c. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to '')
-rw-r--r--arch/x86/kvm/x86.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 7ce3634ab5fe..a82ca466b62e 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -2,6 +2,7 @@
#define ARCH_X86_KVM_X86_H
#include <linux/kvm_host.h>
+#include <asm/pvclock.h>
#include "kvm_cache_regs.h"
#define MSR_IA32_CR_PAT_DEFAULT 0x0007040600070406ULL
@@ -195,6 +196,12 @@ extern unsigned int lapic_timer_advance_ns;
extern struct static_key kvm_no_apic_vcpu;
+static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec)
+{
+ return pvclock_scale_delta(nsec, vcpu->arch.virtual_tsc_mult,
+ vcpu->arch.virtual_tsc_shift);
+}
+
/* Same "calling convention" as do_div:
* - divide (n << 32) by base
* - put result in n