All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] new hvm platform vhpet enable parameter
@ 2008-02-07 17:46 Dan Magenheimer
  2008-02-07 17:52 ` Samuel Thibault
  2008-02-07 17:53 ` Keir Fraser
  0 siblings, 2 replies; 13+ messages in thread
From: Dan Magenheimer @ 2008-02-07 17:46 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 891 bytes --]

HVM domains currently always have a virtual hpet (high-precision event timer)
enabled.  This patch adds an hvm platform variable "vhpet" to enable/disable
virtualization of the hpet for a guest.

Default is off (no vhpet) because vhpet is currently less accurate in keeping
time than PIT (because no timer_mode adjustments), and because AFAICT VMware
still doesn't implement virtual hpet.

A similar patch to enable/disable pmtimer is also needed but I thought
I'd post this one for discussion first.

This patch applies against and was tested with xen-3.1-testing.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>

===================================
If Xen could save time in a bottle / then clocks wouldn't virtually skew /
It would save every tick / for VMs that aren't quick /
and Xen then would send them anew
(with apologies to the late great Jim Croce)

[-- Attachment #2: vhpet.patch --]
[-- Type: application/octet-stream, Size: 4645 bytes --]

diff -r 6741bbc08b25 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py	Mon Feb 04 14:32:26 2008 +0000
+++ b/tools/python/xen/xend/XendConfig.py	Thu Feb 07 09:27:13 2008 -0700
@@ -124,7 +124,7 @@ XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 
 XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'boot', 'device_model', 'display', 
                         'fda', 'fdb', 'keymap', 'isa', 'localtime', 'monitor', 
                         'nographic', 'pae', 'rtc_timeoffset', 'serial', 'sdl',
-                        'soundhw','stdvga', 'usb', 'usbdevice', 'vnc',
+                        'soundhw','stdvga', 'usb', 'usbdevice', 'vhpet', 'vnc',
                         'vncconsole', 'vncdisplay', 'vnclisten', 'timer_mode',
                         'vncpasswd', 'vncunused', 'xauthority']
 
diff -r 6741bbc08b25 tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py	Mon Feb 04 14:32:26 2008 +0000
+++ b/tools/python/xen/xend/XendConstants.py	Thu Feb 07 09:27:13 2008 -0700
@@ -44,6 +44,7 @@ HVM_PARAM_IOREQ_PFN    = 5
 HVM_PARAM_IOREQ_PFN    = 5
 HVM_PARAM_BUFIOREQ_PFN = 6
 HVM_PARAM_TIMER_MODE   = 10
+HVM_PARAM_VHPET        = 11
 
 restart_modes = [
     "restart",
diff -r 6741bbc08b25 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Mon Feb 04 14:32:26 2008 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Feb 07 09:27:13 2008 -0700
@@ -1547,6 +1547,12 @@ class XendDomainInfo:
         if hvm and timer_mode is not None:
             xc.hvm_set_param(self.domid, HVM_PARAM_TIMER_MODE,
                              long(timer_mode))
+
+        # Optionally enable virtual HPET
+        vhpet = self.info["platform"].get("vhpet")
+        if hvm and vhpet is not None:
+            xc.hvm_set_param(self.domid, HVM_PARAM_VHPET,
+                             long(vhpet))
 
         # Set maximum number of vcpus in domain
         xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
diff -r 6741bbc08b25 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py	Mon Feb 04 14:32:26 2008 +0000
+++ b/tools/python/xen/xm/create.py	Thu Feb 07 09:27:13 2008 -0700
@@ -193,6 +193,10 @@ gopts.var('pae', val='PAE',
 gopts.var('pae', val='PAE',
           fn=set_int, default=1,
           use="Disable or enable PAE of HVM domain.")
+
+gopts.var('vhpet', val='VHPET',
+          fn=set_int, default=0,
+          use="Enable virtual high-precision event timer.")
 
 gopts.var('timer_mode', val='TIMER_MODE',
           fn=set_int, default=0,
@@ -731,7 +735,7 @@ def configure_hvm(config_image, vals):
              'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
              'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
              'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
-             'acpi', 'apic', 'usb', 'usbdevice', 'keymap' ]
+             'vhpet', 'acpi', 'apic', 'usb', 'usbdevice', 'keymap' ]
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:
             config_image.append([a, vals.__dict__[a]])
diff -r 6741bbc08b25 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py	Mon Feb 04 14:32:26 2008 +0000
+++ b/tools/python/xen/xm/xenapi_create.py	Thu Feb 07 09:27:13 2008 -0700
@@ -755,7 +755,7 @@ class sxp2xml:
 
 
     def extract_platform(self, image, document):
-        platform_keys = ['acpi', 'apic', 'pae', 'timer_mode']
+        platform_keys = ['acpi', 'apic', 'pae', 'timer_mode', 'vhpet']
 
         def extract_platform_key(key):
             platform = document.createElement("platform")
diff -r 6741bbc08b25 xen/arch/x86/hvm/hpet.c
--- a/xen/arch/x86/hvm/hpet.c	Mon Feb 04 14:32:26 2008 +0000
+++ b/xen/arch/x86/hvm/hpet.c	Thu Feb 07 09:27:13 2008 -0700
@@ -328,6 +328,8 @@ static void hpet_write(
 
 static int hpet_range(struct vcpu *v, unsigned long addr)
 {
+    if (!(v->domain->arch.hvm_domain.params[HVM_PARAM_VHPET]))
+        return 0;
     return ((addr >= HPET_BASE_ADDRESS) &&
             (addr < (HPET_BASE_ADDRESS + HPET_MMAP_SIZE)));
 }
diff -r 6741bbc08b25 xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h	Mon Feb 04 14:32:26 2008 +0000
+++ b/xen/include/public/hvm/params.h	Thu Feb 07 09:27:13 2008 -0700
@@ -79,6 +79,12 @@
 #define HVMPTM_no_missed_ticks_pending   2
 #define HVMPTM_one_missed_tick_pending   3
 
-#define HVM_NR_PARAMS          11
+/*
+ * Enable virtual HPET (high-precision event timer) (x86-only)
+ *  0=disabled, 1-enabled
+ */
+#define HVM_PARAM_VHPET 11
+
+#define HVM_NR_PARAMS          12
 
 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-02-14 21:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-07 17:46 [PATCH] new hvm platform vhpet enable parameter Dan Magenheimer
2008-02-07 17:52 ` Samuel Thibault
2008-02-07 17:53 ` Keir Fraser
2008-02-07 18:29   ` Dan Magenheimer
2008-02-07 18:37     ` Keir Fraser
2008-02-07 20:53       ` Dan Magenheimer
2008-02-14 16:52         ` Dan Magenheimer
2008-02-14 17:52           ` Keir Fraser
2008-02-14 18:18             ` Dan Magenheimer
2008-02-14 19:25               ` Keir Fraser
2008-02-14 19:48                 ` Dan Magenheimer
2008-02-14 21:50                   ` Keir Fraser
2008-02-08 12:50     ` Stephen C. Tweedie

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.