Received: from eggs.gnu.org ([2001:4830:134:3::10]:44818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asKlp-0000Gp-AT for qemu-devel@nongnu.org; Mon, 18 Apr 2016 21:48:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asKlo-0005fm-FR for qemu-devel@nongnu.org; Mon, 18 Apr 2016 21:48:05 -0400 From: David Gibson Date: Tue, 19 Apr 2016 11:49:19 +1000 Message-Id: <1461030559-8920-2-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1461030559-8920-1-git-send-email-david@gibson.dropbear.id.au> References: <1461030559-8920-1-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 1/1] cuda: fix off-by-one error in SET_TIME command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: agraf@suse.de, ppc-for-2.6-20160418@ozlabs.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Aurelien Jarno , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , David Gibson From: Aurelien Jarno 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=C3=A9 Poussineau Cc: David Gibson Signed-off-by: Aurelien Jarno Reviewed-by: Herv=C3=A9 Poussineau [this fixes a regression introduced by e647317 "cuda: port SET_TIME command to new framework"] Signed-off-by: David Gibson --- 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; } =20 - ti =3D (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 1= 6) - + (((uint32_t)in_data[3]) << 8) + in_data[4]; + ti =3D (((uint32_t)in_data[0]) << 24) + (((uint32_t)in_data[1]) << 1= 6) + + (((uint32_t)in_data[2]) << 8) + in_data[3]; s->tick_offset =3D ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / NANOSECONDS_PER_SECOND); return true; --=20 2.5.5