]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cuda: fix off-by-one error in SET_TIME command
authorAurelien Jarno <aurelien@aurel32.net>
Mon, 18 Apr 2016 08:07:45 +0000 (10:07 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 19 Apr 2016 01:39:23 +0000 (11:39 +1000)
With the new framework the cuda_cmd_set_time command directly receive
the data, without the command byte. Therefore the time is stored at
in_data[0], not at in_data[1].

This fixes the "hwclock --systohc" command in a guest.

Cc: Hervé Poussineau <hpoussin@reactos.org>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
[this fixes a regression introduced by e647317 "cuda: port SET_TIME
 command to new framework"]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/misc/macio/cuda.c

index c7472aaa9d1288a2137303535052bf4b4f12783c..f15f301100339ec1704437f88e65c1c96f1d24c6 100644 (file)
@@ -685,8 +685,8 @@ static bool cuda_cmd_set_time(CUDAState *s,
         return false;
     }
 
-    ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16)
-         + (((uint32_t)in_data[3]) << 8) + in_data[4];
+    ti = (((uint32_t)in_data[0]) << 24) + (((uint32_t)in_data[1]) << 16)
+         + (((uint32_t)in_data[2]) << 8) + in_data[3];
     s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
                            / NANOSECONDS_PER_SECOND);
     return true;