* [Qemu-devel] [PATCH 1/3] alleviate time drift with HPET periodic timers
[not found] <739175196.420885.1300461195339.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
@ 2011-03-18 15:54 ` Ulrich Obergfell
2011-03-19 9:45 ` [Qemu-devel] " Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Obergfell @ 2011-03-18 15:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Jan Kiszka, aliguori, kvm, gcosta
Part 1 of the patch implements the following QEMU command line option.
-hpet [device=none|present][,driftfix=none|slew]
Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>
diff -up ./qemu-config.c.orig1 ./qemu-config.c
--- ./qemu-config.c.orig1 2011-02-18 22:48:06.000000000 +0100
+++ ./qemu-config.c 2011-03-13 12:38:22.813976639 +0100
@@ -261,6 +261,23 @@ static QemuOptsList qemu_rtc_opts = {
},
};
+#ifdef CONFIG_HPET_DRIFTFIX
+static QemuOptsList qemu_hpet_opts = {
+ .name = "hpet",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_hpet_opts.head),
+ .desc = {
+ {
+ .name = "device",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "driftfix",
+ .type = QEMU_OPT_STRING,
+ },
+ { /* end of list */ }
+ },
+};
+#endif
+
static QemuOptsList qemu_global_opts = {
.name = "global",
.head = QTAILQ_HEAD_INITIALIZER(qemu_global_opts.head),
@@ -462,6 +479,9 @@ static QemuOptsList *vm_config_groups[32
&qemu_netdev_opts,
&qemu_net_opts,
&qemu_rtc_opts,
+#ifdef CONFIG_HPET_DRIFTFIX
+ &qemu_hpet_opts,
+#endif
&qemu_global_opts,
&qemu_mon_opts,
&qemu_cpudef_opts,
diff -up ./qemu-options.hx.orig1 ./qemu-options.hx
--- ./qemu-options.hx.orig1 2011-02-18 22:48:06.000000000 +0100
+++ ./qemu-options.hx 2011-03-13 12:38:22.815977096 +0100
@@ -972,6 +972,13 @@ STEXI
Disable HPET support.
ETEXI
+#ifdef CONFIG_HPET_DRIFTFIX
+DEF("hpet", HAS_ARG, QEMU_OPTION_hpet, \
+ "-hpet [device=none|present][,driftfix=none|slew]\n" \
+ " disable or enable HPET, disable or enable drift fix for periodic timers\n",
+ QEMU_ARCH_ALL)
+#endif
+
DEF("balloon", HAS_ARG, QEMU_OPTION_balloon,
"-balloon none disable balloon device\n"
"-balloon virtio[,addr=str]\n"
diff -up ./vl.c.orig1 ./vl.c
--- ./vl.c.orig1 2011-02-18 22:48:06.000000000 +0100
+++ ./vl.c 2011-03-13 12:38:35.167984285 +0100
@@ -203,6 +203,9 @@ CharDriverState *parallel_hds[MAX_PARALL
CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
int win2k_install_hack = 0;
int rtc_td_hack = 0;
+#ifdef CONFIG_HPET_DRIFTFIX
+int hpet_driftfix = 0;
+#endif
int usb_enabled = 0;
int singlestep = 0;
int smp_cpus = 1;
@@ -431,6 +434,41 @@ static void configure_rtc(QemuOpts *opts
}
}
+#ifdef CONFIG_HPET_DRIFTFIX
+static void configure_hpet(QemuOpts *opts)
+{
+ const char *value, *opt;
+
+ opt = "device";
+ value = qemu_opt_get(opts, opt);
+ if (value) {
+ if (!strcmp(value, "present")) {
+ no_hpet = 0;
+ } else if (!strcmp(value, "none")) {
+ no_hpet = 1;
+ } else {
+ goto error_exit;
+ }
+ }
+ opt = "driftfix";
+ value = qemu_opt_get(opts, opt);
+ if (value) {
+ if (!strcmp(value, "slew")) {
+ hpet_driftfix = 1;
+ } else if (!strcmp(value, "none")) {
+ hpet_driftfix = 0;
+ } else {
+ goto error_exit;
+ }
+ }
+ return;
+
+error_exit:
+ fprintf(stderr, "qemu: -hpet option '%s': value missing or invalid\n", opt);
+ exit(1);
+}
+#endif
+
/***********************************************************/
/* Bluetooth support */
static int nb_hcis;
@@ -2644,6 +2682,15 @@ int main(int argc, char **argv, char **e
case QEMU_OPTION_no_hpet:
no_hpet = 1;
break;
+#ifdef CONFIG_HPET_DRIFTFIX
+ case QEMU_OPTION_hpet:
+ opts = qemu_opts_parse(qemu_find_opts("hpet"), optarg, 0);
+ if (!opts) {
+ exit(1);
+ }
+ configure_hpet(opts);
+ break;
+#endif
case QEMU_OPTION_balloon:
if (balloon_parse(optarg) < 0) {
fprintf(stderr, "Unknown -balloon argument %s\n", optarg);
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH 1/3] alleviate time drift with HPET periodic timers
2011-03-18 15:54 ` [Qemu-devel] [PATCH 1/3] alleviate time drift with HPET periodic timers Ulrich Obergfell
@ 2011-03-19 9:45 ` Jan Kiszka
2011-03-22 9:40 ` Ulrich Obergfell
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2011-03-19 9:45 UTC (permalink / raw)
To: Ulrich Obergfell
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, kvm,
gcosta@redhat.com
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
On 2011-03-18 16:54, Ulrich Obergfell wrote:
>
> Part 1 of the patch implements the following QEMU command line option.
>
> -hpet [device=none|present][,driftfix=none|slew]
Just define driftfix as property of the hpet device. That way it can be
controlled both globally (-global hpet.driftfix=...) and per hpet block
(once we support instantiating >1 of them).
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH 1/3] alleviate time drift with HPET periodic timers
2011-03-19 9:45 ` [Qemu-devel] " Jan Kiszka
@ 2011-03-22 9:40 ` Ulrich Obergfell
0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Obergfell @ 2011-03-22 9:40 UTC (permalink / raw)
To: Jan Kiszka; +Cc: aliguori, qemu-devel, kvm, gcosta
>> Part 1 of the patch implements the following QEMU command line option.
>>
>> -hpet [device=none|present][,driftfix=none|slew]
>
> Just define driftfix as property of the hpet device. That way it can be
> controlled both globally (-global hpet.driftfix=...) and per hpet block
> (once we support instantiating >1 of them).
Many Thanks Jan,
I started investigating code changes. I'm thinking of ...
- adding a new field to the HPETState structure.
uint32_t driftfix;
- adding the property 'driftfix' to the DeviceInfo structure.
DEFINE_PROP_BIT("driftfix", HPETState, driftfix, 0, false)
Using a single bit so that the option syntax would be, e.g.:
-global hpet.driftfix=on (Default is 'off')
- Replace all 'if (hpet_driftfix ...)' by:
if ((HPETState)s->driftfix ...)
Regards,
Uli
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-22 9:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <739175196.420885.1300461195339.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
2011-03-18 15:54 ` [Qemu-devel] [PATCH 1/3] alleviate time drift with HPET periodic timers Ulrich Obergfell
2011-03-19 9:45 ` [Qemu-devel] " Jan Kiszka
2011-03-22 9:40 ` Ulrich Obergfell
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).