summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-07-26 09:26:29 +0200
committerDave Airlie <airlied@redhat.com>2016-07-26 09:26:29 +0200
commit5e580523d9128a4d8364fe89d36c38fc7819c8dd (patch)
tree852fb2427d980830ae8686a91e4ca5873f259ab9 /arch/x86/kvm/x86.h
parentMerge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu into drm... (diff)
parentLinux 4.7 (diff)
downloadlinux-5e580523d9128a4d8364fe89d36c38fc7819c8dd.tar.xz
linux-5e580523d9128a4d8364fe89d36c38fc7819c8dd.zip
Backmerge tag 'v4.7' into drm-next
Linux 4.7 As requested by Daniel Vetter as the conflicts were getting messy.
Diffstat (limited to 'arch/x86/kvm/x86.h')
-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