On 05/10/2011 05:24 AM, Paolo Bonzini wrote:
Recent versions of Xen disable the virtual HPET by default. This is
usually more precise because tick policies are not implemented for
the HPET in Xen. However, there may be several reasons to control
the HPET manually: 1) to test the emulation; 2) because distros may
provide the knob while leaving the default to "enabled" for compatibility
reasons.
This patch provides support for the hpet item in both sexpr and xm
formats, and translates it to a <timer> element.
Signed-off-by: Paolo Bonzini <pbonzini(a)redhat.com>
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 3a412a6..d8a18f7 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -1174,6 +1174,23 @@ xenParseSxpr(const struct sexpr *root,
/* Old XenD only allows localtime here for HVM */
if (sexpr_int(root, "domain/image/hvm/localtime"))
def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
+
+ if (sexpr_lookup(root, "domain/image/hvm/hpet")) {
+ virDomainTimerDefPtr timer;
+
+ if (VIR_ALLOC_N(def->clock.timers, 1) < 0 ||
+ VIR_ALLOC(timer) < 0) {
TAB character. 'make syntax-check' would have caught it.
+ /* look for HPET in order to override the hypervisor/xend
default */
+ for (i = 0; i < def->clock.ntimers; i++) {
+ if (def->clock.timers[i]->name == VIR_DOMAIN_TIMER_NAME_HPET
&&
+ def->clock.timers[i]->present != -1) {
+ virBufferVSprintf(&buf, "(hpet %d)",
This patch was written before commit 68ea80c renaming things to
virBufferAsprint.
+++ b/src/xenxs/xen_xm.c
@@ -367,6 +367,25 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto cleanup;
else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_HAP);
+
+ if (xenXMConfigGetBool(conf, "hpet", &val, -1) < 0)
+ goto cleanup;
+ else if (val != -1) {
+ virDomainTimerDefPtr timer;
+
+ if (VIR_ALLOC_N(def->clock.timers, 1) < 0 ||
+ VIR_ALLOC(timer) < 0) {
Another TAB.
ACK with those nits fixed, so I pushed this.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org