aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorSebastian Tanase <sebastian.tanase@openwide.fr>2014-07-25 11:56:29 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2014-08-06 17:53:07 +0200
commita8bfac37085c3372366d722f131a7e18d664ee4d (patch)
tree51cd30abe502c20f1334220a6766a3319219f0a6 /cpus.c
parent1ad9580bd730f195a59136d11fdc431f90f266aa (diff)
downloadqemu-a8bfac37085c3372366d722f131a7e18d664ee4d.zip
qemu-a8bfac37085c3372366d722f131a7e18d664ee4d.tar.gz
qemu-a8bfac37085c3372366d722f131a7e18d664ee4d.tar.bz2
icount: Add align option to icount
The align option is used for activating the align algorithm in order to synchronise the host clock and the guest clock. Signed-off-by: Sebastian Tanase <sebastian.tanase@openwide.fr> Tested-by: Camille Bégué <camille.begue@openwide.fr> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/cpus.c b/cpus.c
index 8291044..7e09538 100644
--- a/cpus.c
+++ b/cpus.c
@@ -476,25 +476,30 @@ static const VMStateDescription vmstate_timers = {
void configure_icount(QemuOpts *opts, Error **errp)
{
const char *option;
+ char *rem_str = NULL;
seqlock_init(&timers_state.vm_clock_seqlock, NULL);
vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
option = qemu_opt_get(opts, "shift");
if (!option) {
+ if (qemu_opt_get(opts, "align") != NULL) {
+ error_setg(errp, "Please specify shift option when using align");
+ }
return;
}
- /* When using -icount shift, the shift option will be
- misinterpreted as a boolean */
- if (strcmp(option, "on") == 0 || strcmp(option, "off") == 0) {
- error_setg(errp, "The shift option must be a number or auto");
- }
-
+ icount_align_option = qemu_opt_get_bool(opts, "align", false);
icount_warp_timer = timer_new_ns(QEMU_CLOCK_REALTIME,
icount_warp_rt, NULL);
if (strcmp(option, "auto") != 0) {
- icount_time_shift = strtol(option, NULL, 0);
+ errno = 0;
+ icount_time_shift = strtol(option, &rem_str, 0);
+ if (errno != 0 || *rem_str != '\0' || !strlen(option)) {
+ error_setg(errp, "icount: Invalid shift value");
+ }
use_icount = 1;
return;
+ } else if (icount_align_option) {
+ error_setg(errp, "shift=auto and align=on are incompatible");
}
use_icount = 2;