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>
---
src/xenxs/xen_sxpr.c | 26 +++++++++++
src/xenxs/xen_xm.c | 26 +++++++++++
tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.sexpr | 9 ++++
tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml | 44 +++++++++++++++++++
.../sexpr2xmldata/sexpr2xml-fv-force-nohpet.sexpr | 9 ++++
tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml | 44 +++++++++++++++++++
tests/sexpr2xmltest.c | 2 +
tests/xmconfigdata/test-fullvirt-force-hpet.cfg | 26 +++++++++++
tests/xmconfigdata/test-fullvirt-force-hpet.xml | 45 ++++++++++++++++++++
tests/xmconfigdata/test-fullvirt-force-nohpet.cfg | 26 +++++++++++
tests/xmconfigdata/test-fullvirt-force-nohpet.xml | 45 ++++++++++++++++++++
tests/xmconfigtest.c | 3 +
tests/xml2sexprdata/xml2sexpr-fv-force-hpet.sexpr | 9 ++++
tests/xml2sexprdata/xml2sexpr-fv-force-hpet.xml | 39 +++++++++++++++++
.../xml2sexprdata/xml2sexpr-fv-force-nohpet.sexpr | 9 ++++
tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.xml | 39 +++++++++++++++++
tests/xml2sexprtest.c | 2 +
17 files changed, 403 insertions(+), 0 deletions(-)
create mode 100644 tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.sexpr
create mode 100644 tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml
create mode 100644 tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.sexpr
create mode 100644 tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml
create mode 100644 tests/xmconfigdata/test-fullvirt-force-hpet.cfg
create mode 100644 tests/xmconfigdata/test-fullvirt-force-hpet.xml
create mode 100644 tests/xmconfigdata/test-fullvirt-force-nohpet.cfg
create mode 100644 tests/xmconfigdata/test-fullvirt-force-nohpet.xml
create mode 100644 tests/xml2sexprdata/xml2sexpr-fv-force-hpet.sexpr
create mode 100644 tests/xml2sexprdata/xml2sexpr-fv-force-hpet.xml
create mode 100644 tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.sexpr
create mode 100644 tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.xml
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) {
+ virReportOOMError();
+ goto error;
+ }
+
+ timer->name = VIR_DOMAIN_TIMER_NAME_HPET;
+ timer->present = sexpr_int(root, "domain/image/hvm/hpet");
+ timer->tickpolicy = -1;
+
+ def->clock.ntimers = 1;
+ def->clock.timers[0] = timer;
+ }
}
/* Current XenD allows localtime here, for PV and HVM */
@@ -2216,6 +2233,15 @@ xenFormatSxpr(virConnectPtr conn,
if (def->emulator && (hvm || xendConfigVersion >= 3))
virBufferEscapeSexpr(&buf, "(device_model '%s')",
def->emulator);
+ /* 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)",
+ def->clock.timers[i]->present);
+ break;
+ }
+ }
/* PV graphics for xen <= 3.0.4, or HVM graphics for xen <= 3.1.0 */
if ((!hvm && xendConfigVersion < XEND_CONFIG_MIN_VERS_PVFB_NEWCONF)
||
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 0acd120..3b92019 100644
--- a/src/xenxs/xen_xm.c
+++ 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) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ timer->name = VIR_DOMAIN_TIMER_NAME_HPET;
+ timer->present = val;
+ timer->tickpolicy = -1;
+
+ def->clock.ntimers = 1;
+ def->clock.timers[0] = timer;
+ }
}
if (xenXMConfigGetBool(conf, "localtime", &vmlocaltime, 0) < 0)
goto cleanup;
@@ -1513,6 +1532,13 @@ virConfPtr xenFormatXM(virConnectPtr conn,
goto cleanup;
}
+ 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 &&
+ xenXMConfigSetInt(conf, "hpet",
def->clock.timers[i]->present) < 0)
+ break;
+ }
+
if (xendConfigVersion == 1) {
for (i = 0 ; i < def->ndisks ; i++) {
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM
&&
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.sexpr
b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.sexpr
new file mode 100644
index 0000000..d52214f
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.sexpr
@@ -0,0 +1,9 @@
+(domain (domid 1)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)\
+(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')\
+(on_reboot 'restart')(on_crash 'restart')\
+(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
+(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
+(device_model '/usr/lib64/xen/bin/qemu-dm')(hpet 1)(vnc 1)))\
+(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode
'w')))\
+(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script
'vif-bridge')\
+(model 'e1000')(type ioemu))))\
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml
new file mode 100644
index 0000000..d0ead27
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml
@@ -0,0 +1,44 @@
+<domain type='xen' id='1'>
+ <name>fvtest</name>
+ <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+ <memory>409600</memory>
+ <currentMemory>409600</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <clock offset='utc'>
+ <timer name='hpet' present='yes'/>
+ </clock>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
+ <disk type='file' device='disk'>
+ <driver name='file'/>
+ <source file='/root/foo.img'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='file'/>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:1b:b1:47'/>
+ <source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
+ <target dev='vif1.0'/>
+ <model type='e1000'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='5901' autoport='no'/>
+ </devices>
+</domain>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.sexpr
b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.sexpr
new file mode 100644
index 0000000..75bc8b1
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.sexpr
@@ -0,0 +1,9 @@
+(domain (domid 1)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)\
+(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')\
+(on_reboot 'restart')(on_crash 'restart')\
+(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
+(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
+(device_model '/usr/lib64/xen/bin/qemu-dm')(hpet 0)(vnc 1)))\
+(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode
'w')))\
+(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script
'vif-bridge')\
+(model 'e1000')(type ioemu))))\
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml
new file mode 100644
index 0000000..9e6deae
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml
@@ -0,0 +1,44 @@
+<domain type='xen' id='1'>
+ <name>fvtest</name>
+ <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+ <memory>409600</memory>
+ <currentMemory>409600</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <clock offset='utc'>
+ <timer name='hpet' present='no'/>
+ </clock>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
+ <disk type='file' device='disk'>
+ <driver name='file'/>
+ <source file='/root/foo.img'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='file'/>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:1b:b1:47'/>
+ <source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
+ <target dev='vif1.0'/>
+ <model type='e1000'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='5901' autoport='no'/>
+ </devices>
+</domain>
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index 9f74ece..cd2ba55 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -165,6 +165,8 @@ mymain(int argc, char **argv)
DO_TEST("fv-usbmouse", "fv-usbmouse", 1);
DO_TEST("fv-usbtablet", "fv-usbtablet", 1);
DO_TEST("fv-kernel", "fv-kernel", 1);
+ DO_TEST("fv-force-hpet", "fv-force-hpet", 1);
+ DO_TEST("fv-force-nohpet", "fv-force-nohpet", 1);
DO_TEST("fv-serial-null", "fv-serial-null", 1);
DO_TEST("fv-serial-file", "fv-serial-file", 1);
diff --git a/tests/xmconfigdata/test-fullvirt-force-hpet.cfg
b/tests/xmconfigdata/test-fullvirt-force-hpet.cfg
new file mode 100644
index 0000000..4dd7585
--- /dev/null
+++ b/tests/xmconfigdata/test-fullvirt-force-hpet.cfg
@@ -0,0 +1,26 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+builder = "hvm"
+kernel = "/usr/lib/xen/boot/hvmloader"
+boot = "d"
+pae = 1
+acpi = 1
+apic = 1
+localtime = 0
+hpet = 1
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-dm"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vncpasswd = "123poi"
+disk = [ "phy:/dev/HostVG/XenGuest2,hda,w",
"file:/root/boot.iso,hdc:cdrom,r" ]
+vif = [
"mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu"
]
+parallel = "none"
+serial = "none"
diff --git a/tests/xmconfigdata/test-fullvirt-force-hpet.xml
b/tests/xmconfigdata/test-fullvirt-force-hpet.xml
new file mode 100644
index 0000000..a662b97
--- /dev/null
+++ b/tests/xmconfigdata/test-fullvirt-force-hpet.xml
@@ -0,0 +1,45 @@
+<domain type='xen'>
+ <name>XenGuest2</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory>592896</memory>
+ <currentMemory>403456</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='xenfv'>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='cdrom'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset='utc'>
+ <timer name='hpet' present='yes'/>
+ </clock>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type='block' device='disk'>
+ <driver name='phy'/>
+ <source dev='/dev/HostVG/XenGuest2'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='file'/>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:92:9c'/>
+ <source bridge='xenbr1'/>
+ <script path='vif-bridge'/>
+ <model type='e1000'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes'
listen='127.0.0.1' passwd='123poi'/>
+ </devices>
+</domain>
diff --git a/tests/xmconfigdata/test-fullvirt-force-nohpet.cfg
b/tests/xmconfigdata/test-fullvirt-force-nohpet.cfg
new file mode 100644
index 0000000..d4fb429
--- /dev/null
+++ b/tests/xmconfigdata/test-fullvirt-force-nohpet.cfg
@@ -0,0 +1,26 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+builder = "hvm"
+kernel = "/usr/lib/xen/boot/hvmloader"
+boot = "d"
+pae = 1
+acpi = 1
+apic = 1
+localtime = 0
+hpet = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-dm"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vncpasswd = "123poi"
+disk = [ "phy:/dev/HostVG/XenGuest2,hda,w",
"file:/root/boot.iso,hdc:cdrom,r" ]
+vif = [
"mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu"
]
+parallel = "none"
+serial = "none"
diff --git a/tests/xmconfigdata/test-fullvirt-force-nohpet.xml
b/tests/xmconfigdata/test-fullvirt-force-nohpet.xml
new file mode 100644
index 0000000..bcd9af6
--- /dev/null
+++ b/tests/xmconfigdata/test-fullvirt-force-nohpet.xml
@@ -0,0 +1,45 @@
+<domain type='xen'>
+ <name>XenGuest2</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory>592896</memory>
+ <currentMemory>403456</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='xenfv'>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='cdrom'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset='utc'>
+ <timer name='hpet' present='no'/>
+ </clock>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type='block' device='disk'>
+ <driver name='phy'/>
+ <source dev='/dev/HostVG/XenGuest2'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='file'/>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:92:9c'/>
+ <source bridge='xenbr1'/>
+ <script path='vif-bridge'/>
+ <model type='e1000'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes'
listen='127.0.0.1' passwd='123poi'/>
+ </devices>
+</domain>
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 7d418a5..7a44dbc 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -230,6 +230,9 @@ mymain(int argc, char **argv)
DO_TEST("fullvirt-serial-udp", 2);
DO_TEST("fullvirt-serial-unix", 2);
+ DO_TEST("fullvirt-force-hpet", 2);
+ DO_TEST("fullvirt-force-nohpet", 2);
+
DO_TEST("fullvirt-parallel-tcp", 2);
DO_TEST("fullvirt-sound", 2);
diff --git a/tests/xml2sexprdata/xml2sexpr-fv-force-hpet.sexpr
b/tests/xml2sexprdata/xml2sexpr-fv-force-hpet.sexpr
new file mode 100644
index 0000000..400872d
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-fv-force-hpet.sexpr
@@ -0,0 +1,9 @@
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)\
+(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
+(on_reboot 'restart')(on_crash 'restart')\
+(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
+(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
+(device_model '/usr/lib64/xen/bin/qemu-dm')(hpet 1)(vnc 1)))\
+(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode
'w')))\
+(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script
'vif-bridge')\
+(model 'e1000')(type ioemu))))\
diff --git a/tests/xml2sexprdata/xml2sexpr-fv-force-hpet.xml
b/tests/xml2sexprdata/xml2sexpr-fv-force-hpet.xml
new file mode 100644
index 0000000..1065f0e
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-fv-force-hpet.xml
@@ -0,0 +1,39 @@
+<domain type='xen'>
+ <name>fvtest</name>
+ <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <memory>409600</memory>
+ <vcpu>1</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <features>
+ <acpi/>
+ </features>
+ <clock offset='utc'>
+ <timer name='hpet' present='yes'/>
+ </clock>
+ <devices>
+ <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:16:3e:1b:b1:47'/>
+ <script path='vif-bridge'/>
+ <model type='e1000'/>
+ </interface>
+ <disk type='file' device='cdrom'>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc'/>
+ <readonly/>
+ </disk>
+ <disk type='file'>
+ <source file='/root/foo.img'/>
+ <target dev='ioemu:hda'/>
+ </disk>
+ <graphics type='vnc' port='5917' keymap='ja'/>
+ </devices>
+</domain>
diff --git a/tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.sexpr
b/tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.sexpr
new file mode 100644
index 0000000..9577892
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.sexpr
@@ -0,0 +1,9 @@
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)\
+(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')\
+(on_reboot 'restart')(on_crash 'restart')\
+(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)\
+(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)\
+(device_model '/usr/lib64/xen/bin/qemu-dm')(hpet 0)(vnc 1)))\
+(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode
'w')))\
+(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script
'vif-bridge')\
+(model 'e1000')(type ioemu))))\
diff --git a/tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.xml
b/tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.xml
new file mode 100644
index 0000000..decfd67
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.xml
@@ -0,0 +1,39 @@
+<domain type='xen'>
+ <name>fvtest</name>
+ <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <memory>409600</memory>
+ <vcpu>1</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <features>
+ <acpi/>
+ </features>
+ <clock offset='utc'>
+ <timer name='hpet' present='no'/>
+ </clock>
+ <devices>
+ <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:16:3e:1b:b1:47'/>
+ <script path='vif-bridge'/>
+ <model type='e1000'/>
+ </interface>
+ <disk type='file' device='cdrom'>
+ <source file='/root/boot.iso'/>
+ <target dev='hdc'/>
+ <readonly/>
+ </disk>
+ <disk type='file'>
+ <source file='/root/foo.img'/>
+ <target dev='ioemu:hda'/>
+ </disk>
+ <graphics type='vnc' port='5917' keymap='ja'/>
+ </devices>
+</domain>
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index cf530b6..465e6f6 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -146,6 +146,8 @@ mymain(int argc, char **argv)
DO_TEST("fv-usbmouse", "fv-usbmouse", "fvtest", 1);
DO_TEST("fv-usbmouse", "fv-usbmouse", "fvtest", 1);
DO_TEST("fv-kernel", "fv-kernel", "fvtest", 1);
+ DO_TEST("fv-force-hpet", "fv-force-hpet", "fvtest",
1);
+ DO_TEST("fv-force-nohpet", "fv-force-nohpet", "fvtest",
1);
DO_TEST("fv-serial-null", "fv-serial-null", "fvtest",
1);
DO_TEST("fv-serial-file", "fv-serial-file", "fvtest",
1);
--
1.7.4.4