Staging: hv: Integrate the time source driver with Hyper-V detection code
Subsystems (4)
PATCH 1/1 Staging: hv: Integrate the time source driver with Hyper-V detection code
The Hyper-V timesource driver is best integrated with Hyper-V detection code
since: (a) Linux guests running on Hyper-V need this timesource and (b) by integrating with Hyper-V detection, we could minimize the code in the timesource driver. Greg, you had helped me initially in getting the Hyper-V detection code into the kernel (mshyperv.c). I am hoping you can take this patch.
--- arch/x86/kernel/cpu/mshyperv.c | 24 ++++++++ drivers/staging/hv/Makefile | 2 +- drivers/staging/hv/hv_timesource.c | 102 ------------------------------------ 3 files changed, 25 insertions(+), 103 deletions(-) delete mode 100644 drivers/staging/hv/hv_timesource.c
arch/x86/kernel/cpu/mshyperv.c +24 -0
@@ -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>
@@ -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 ) {/*
@@ -46,6 +67,9 @@ 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 = {
drivers/staging/hv/Makefile +1 -1
@@ -1,4 +1,4 @@ -obj-$(CONFIG_HYPERV) += hv_vmbus.o hv_timesource.o +obj-$(CONFIG_HYPERV) += hv_vmbus.o obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o obj-$(CONFIG_HYPERV_NET) += hv_netvsc.o obj-$(CONFIG_HYPERV_UTILS) += hv_utils.o
drivers/staging/hv/hv_timesource.c deleted +0 -102
102 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Quoted 6 lines · K. Y. Srinivasan
The Hyper-V timesource driver is best integrated with Hyper-V detection code
since: (a) Linux guests running on Hyper-V need this timesource and (b) by integrating with Hyper-V detection, we could minimize the code in the timesource driver. Greg, you had helped me initially in getting the Hyper-V detection code into the kernel (mshyperv.c). I am hoping you can take this patch.
Nope, it needs to go through the x86 maintainers, please resend it to them. The scripts/get_maintainer.pl file should have told you this, right?
thanks,
greg k-h
Quoted 19 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Wednesday, June 29, 2011 3:07 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Staging: hv: Integrate the time source driver with Hyper- V detection codeQuoted 6 lines · K. Y. Srinivasan
The Hyper-V timesource driver is best integrated with Hyper-V detection code
since: (a) Linux guests running on Hyper-V need this timesource and (b) by integrating with Hyper-V detection, we could minimize the code in the timesource driver. Greg, you had helped me initially in getting the Hyper-V detection code into the kernel (mshyperv.c). I am hoping you can take this patch.
Quoted 3 lines
Nope, it needs to go through the x86 maintainers, please resend it to them. The
scripts/get_maintainer.plfile should have told you this, right?
Thanks Greg. I have done what you have recommended.
Regards,
K. Y