mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-21 05:44:01 +00:00
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>
This commit is contained in:
parent
9b06e1018a
commit
dee863b571
2 changed files with 12 additions and 4 deletions
|
@ -99,6 +99,9 @@ static struct clocksource hyperv_cs_msr = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *hypercall_pg;
|
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
|
* This function is to be invoked early in the boot sequence after the
|
||||||
* hypervisor has been detected.
|
* hypervisor has been detected.
|
||||||
|
@ -141,10 +144,10 @@ void hyperv_init(void)
|
||||||
union hv_x64_msr_hypercall_contents tsc_msr;
|
union hv_x64_msr_hypercall_contents tsc_msr;
|
||||||
|
|
||||||
tsc_pg = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
|
tsc_pg = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
|
||||||
if (!tsc_pg) {
|
if (!tsc_pg)
|
||||||
clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100);
|
goto register_msr_cs;
|
||||||
return;
|
|
||||||
}
|
hyperv_cs = &hyperv_cs_tsc;
|
||||||
|
|
||||||
rdmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
|
rdmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
|
||||||
|
|
||||||
|
@ -161,6 +164,8 @@ void hyperv_init(void)
|
||||||
* the partition counter.
|
* the partition counter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
register_msr_cs:
|
||||||
|
hyperv_cs = &hyperv_cs_msr;
|
||||||
if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
|
if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
|
||||||
clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100);
|
clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/clocksource.h>
|
||||||
#include <asm/hyperv.h>
|
#include <asm/hyperv.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -168,6 +169,8 @@ void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs));
|
||||||
void hv_remove_crash_handler(void);
|
void hv_remove_crash_handler(void);
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_HYPERV)
|
#if IS_ENABLED(CONFIG_HYPERV)
|
||||||
|
extern struct clocksource *hyperv_cs;
|
||||||
|
|
||||||
void hyperv_init(void);
|
void hyperv_init(void);
|
||||||
void hyperv_report_panic(struct pt_regs *regs);
|
void hyperv_report_panic(struct pt_regs *regs);
|
||||||
bool hv_is_hypercall_page_setup(void);
|
bool hv_is_hypercall_page_setup(void);
|
||||||
|
|
Loading…
Add table
Reference in a new issue