Skip to content

Commit

Permalink
Merge branch 'x86-hyperv-for-linus' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/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/)
  • Loading branch information
Linus Torvalds committed Oct 28, 2011
2 parents a93f3e9 + 6f4151c commit cc21fe5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 102 deletions.
23 changes: 23 additions & 0 deletions arch/x86/kernel/cpu/mshyperv.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/

#include <linux/types.h>
#include <linux/time.h>
#include <linux/clocksource.h>
#include <linux/module.h>
#include <asm/processor.h>
#include <asm/hypervisor.h>
Expand All @@ -36,6 +38,25 @@ static bool __init ms_hyperv_platform(void)
!memcmp("Microsoft Hv", hyp_signature, 12);
}

static cycle_t read_hv_clock(struct clocksource *arg)
{
cycle_t current_tick;
/*
* Read the partition counter to get the current tick count. This count
* is set to 0 when the partition is created and is incremented in
* 100 nanosecond units.
*/
rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick);
return current_tick;
}

static struct clocksource hyperv_cs = {
.name = "hyperv_clocksource",
.rating = 400, /* use this when running on Hyperv*/
.read = read_hv_clock,
.mask = CLOCKSOURCE_MASK(64),
};

static void __init ms_hyperv_init_platform(void)
{
/*
Expand All @@ -46,6 +67,8 @@ static void __init ms_hyperv_init_platform(void)

printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n",
ms_hyperv.features, ms_hyperv.hints);

clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
}

const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/hv/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
obj-$(CONFIG_HYPERV) += hv_timesource.o
obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o
obj-$(CONFIG_HYPERV_NET) += hv_netvsc.o
obj-$(CONFIG_HYPERV_MOUSE) += hv_mouse.o
Expand Down
101 changes: 0 additions & 101 deletions drivers/staging/hv/hv_timesource.c

This file was deleted.

0 comments on commit cc21fe5

Please sign in to comment.