qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] cuda: fix off-by-one error in SET_TIME command
@ 2016-04-18  8:07 Aurelien Jarno
  2016-04-18 11:06 ` Hervé Poussineau
  2016-04-19  1:41 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Aurelien Jarno @ 2016-04-18  8:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Aurelien Jarno, Hervé Poussineau, David Gibson

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>
---
 hw/misc/macio/cuda.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index c7472aa..f15f301 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -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;
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] cuda: fix off-by-one error in SET_TIME command
  2016-04-18  8:07 [Qemu-devel] [PATCH] cuda: fix off-by-one error in SET_TIME command Aurelien Jarno
@ 2016-04-18 11:06 ` Hervé Poussineau
  2016-04-19  1:41 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: Hervé Poussineau @ 2016-04-18 11:06 UTC (permalink / raw)
  To: Aurelien Jarno, qemu-devel; +Cc: qemu-ppc, David Gibson

Le 18/04/2016 10:07, Aurelien Jarno a écrit :
>
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] cuda: fix off-by-one error in SET_TIME command
  2016-04-18  8:07 [Qemu-devel] [PATCH] cuda: fix off-by-one error in SET_TIME command Aurelien Jarno
  2016-04-18 11:06 ` Hervé Poussineau
@ 2016-04-19  1:41 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2016-04-19  1:41 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: qemu-devel, qemu-ppc, Hervé Poussineau

[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]

On Mon, Apr 18, 2016 at 10:07:45AM +0200, Aurelien Jarno wrote:
> 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>

Applied to ppc-for-2.6.  I'll send a pull request shortly.

> ---
>  hw/misc/macio/cuda.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
> index c7472aa..f15f301 100644
> --- a/hw/misc/macio/cuda.c
> +++ b/hw/misc/macio/cuda.c
> @@ -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;

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-19  1:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18  8:07 [Qemu-devel] [PATCH] cuda: fix off-by-one error in SET_TIME command Aurelien Jarno
2016-04-18 11:06 ` Hervé Poussineau
2016-04-19  1:41 ` David Gibson

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).