From: Sheng Yang <sheng@linux.intel.com>
To: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
Ingo Molnar <mingo@elte.hu>
Cc: Ian Pratt <Ian.Pratt@eu.citrix.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
xen-devel <xen-devel@lists.xensource.com>,
linux-kernel@vger.kernel.org, Sheng Yang <sheng@linux.intel.com>
Subject: [PATCH 6/7] xen: Enable PV clocksource for HVM
Date: Fri, 5 Mar 2010 14:07:56 +0800 [thread overview]
Message-ID: <1267769277-20522-7-git-send-email-sheng@linux.intel.com> (raw)
In-Reply-To: <1267769277-20522-1-git-send-email-sheng@linux.intel.com>
And enable it by default in PV extended HVM guest.
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
arch/x86/xen/hvmpv.c | 18 ++++++++++++++++++
arch/x86/xen/time.c | 12 +++++++++++-
arch/x86/xen/xen-ops.h | 1 +
3 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/arch/x86/xen/hvmpv.c b/arch/x86/xen/hvmpv.c
index 540eef4..305dcca 100644
--- a/arch/x86/xen/hvmpv.c
+++ b/arch/x86/xen/hvmpv.c
@@ -43,6 +43,7 @@ static void __init xen_hvm_pv_banner(void)
pv_info.name);
printk(KERN_INFO "Xen version: %d.%d%s\n",
version >> 16, version & 0xffff, extra.extraversion);
+ printk(KERN_INFO "PV feature: PV clocksource enabled\n");
}
static int __init xen_para_available(void)
@@ -112,6 +113,20 @@ static int __init init_shared_info(void)
return 0;
}
+static void __init init_pv_clocksource(void)
+{
+ if (enable_hvm_pv(HVM_PV_CLOCK))
+ BUG();
+
+ pv_time_ops.sched_clock = xen_sched_clock;
+
+ x86_platform.calibrate_tsc = xen_tsc_khz;
+ x86_platform.get_wallclock = xen_get_wallclock;
+ x86_platform.set_wallclock = xen_set_wallclock;
+
+ xen_register_clocksource();
+}
+
void __init xen_guest_init(void)
{
int r;
@@ -133,5 +148,8 @@ void __init xen_guest_init(void)
x86_init.oem.banner = xen_hvm_pv_banner;
pv_info = xen_hvm_pv_info;
+ /* PV clocksource would be enabled by default */
+ init_pv_clocksource();
+
xen_domain_type = XEN_HVM_DOMAIN;
}
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 0d3f07c..06b3e72 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -472,11 +472,21 @@ void xen_timer_resume(void)
}
}
+static bool xen_clocksource_enabled;
+
+void xen_register_clocksource(void)
+{
+ if (!xen_clocksource_enabled) {
+ clocksource_register(&xen_clocksource);
+ xen_clocksource_enabled = 1;
+ }
+}
+
__init void xen_time_init(void)
{
int cpu = smp_processor_id();
- clocksource_register(&xen_clocksource);
+ xen_register_clocksource();
if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {
/* Successfully turned off 100Hz tick, so we have the
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index f9153a3..d56b660 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -48,6 +48,7 @@ cycle_t xen_clocksource_read(void);
void xen_setup_cpu_clockevents(void);
unsigned long xen_tsc_khz(void);
void __init xen_time_init(void);
+void xen_register_clocksource(void);
unsigned long xen_get_wallclock(void);
int xen_set_wallclock(unsigned long time);
unsigned long long xen_sched_clock(void);
--
1.5.4.5
next prev parent reply other threads:[~2010-03-05 6:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-05 6:07 [PATCH 0/7][v6] PV extension of HVM (Hybrid) for Xen Sheng Yang
2010-03-05 6:07 ` [PATCH 1/7] xen: add support for hvm_op Sheng Yang
2010-03-05 6:07 ` [PATCH 2/7] xen: Import cpuid.h from Xen Sheng Yang
2010-03-05 6:07 ` [PATCH 3/7] xen: Make pv drivers only work with xen_pv_domain() Sheng Yang
2010-03-05 6:07 ` [PATCH 4/7] xen/hvm: Xen PV extension of HVM initialization Sheng Yang
2010-03-05 6:07 ` [PATCH 5/7] x86/xen: The entrance for PV extension of HVM Sheng Yang
2010-03-05 6:07 ` Sheng Yang [this message]
2010-03-05 6:07 ` [PATCH 7/7] xen: Enable event channel of " Sheng Yang
2010-03-08 22:16 ` [Xen-devel] " Jeremy Fitzhardinge
2010-03-09 5:55 ` Sheng Yang
-- strict thread matches above, loose matches on Subject: below --
2010-03-08 7:18 [PATCH 0/7][v7] PV extension of HVM (Hybrid) for Xen Sheng Yang
2010-03-08 7:18 ` [PATCH 6/7] xen: Enable PV clocksource for HVM Sheng Yang
2010-03-04 9:36 [PATCH 0/7][v5] PV extension of HVM (Hybrid) for Xen Sheng Yang
2010-03-04 9:36 ` [PATCH 6/7] xen: Enable PV clocksource for HVM Sheng Yang
2010-03-04 17:40 ` Jeremy Fitzhardinge
2010-03-04 20:25 ` Ian Campbell
2010-03-05 2:54 ` Sheng Yang
2010-03-05 9:31 ` Ian Campbell
2010-03-08 7:05 ` Sheng Yang
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=1267769277-20522-7-git-send-email-sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Pratt@eu.citrix.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=xen-devel@lists.xensource.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).