cuda: fix off-by-one error in SET_TIME command
PATCH 1/1 cuda: fix off-by-one error in SET_TIME command
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]>
--- hw/misc/macio/cuda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/misc/macio/cuda.c +2 -2
@@ -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;
Signature · 1 line
2.8.0.rc3
Quoted 6 lines · Aurelien Jarno
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]>
David Gibson
AppliedQuoted 9 lines · Aurelien Jarno
With the new framework the
cuda_cmd_set_timecommand 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]>
Applied to ppc-for-2.6. I'll send a pull request shortly.
Quoted 19 lines
--- hw/misc/macio/cuda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/misc/macio/cuda.c +2
-2@@ -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;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson