Skip to content

Commit

Permalink
cuda: fix off-by-one error in SET_TIME command
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: David Gibson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
Reviewed-by: Hervé Poussineau <[email protected]>
[this fixes a regression introduced by e647317 "cuda: port SET_TIME
 command to new framework"]
Signed-off-by: David Gibson <[email protected]>
  • Loading branch information
aurel32 authored and dgibson committed Apr 19, 2016
1 parent 92b674b commit ed3d807
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/misc/macio/cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ed3d807

Please sign in to comment.