diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-28 08:08:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-28 08:08:40 -0400 |
commit | cc21fe518a971bb2b0ab8370ec46ea21e84c57ab (patch) | |
tree | 5d701b2c3ca84a7848c240a325621868d9592da7 /arch | |
parent | a93f3e9f424ffb82b4983d2ebf8667ef20255015 (diff) | |
parent | 6f4151c89b7d036c755d8cf74729e09b76fa6676 (diff) |
Merge branch 'x86-hyperv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'x86-hyperv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86: Hyper-V: Integrate the clocksource with Hyper-V detection code
Fix up conflicts in drivers/staging/hv/Makefile manually (some of the hv
code has moved out of staging to drivers/hv/)
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/mshyperv.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index d944bf6c50e9..0a630dd4b620 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c | |||
@@ -11,6 +11,8 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/time.h> | ||
15 | #include <linux/clocksource.h> | ||
14 | #include <linux/module.h> | 16 | #include <linux/module.h> |
15 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
16 | #include <asm/hypervisor.h> | 18 | #include <asm/hypervisor.h> |
@@ -36,6 +38,25 @@ static bool __init ms_hyperv_platform(void) | |||
36 | !memcmp("Microsoft Hv", hyp_signature, 12); | 38 | !memcmp("Microsoft Hv", hyp_signature, 12); |
37 | } | 39 | } |
38 | 40 | ||
41 | static cycle_t read_hv_clock(struct clocksource *arg) | ||
42 | { | ||
43 | cycle_t current_tick; | ||
44 | /* | ||
45 | * Read the partition counter to get the current tick count. This count | ||
46 | * is set to 0 when the partition is created and is incremented in | ||
47 | * 100 nanosecond units. | ||
48 | */ | ||
49 | rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick); | ||
50 | return current_tick; | ||
51 | } | ||
52 | |||
53 | static struct clocksource hyperv_cs = { | ||
54 | .name = "hyperv_clocksource", | ||
55 | .rating = 400, /* use this when running on Hyperv*/ | ||
56 | .read = read_hv_clock, | ||
57 | .mask = CLOCKSOURCE_MASK(64), | ||
58 | }; | ||
59 | |||
39 | static void __init ms_hyperv_init_platform(void) | 60 | static void __init ms_hyperv_init_platform(void) |
40 | { | 61 | { |
41 | /* | 62 | /* |
@@ -46,6 +67,8 @@ static void __init ms_hyperv_init_platform(void) | |||
46 | 67 | ||
47 | printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n", | 68 | printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n", |
48 | ms_hyperv.features, ms_hyperv.hints); | 69 | ms_hyperv.features, ms_hyperv.hints); |
70 | |||
71 | clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); | ||
49 | } | 72 | } |
50 | 73 | ||
51 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { | 74 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { |