From: john stultz <johnstul@us.ibm.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, tglx@linutronix.de,
hch@infradead.org, Hank Janssen <hjanssen@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>
Subject: Re: [PATCH 1/1] Clocksource: Move the Hyper-V clocksource driver out of staging
Date: Mon, 23 May 2011 11:40:27 -0700 [thread overview]
Message-ID: <1306176027.2968.5.camel@work-vm> (raw)
In-Reply-To: <1306170743-17797-1-git-send-email-kys@microsoft.com>
On Mon, 2011-05-23 at 10:12 -0700, K. Y. Srinivasan wrote:
> Move the Hyper-V clocksource driver out of staging.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> ---
> drivers/clocksource/Makefile | 1 +
> drivers/clocksource/hv_timesource.c | 102 +++++++++++++++++++++++++++++++++++
> drivers/staging/hv/Makefile | 2 +-
> drivers/staging/hv/hv_timesource.c | 102 -----------------------------------
> 4 files changed, 104 insertions(+), 103 deletions(-)
> create mode 100644 drivers/clocksource/hv_timesource.c
> delete mode 100644 drivers/staging/hv/hv_timesource.c
>
> diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
> index be61ece..ea44327 100644
> --- a/drivers/clocksource/Makefile
> +++ b/drivers/clocksource/Makefile
> @@ -6,3 +6,4 @@ obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC) += cs5535-clockevt.o
> obj-$(CONFIG_SH_TIMER_CMT) += sh_cmt.o
> obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o
> obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o
> +obj-$(CONFIG_HYPERV) += hv_timesource.o
> diff --git a/drivers/clocksource/hv_timesource.c b/drivers/clocksource/hv_timesource.c
> new file mode 100644
> index 0000000..0efb049
> --- /dev/null
> +++ b/drivers/clocksource/hv_timesource.c
> @@ -0,0 +1,102 @@
> +/*
> + * A clocksource for Linux running on HyperV.
> + *
> + *
> + * Copyright (C) 2010, Novell, Inc.
> + * Author : K. Y. Srinivasan <ksrinivasan@novell.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
> + * NON INFRINGEMENT. See the GNU General Public License for more
> + * details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
> + *
> + */
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include <linux/version.h>
> +#include <linux/clocksource.h>
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/dmi.h>
> +#include <asm/hyperv.h>
> +#include <asm/mshyperv.h>
> +#include <asm/hypervisor.h>
> +
> +#define HV_CLOCK_SHIFT 22
> +
> +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),
> + /*
> + * The time ref counter in HyperV is in 100ns units.
> + * The definition of mult is:
> + * mult/2^shift = ns/cyc = 100
> + * mult = (100 << shift)
> + */
> + .mult = (100 << HV_CLOCK_SHIFT),
> + .shift = HV_CLOCK_SHIFT,
The mult/shift assignments can be dropped. Please use
clocksource_register_hz/khz() which will assign mult/shift for you.
Otherwise it looks pretty straightforward.
> +module_init(init_hv_clocksource);
> +MODULE_DESCRIPTION("HyperV based clocksource");
> +MODULE_AUTHOR("K. Y. Srinivasan <ksrinivasan@novell.com>");
> +MODULE_LICENSE("GPL");
One other nit: Should this email address be updated to your current one?
thanks
-john
next prev parent reply other threads:[~2011-05-23 18:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-23 17:12 [PATCH 1/1] Clocksource: Move the Hyper-V clocksource driver out of staging K. Y. Srinivasan
2011-05-23 18:15 ` Thomas Gleixner
2011-05-23 18:50 ` KY Srinivasan
2011-05-23 19:17 ` Thomas Gleixner
2011-05-23 18:40 ` john stultz [this message]
2011-05-23 18:43 ` KY Srinivasan
2011-05-23 18:42 ` Christoph Hellwig
2011-05-23 19:05 ` KY Srinivasan
-- strict thread matches above, loose matches on Subject: below --
2011-05-24 21:32 K. Y. Srinivasan
2011-05-24 22:43 ` Thomas Gleixner
2011-05-25 0:29 ` KY Srinivasan
2011-05-25 6:58 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1306176027.2968.5.camel@work-vm \
--to=johnstul@us.ibm.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@suse.de \
--cc=haiyangz@microsoft.com \
--cc=hch@infradead.org \
--cc=hjanssen@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.