summaryrefslogtreecommitdiff
path: root/arch/x86/hyperv
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2017-02-04 19:57:13 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-10 17:40:19 +0300
commitdee863b571b0a76e9c549ee99e8782bb4bc6502b (patch)
treec3f69821e106090e79c5a3c7e030616d72cfacd5 /arch/x86/hyperv
parent9b06e1018abc65585b07c75c5b3f406dbabe7005 (diff)
downloadlinux-dee863b571b0a76e9c549ee99e8782bb4bc6502b.tar.xz
hv: export current Hyper-V clocksource
As a preparation to implementing Hyper-V PTP device supporting .getcrosststamp we need to export a reference to the current Hyper-V clocksource in use (MSR or TSC page). Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/hyperv')
-rw-r--r--arch/x86/hyperv/hv_init.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index b371d0e984a9..c224b7df4d21 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -99,6 +99,9 @@ static struct clocksource hyperv_cs_msr = {
};
static void *hypercall_pg;
+struct clocksource *hyperv_cs;
+EXPORT_SYMBOL_GPL(hyperv_cs);
+
/*
* This function is to be invoked early in the boot sequence after the
* hypervisor has been detected.
@@ -141,10 +144,10 @@ void hyperv_init(void)
union hv_x64_msr_hypercall_contents tsc_msr;
tsc_pg = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
- if (!tsc_pg) {
- clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100);
- return;
- }
+ if (!tsc_pg)
+ goto register_msr_cs;
+
+ hyperv_cs = &hyperv_cs_tsc;
rdmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
@@ -161,6 +164,8 @@ void hyperv_init(void)
* the partition counter.
*/
+register_msr_cs:
+ hyperv_cs = &hyperv_cs_msr;
if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100);
}