]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/hyperv: Implement hv_get_tsc_page()
authorVitaly Kuznetsov <vkuznets@redhat.com>
Fri, 3 Mar 2017 13:21:40 +0000 (14:21 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 11 Mar 2017 13:47:28 +0000 (14:47 +0100)
To use Hyper-V TSC page clocksource from vDSO we need to make tsc_pg
available. Implement hv_get_tsc_page() and add CONFIG_HYPERV_TSCPAGE to
make #ifdef-s simple.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: devel@linuxdriverproject.org
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: virtualization@lists.linux-foundation.org
Link: http://lkml.kernel.org/r/20170303132142.25595-2-vkuznets@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/hyperv/hv_init.c
arch/x86/include/asm/mshyperv.h
drivers/hv/Kconfig

index 8bef70e7f3cc6d242e7841bfa2404d182e5235cd..bb1ea58ecd7a4e55a2064c277cafd56867f408ad 100644 (file)
 #include <linux/clockchips.h>
 
 
-#ifdef CONFIG_X86_64
+#ifdef CONFIG_HYPERV_TSCPAGE
 
 static struct ms_hyperv_tsc_page *tsc_pg;
 
+struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
+{
+       return tsc_pg;
+}
+
 static u64 read_hv_clock_tsc(struct clocksource *arg)
 {
        u64 current_tick;
@@ -139,7 +144,7 @@ void hyperv_init(void)
        /*
         * Register Hyper-V specific clocksource.
         */
-#ifdef CONFIG_X86_64
+#ifdef CONFIG_HYPERV_TSCPAGE
        if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
                union hv_x64_msr_hypercall_contents tsc_msr;
 
index 7c9c895432a9ff4a6fdcc7b409ee775a69ceb0ec..d324dce133a1f6fd4d34548a786938cf29ea1cea 100644 (file)
@@ -176,4 +176,12 @@ void hyperv_report_panic(struct pt_regs *regs);
 bool hv_is_hypercall_page_setup(void);
 void hyperv_cleanup(void);
 #endif
+#ifdef CONFIG_HYPERV_TSCPAGE
+struct ms_hyperv_tsc_page *hv_get_tsc_page(void);
+#else
+static inline struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
+{
+       return NULL;
+}
+#endif
 #endif
index 0403b51d20ba067840af755373871e37fc52575d..c29cd5387a353ef013ff164bb8ee459a443d87a3 100644 (file)
@@ -7,6 +7,9 @@ config HYPERV
          Select this option to run Linux as a Hyper-V client operating
          system.
 
+config HYPERV_TSCPAGE
+       def_bool HYPERV && X86_64
+
 config HYPERV_UTILS
        tristate "Microsoft Hyper-V Utilities driver"
        depends on HYPERV && CONNECTOR && NLS